{ "info": { "author": "Ryan Kelly", "author_email": "rfk@cloudmatrix.com.au", "bugtrack_url": null, "classifiers": [], "description": "zipimportx: faster zipfile imports for frozen python apps\n==========================================================\n\n\nThis package aims to speed up imports from zipfiles for frozen python apps (and\nother scenarios where the zipfile is assumed not to change) by taking several\nshortcuts that aren't available to the standard zipimport module.\n\nIt exports a single useful name, \"zipimporter\", which is a drop-in replacement\nfor the standard zipimporter class. To replace the builtin zipimport mechanism\nwith zipimportx, do the following::\n\n import zipimportx\n zipimportx.zipimporter.install()\n\nWith no additional work you may already find a small speedup when importing \nfrom a zipfile. Since zipimportx assumes that the zipfile will not change or\ngo missing, it does fewer stat() calls and integrity checks than the standard\nzipimport implementation.\n\n\nTo further speed up the loading of a zipfile, you can pre-compute the zipimport\n\"directory information\" dictionary and store it in a separate index file. This\nwill reduce the time spent parsing information out of the zipfile. Create an\nindex file like this::\n\n from zipimportx import zipimporter\n zipimporter(\"mylib.zip\").write_index()\n\nThis will create the file \"mylib.zip.idx\" containing the pre-parsed zipfile\ndirectory information. Specifically, it will contain a marshalled dictionary\nobject with the same structure as those in zipimport._zip_directory_cache.\n\nIn my tests, use of these indexes speeds up the initial loading of a zipfile by \nabout a factor of 3 on Linux, and a factor of 5 on Windows.\n\n\nTo further speed up the loading of a collection of modules, you can \"preload\"\nthe actual module data by including it directly in the index. This allows the\ndata for several modules to be loaded in a single sequential read rather than\nrequiring a separate read for each module. Preload module data like this::\n\n from zipimportx import zipimporter\n zipimporter(\"mylib.zip\").write_index(preload=[\"mymod*\",\"mypkg*\"])\n\nEach entry in the \"preload\" list is a filename pattern. Files from the zipfile\nthat match any of these patterns will be preloaded when the zipfile is first\naccessed for import. You may want to remove them from the actual zipfile in\norder to save space.\n\n\nFinally, it's possible to convert a zipfile into inline python code and include\nthat code directly in your frozen application. This can simulate the effect\nof having that zipfile on sys.path, while avoiding any fie IO during the import\nprocess. To get the necessary sourcecode, do the following::\n\n from zipimportx import zipimporter\n code = zipimporter(\"mylib.zip\").get_inline_code()\n\n\nFinally, it's worth re-iterating the big assumption made by this module: the\nzipfile must never change or go missing. If the data in the index does not\nreflect the actual contents of the zipfile, imports will break in unspecified\nand probably disasterous ways.\n\nNote also that this package uses nothing but builtin modules. To bootstrap\nzipfile imports for a frozen application, you can inline this module's code\ndirectly into your application's startup script. Simply do something like\nthis in your build process::\n\n import zipimportx\n import inspect\n\n SCRIPT = '''\n %s\n zipimporter.install()\n import myapp\n myapp.main()\n ''' % (inspect.getsource(zipimportx),)\n\n freeze_this_script_somehow(SCRIPT)\n zipimportx.zipimporter(\"path/to/frozen/library.zip\").write_index()", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/cloudmatrix/zipimportx/", "keywords": "zipfile zip import zipimport", "license": "BSD", "maintainer": null, "maintainer_email": null, "name": "zipimportx", "package_url": "https://pypi.org/project/zipimportx/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/zipimportx/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://github.com/cloudmatrix/zipimportx/" }, "release_url": "https://pypi.org/project/zipimportx/0.3.2/", "requires_dist": null, "requires_python": null, "summary": "faster zipfile imports for frozen python apps", "version": "0.3.2" }, "last_serial": 802299, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "27d148550011a6a4b8204855fa54290b", "sha256": "02c2723af978ca5915ddeab3d55e34ca509375eb9cd36ec762b8798ec49e618d" }, "downloads": -1, "filename": "zipimportx-0.1.0.tar.gz", "has_sig": false, "md5_digest": "27d148550011a6a4b8204855fa54290b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5210, "upload_time": "2010-07-21T04:37:39", "url": "https://files.pythonhosted.org/packages/39/a1/b6497f01c29d381b4658d518e6d0ff58f5b5bb787f8f5bc9c3c051341ed0/zipimportx-0.1.0.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "e0429b7a0a359199be22fa322000f040", "sha256": "c5d2e4c40f5cb11af53a40491371d8b525fb58c630cc7bfb1ac1e1ff06c43158" }, "downloads": -1, "filename": "zipimportx-0.2.0.tar.gz", "has_sig": false, "md5_digest": "e0429b7a0a359199be22fa322000f040", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5527, "upload_time": "2010-08-10T10:33:26", "url": "https://files.pythonhosted.org/packages/81/40/c366da0bd28bc589af6c2008f7c981a1d4865ba2d1cbe0668c489570ca47/zipimportx-0.2.0.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "6f23abb2a4bbdcf8f6a820078ff98b0e", "sha256": "71f68906f092457b185d222344acf12593c2149f1ed031779564c05d9266492c" }, "downloads": -1, "filename": "zipimportx-0.3.0.tar.gz", "has_sig": false, "md5_digest": "6f23abb2a4bbdcf8f6a820078ff98b0e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10159, "upload_time": "2010-09-04T08:19:51", "url": "https://files.pythonhosted.org/packages/78/10/59171647d1d25066138cb2f7a0f3def43c1f863ff3e8987eb3795ddc549c/zipimportx-0.3.0.tar.gz" } ], "0.3.1": [ { "comment_text": "", "digests": { "md5": "275945c7c7c59a7de818ef15bc38cee5", "sha256": "59dc69e9b09ae62680ffa146d739a30b918e3568d9671ad7d65a8505a231c5c9" }, "downloads": -1, "filename": "zipimportx-0.3.1.tar.gz", "has_sig": false, "md5_digest": "275945c7c7c59a7de818ef15bc38cee5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10362, "upload_time": "2010-12-01T23:48:05", "url": "https://files.pythonhosted.org/packages/57/9c/26a107215a7372cb190fc433999ca24447a4dbdfca766c876b71a44e882e/zipimportx-0.3.1.tar.gz" } ], "0.3.2": [ { "comment_text": "", "digests": { "md5": "84d554f0dc101c4ad9aece89be2e414f", "sha256": "bb54b51f4ee90ebf83c8f35314f1b05e5c486d2691d4dc1322d4e89594eb37e9" }, "downloads": -1, "filename": "zipimportx-0.3.2.tar.gz", "has_sig": false, "md5_digest": "84d554f0dc101c4ad9aece89be2e414f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10372, "upload_time": "2011-01-01T23:12:33", "url": "https://files.pythonhosted.org/packages/62/63/4bac500589eb5d0febcbb708007665230b2261bbdf80a738acfbaf81ba17/zipimportx-0.3.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "84d554f0dc101c4ad9aece89be2e414f", "sha256": "bb54b51f4ee90ebf83c8f35314f1b05e5c486d2691d4dc1322d4e89594eb37e9" }, "downloads": -1, "filename": "zipimportx-0.3.2.tar.gz", "has_sig": false, "md5_digest": "84d554f0dc101c4ad9aece89be2e414f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10372, "upload_time": "2011-01-01T23:12:33", "url": "https://files.pythonhosted.org/packages/62/63/4bac500589eb5d0febcbb708007665230b2261bbdf80a738acfbaf81ba17/zipimportx-0.3.2.tar.gz" } ] }