{ "info": { "author": "Takayuki SHIMIZUKAWA", "author_email": "shimizukawa at gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Programming Language :: Python", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "`zip_open` open file from nested zip file archive.\n\nIf you use static file like as 'data.zip' and open this from your\npython code, Your program will become like\n``open(os.path.join(os.path.dirname(__file__), 'data.zip'))``.\nBut if your packages are packed into packages.zip file (zipped-egg,\nor cases to gather in one file on Google App Engine matter), your\ncode doesn't work fine.\n\nIn this situation, the file path of data.zip becomes\n`/path/to/packages.zip/data.zip`, then your program can't open the\ndata.zip file.\n\n`zip_open` package solves this problem.\n\n\nFeatures\n--------\n\n* Open file from nested zip archive file path/name.\n* Open file from nested zip archive file-like-object.\n\n\nUsing sample1: open the file from zip file\n------------------------------------------\n\npackages1.zip is::\n\n packages1.zip\n + file1.txt\n\nOpen file1.txt::\n\n >>> from zip_open import zopen\n >>> fobj = zopen('packages1.zip/file1.txt')\n >>> data = fobj.read()\n >>> print(data)\n I am file1.txt, ok.\n\nYou can specifiy zopen subpath args::\n\n >>> fobj = zopen('packages1.zip', 'file1.txt')\n >>> print(fobj.read())\n I am file1.txt, ok.\n\nThese code samples equivalent to below code::\n\n >>> from zipfile import ZipFile\n >>> zipobj = ZipFile('packages1.zip')\n >>> data = zipobj.read('file1.txt')\n >>> print(data)\n I am file1.txt, ok.\n\n\nUsing sample2: open the file from nested zip file\n-------------------------------------------------\n\npackages2.zip is::\n\n packages2.zip\n + data2.zip\n + file2.txt\n\nOpen file2.txt::\n\n >>> from zip_open import zopen\n >>> fobj = zopen('packages2.zip/data2.zip/file2.txt')\n >>> print(fobj.read())\n I am file2.txt, ok.\n\n\nIf you want to open from file-like-object, you can call::\n\n >>> zip_fileobj = open('packages2.zip', 'rb')\n >>> fobj = zopen(zip_fileobj, 'data2.zip/file2.txt')\n >>> print(fobj.read())\n I am file2.txt, ok.\n\nthen you also call::\n\n >>> from StringIO import StringIO\n >>> zip_payload = open('packages2.zip', 'rb').read()\n >>> zip_fileobj = StringIO(zip_payload)\n >>> fobj = zopen(zip_fileobj, 'data2.zip/file2.txt')\n >>> print(fobj.read())\n I am file2.txt, ok.\n\n\nUsing sample3: open the file included in package oneself\n--------------------------------------------------------\n\npackages3.zip is::\n\n packages3.zip\n + foo.py\n + file1.txt\n + data3.zip\n + file3.txt\n\nfoo.py::\n\n import os\n from zip_open import zopen\n\n def loader(filename):\n fobj = zopen(os.path.join(os.path.dirname(__file__), filename))\n return fobj\n\n\nexecute loader() from interactive shell::\n\n >>> import sys\n >>> sys.path.insert(0, 'packages3.zip')\n >>> import foo\n >>> fobj = foo.loader('file1.txt')\n >>> print(fobj.read())\n I am file1.txt, ok.\n >>> fobj = foo.loader('data3.zip/file3.txt')\n >>> print(fobj.read())\n I am file3.txt, ok.\n\n\nRequirements and dependencies\n------------------------------\n\n* Requirement: Python 2.4 or later\n* Dependency: Nothing.\n\n\nToDo\n-----\n* Add tar.gz file support.\n* Add using sample document for egg archive.\n* Support Python3\n* Add module import feature.\n\n\nHistory\n-------\n\n0.2.1 (Unreleased)\n~~~~~~~~~~~~~~~~~~\n* fixed: test broken (open file as binary)\n* use distutils.core.setup if no setuptools.\n\n0.2.0 (2011-11-29)\n~~~~~~~~~~~~~~~~~~\n* Change license from PSL to Apache License 2.0\n* Add feature: open from file-like-object.\n\n\n0.1.0 (2010-7-19)\n~~~~~~~~~~~~~~~~~~\n* first release", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://bitbucket.org/shimizukawa/zip_open/", "keywords": "zip file open", "license": "Apache License 2.0", "maintainer": null, "maintainer_email": null, "name": "zip_open", "package_url": "https://pypi.org/project/zip_open/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/zip_open/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://bitbucket.org/shimizukawa/zip_open/" }, "release_url": "https://pypi.org/project/zip_open/0.2.0/", "requires_dist": null, "requires_python": null, "summary": "file open from nested zip file archive.", "version": "0.2.0" }, "last_serial": 659999, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "afe474ae888b11149082d2e022a97d6b", "sha256": "eff9bdbbeb8ba644118a338a50a2270159582e6b86f5791a892447608d0cb68e" }, "downloads": -1, "filename": "zip_open-0.1.0.zip", "has_sig": false, "md5_digest": "afe474ae888b11149082d2e022a97d6b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7713, "upload_time": "2010-07-19T13:47:25", "url": "https://files.pythonhosted.org/packages/e2/1f/3f0fc775f9a4927255a813383545e62e55b3219b9ceee635b55e6cccd21e/zip_open-0.1.0.zip" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "88461d10441e91cda0f38b84ed2a1eb2", "sha256": "26dcaa6e4df33a494e62a8140696a90ced8e5659a72c9986f98d3137b898f0cc" }, "downloads": -1, "filename": "zip_open-0.2.0.tar.gz", "has_sig": false, "md5_digest": "88461d10441e91cda0f38b84ed2a1eb2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4033, "upload_time": "2011-11-29T07:48:59", "url": "https://files.pythonhosted.org/packages/49/60/943cea8f6a3fce793b7552d0b4f4621745c7c4a3dad654421b87722c0649/zip_open-0.2.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "88461d10441e91cda0f38b84ed2a1eb2", "sha256": "26dcaa6e4df33a494e62a8140696a90ced8e5659a72c9986f98d3137b898f0cc" }, "downloads": -1, "filename": "zip_open-0.2.0.tar.gz", "has_sig": false, "md5_digest": "88461d10441e91cda0f38b84ed2a1eb2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4033, "upload_time": "2011-11-29T07:48:59", "url": "https://files.pythonhosted.org/packages/49/60/943cea8f6a3fce793b7552d0b4f4621745c7c4a3dad654421b87722c0649/zip_open-0.2.0.tar.gz" } ] }