{ "info": { "author": "__tim__", "author_email": "timchen119@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 2 - Pre-Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: Artistic License", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python", "Topic :: Software Development :: Build Tools" ], "description": "ezpyinline\n\nThe ezpyinline is a pure python module which requires almost no setup to\nallows you put C source code directly \"inline\" in a Python script or module,\nthen the C code is automatically compiled and then loaded for immediate access from Python.\n\nezpyinline is forked from PyInline (http://pyinline.sourceforge.net/)\nbut aim to be as easy as possible and do all the magics for you.\n\nIt's great for test usage, since it's requires almost no setup for ezpyinline.\nJust grab ezpyinline.py into your program directory and start to use it.\n\nThe compiled python extension will placed at ~/.ezpyinline/ ,\nhowever, you could easily change this via EZPYINLINE_ROOTDIR to any where you want.\nAlso you don't need to care recompile or older version function/files,\nezpyinline will auto remove older version functions which you no longer needed.\n\nezpyinline tested in python2.4+ on linux,\nhowever it should works in python2.3+.\nYou'll need python-dev and working C compilers/toolchains to compile C.\nHowever, if you just wanna deploy on non-develop environment,\njust copy the ~/.ezpyinline directory and it should also works.\n\nTutorial:\n\nUsing ezpyinline is very simple: (also see example 1: helloworld.py )\n\n1. write a C function and put this function in a raw string literal.\n2. create a name binding use ezpyinline.C()\n3. call your C function in python from where you need it.\n4. run your python program as there's no C code inside it.\n \nSo grab ezpyinline.py and copy it to your current directory, \n(or just use easy_install -Z ezpyinline if you have setuptools installed),\nand try the following example.\n\nNote: use raw string parameter in ezpyinline.C() will be a good practice. \nThis prevents problems caused from the escape characters in C string literal.\n\n * Example 1: helloworld.py\n\n--- cut-here ---\n\n#!/usr/bin/python\nimport ezpyinline\n\n#step 1\ncode = r\"\"\"\n int helloworld() {\n printf(\"hello ezpyinline!\n\");\n }\n\"\"\"\n#step 2\nezc = ezpyinline.C(code)\n\n#step 3\nezc.helloworld()\n\n----------------\nand step 4: type python helloworld.py in shell:\n\n#python helloworld.py\nhello ezpyinline!\n\nprogram should works now, if you have any problem, \ncheck if your C compiler and python-dev package installed.\n\nYou could also write like this:\n\n * Example 1.b: helloworld2.py\n\n--- cut-here ---\n\n#!/usr/bin/python\nimport ezpyinline\n\nezc = ezpyinline.C(\nr\"\"\"\n int helloworld() {\n printf(\"hello ezpyinline\n\");\n }\n\"\"\")\n\nezc.helloworld()\n\n----------------\n\n * Example 2: prime.py\n\n--- cut-here ---\n\n#!/usr/bin/python\nimport ezpyinline\n\nezc = ezpyinline.C(\nr\"\"\"\n int prime(int num) {\n int x; \n for (x = 2; x < (num - 1) ; x++) {\n if (num == 2) {\n return 1;\n }\n if (num % x == 0) {\n return x;\n }\n }\n return 1;\n }\n\"\"\")\n\nfor num in xrange(10000):\n is_prime = ezc.prime(num)\n if is_prime == 1:\n print \"%d is a prime number\" % num\n else:\n print \"%d equals %d * %d\" %(num,is_prime,num/is_prime)\n\n----------------\nrun time in my p4-3.0G box:\n\nreal 0m0.590s\nuser 0m0.430s\nsys 0m0.020s\n\n----------------\n#!/usr/bin/python\nfor num in xrange(10000):\n is_prime = 1\n for x in xrange(2,num-1):\n if (num % x == 0):\n is_prime = x\n break\n\n if is_prime == 1:\n print \"%d is a prime number\" % num\n else:\n print \"%d equals %d * %d\" %(num,is_prime,num/is_prime)\n\n----------------\nrun time in my p4-3.0G box:\n\nreal 0m3.300s\nuser 0m3.190s\nsys 0m0.090s\n\n * Example 3: oldstyle_pyinline.py\n\nPyInline compatibility, you old PyInline code still works!\n\nAs for now, most of code in ezpyinline was from PyInline,\neverything you can do in PyInline should still works.\n\n--- cut-here ---\n#import PyInline\nfrom ezpyinline import PyInline # only change PyInline import to this line\n\nm = PyInline.build(code=\"\"\"\n double my_add(double a, double b) {\n return a + b;\n }\n\"\"\", language=\"C\")\n\nprint m.my_add(4.5, 5.5) # Should print out \"10.0\"\n----------------\n\nIf you need more complex usage please also see PyInline's README\n(http://pyinline.cvs.sourceforge.net/pyinline/PyInline/README.txt?revision=1.2&view=markup)\n,distutils package (http://www.python.org/sigs/distutils-sig/)\n,Python/C API Reference Manual (http://docs.python.org/api/api.html)\nand Extending and Embedding the Python Interpreter (http://docs.python.org/ext/ext.html)\n\nFor more more complex usage, you should check:\nPyrex: http://www.cosc.canterbury.ac.nz/greg.ewing/python/Pyrex/\nweave: http://www.scipy.org/Weave\nand ShedSkin: http://sourceforge.net/projects/shedskin\n\nFeedbacks are very welcome, please send them to my email.\n\nWebsite: http://ezpyinline.sf.net\n\nAuthor: __tim__ \nLicense: The Artistic License (http://www.opensource.org/licenses/artistic-license.php)\n\nChangelog:\n2007-02-08 Version 0.1 public released.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://ezpyinline.sf.net", "keywords": "", "license": "Artistic", "maintainer": "", "maintainer_email": "", "name": "ezpyinline", "package_url": "https://pypi.org/project/ezpyinline/", "platform": "any", "project_url": "https://pypi.org/project/ezpyinline/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://ezpyinline.sf.net" }, "release_url": "https://pypi.org/project/ezpyinline/0.1/", "requires_dist": null, "requires_python": null, "summary": "Easy embedded Inline C for Python", "version": "0.1" }, "last_serial": 791840, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "58c4cdfdc7c0ffad4eaf1637039beff1", "sha256": "5fb2e29abda20266207ab1ee91afeb600295a3e59620a5f150262de1c0347128" }, "downloads": -1, "filename": "ezpyinline-0.1-py2.4.egg", "has_sig": false, "md5_digest": "58c4cdfdc7c0ffad4eaf1637039beff1", "packagetype": "bdist_egg", "python_version": "2.4", "requires_python": null, "size": 17292, "upload_time": "2007-02-08T11:02:00", "url": "https://files.pythonhosted.org/packages/5e/38/1a09de29ef67ae1017f9fa6bf7e4af1c4553dbf9965aeb8e600f6a9a2a54/ezpyinline-0.1-py2.4.egg" }, { "comment_text": "", "digests": { "md5": "0d80180cbe365c925bf149ebfaf739ab", "sha256": "615ce7a2f090ee225c0b2427615b2d6e9d7163cf4a1e13b67f25285d839f583a" }, "downloads": -1, "filename": "ezpyinline-0.1.tar.gz", "has_sig": false, "md5_digest": "0d80180cbe365c925bf149ebfaf739ab", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7632, "upload_time": "2007-02-08T11:01:52", "url": "https://files.pythonhosted.org/packages/f8/02/d6aaff6ff6846befa4c19726d3a414298bd9718232009ac332a3f51c22a2/ezpyinline-0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "58c4cdfdc7c0ffad4eaf1637039beff1", "sha256": "5fb2e29abda20266207ab1ee91afeb600295a3e59620a5f150262de1c0347128" }, "downloads": -1, "filename": "ezpyinline-0.1-py2.4.egg", "has_sig": false, "md5_digest": "58c4cdfdc7c0ffad4eaf1637039beff1", "packagetype": "bdist_egg", "python_version": "2.4", "requires_python": null, "size": 17292, "upload_time": "2007-02-08T11:02:00", "url": "https://files.pythonhosted.org/packages/5e/38/1a09de29ef67ae1017f9fa6bf7e4af1c4553dbf9965aeb8e600f6a9a2a54/ezpyinline-0.1-py2.4.egg" }, { "comment_text": "", "digests": { "md5": "0d80180cbe365c925bf149ebfaf739ab", "sha256": "615ce7a2f090ee225c0b2427615b2d6e9d7163cf4a1e13b67f25285d839f583a" }, "downloads": -1, "filename": "ezpyinline-0.1.tar.gz", "has_sig": false, "md5_digest": "0d80180cbe365c925bf149ebfaf739ab", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7632, "upload_time": "2007-02-08T11:01:52", "url": "https://files.pythonhosted.org/packages/f8/02/d6aaff6ff6846befa4c19726d3a414298bd9718232009ac332a3f51c22a2/ezpyinline-0.1.tar.gz" } ] }