{ "info": { "author": "Jared Fields", "author_email": "jbfields@protonmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Console", "Environment :: Other Environment", "Intended Audience :: Developers", "Intended Audience :: Other Audience", "Natural Language :: English", "Operating System :: MacOS :: MacOS X", "Operating System :: Microsoft :: Windows", "Operating System :: OS Independent", "Operating System :: POSIX :: Linux", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: Implementation :: CPython", "Topic :: Software Development" ], "description": "# nimformat\n\nThe nimformat library is the result of an experiment in using the excellent nimpy module, for the awesome Nim programming language, to create a test library, for Python. The goal was to learn some about Nim, nimpy, creating native Python modules, and to see what, if any, speed boosts could be realized.\n\nThe `nim_sub()` function is a rudimentary implementation of string substitution in a similar way to how Python accepts a dictionary for its `string.format()`.\n\nThe Nim native Python library can be built by issuing the following command.\n\n`nim c --threads:on --app:lib --out:nimformat.pyd --tlsEmulation:off nimformat.nim`\n\nNOTE: This was done using the latest development version of Nim, which is 0.19.9 at the time of this writing.\n\nSimple benchmarks with Python's `timeit` module yield the following results. See `test_nimformat.py` for more details.\n```\nPure Python time : 1.7126781147680623e-05\nPure Python [no locals()] time : 1.8929600215857533e-05\nNim dylib time : 0.2829040771053697\nNim dylib [no locals()] time : 0.0016501803870713205\nNim dylib sub_multi time : 0.29930432216857517\nNim dylib sub_multi [no locals()] time : 0.0007848272343464746\n```\n\n\nExample 1:\n```\nimport nimformat\n\nvariable1 = 'string'\nvariable2 = 'contains'\n\ndictSub = dict(locals())\ndictSub = {str(key): str(dictSub[key]) for key in dictSub.keys() if '__' not in str(key)}\n\nstrWithSubstitutions = \"\"\"\nThis is a {variable1} which spans\nmultiple lines and {variable2} multiple\nsubstitutions.\n\"\"\"\n\nstrSubstituted = nimformat.nim_sub(strWithSubstitutions, dictSub)\n```\n\nExample 2:\n```\nimport nimformat\n\ndictSub = {\n 'variable1': 'string',\n 'variable2': 'contains'\n}\n\nstrWithSubstitutions = \"\"\"\nThis is a {variable1} which spans\nmultiple lines and {variable2} multiple\nsubstitutions.\n\"\"\"\n\nstrSubstituted = nimformat.nim_sub(strWithSubstitutions, dictSub)\n```\n\n", "description_content_type": "", "docs_url": null, "download_url": "https://github.com/UNIcodeX/nimformat", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/UNIcodeX/nimformat#nimformat", "keywords": "string", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "nimformat", "package_url": "https://pypi.org/project/nimformat/", "platform": "Linux", "project_url": "https://pypi.org/project/nimformat/", "project_urls": { "Download": "https://github.com/UNIcodeX/nimformat", "Homepage": "https://github.com/UNIcodeX/nimformat#nimformat" }, "release_url": "https://pypi.org/project/nimformat/0.1.3/", "requires_dist": null, "requires_python": "", "summary": "Faster keyword string substitution for Python", "version": "0.1.3" }, "last_serial": 4919369, "releases": { "0.1.2": [ { "comment_text": "", "digests": { "md5": "74c2a4e624b23bf6bb9e8091d28a0036", "sha256": "d1fed7bf93ca23cadb5b6b8f71fca3c254ccb39f0c4691551e6ca576791634a2" }, "downloads": -1, "filename": "nimformat-0.1.2.zip", "has_sig": false, "md5_digest": "74c2a4e624b23bf6bb9e8091d28a0036", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 152900, "upload_time": "2019-03-09T05:02:42", "url": "https://files.pythonhosted.org/packages/47/41/2777c91ec786af01e5ed849e3301aaebe8cefbce79abe820a221abd2ba97/nimformat-0.1.2.zip" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "1ed2be390935ab7ac1f0ddcf5c44d3c3", "sha256": "5a30cee0c14b9b57375d01ce1f98a3a1344e8e86534e5f3f23ce4badf18cccbf" }, "downloads": -1, "filename": "nimformat-0.1.3.zip", "has_sig": false, "md5_digest": "1ed2be390935ab7ac1f0ddcf5c44d3c3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 152960, "upload_time": "2019-03-09T18:56:37", "url": "https://files.pythonhosted.org/packages/ff/71/74d981e4f8d52d41d8cad76b31654c0c615cf442f379298d7c1c59ec81e6/nimformat-0.1.3.zip" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "1ed2be390935ab7ac1f0ddcf5c44d3c3", "sha256": "5a30cee0c14b9b57375d01ce1f98a3a1344e8e86534e5f3f23ce4badf18cccbf" }, "downloads": -1, "filename": "nimformat-0.1.3.zip", "has_sig": false, "md5_digest": "1ed2be390935ab7ac1f0ddcf5c44d3c3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 152960, "upload_time": "2019-03-09T18:56:37", "url": "https://files.pythonhosted.org/packages/ff/71/74d981e4f8d52d41d8cad76b31654c0c615cf442f379298d7c1c59ec81e6/nimformat-0.1.3.zip" } ] }