{ "info": { "author": "Liyu Gong", "author_email": "gongliyu@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy" ], "description": "*arlib*: Common interface for archive manipulation (Tar, Zip, etc)\n\n[![Build Status](https://travis-ci.com/gongliyu/arlib.svg?branch=master)](https://travis-ci.com/gongliyu/arlib)\n[![Documentation Status](https://readthedocs.org/projects/arlib/badge/?version=latest)](https://arlib.readthedocs.io/en/latest/?badge=latest)\n[![Coverage Status](https://coveralls.io/repos/github/gongliyu/arlib/badge.svg?branch=master)](https://coveralls.io/github/gongliyu/arlib?branch=master)\n\n\n\n**Table of Contents**\n\n- [Installation](#installation)\n - [Install from PyPI](#install-from-pypi)\n - [Install from Anaconda](#install-from-anaconda)\n- [Simple example](#simple-example)\n - [Open archive](#open-archive)\n - [List member names](#list-member-names)\n - [Open a member](#open-a-member)\n - [License](#license)\n- [Documentation](#documentation)\n\n\n\n\n## Rationale\nSometimes, we need to deal with different archive files. There are\nseveral packages/modules for archive file manipulation, e.g.,\n*zipfile* for \"\\*.zip\" files, *tarfile* for \"\\*.tar.gz\" or \"\\*.tar.bz2\"\nfiles, etc. If we want to support different archive type in our\nproject, probably we need to do the following:\n\n``` python\nif zipfile.is_zipfile(file):\n ar = zipfile.ZipFile(file)\n f = ar.open('member-name')\n # some processing\nelif zipfile.is_tarfile(file):\n ar = tarfile.open(file)\n f = ar.extractfile('member-name')\n # some processing\nelse:\n # other stuffs\n```\n\nThe problems of the above approach are:\n* We need repeat the above code everywhere we want to support\n different archive types.\n* Different archive manipulation modules (e.g. *zipfile* and\n *tarfile*) may have different API convention.\n\n*arlib* is designed to solve the above problems. It abstracts the\nlogic of archive manipulations and provides a single high level\ninterface for users.\n\n## Installation\n\n### Install from PyPI\n\n``` shell\npip install arlib\n```\n\n### Install from Anaconda\n\n``` shell\nconda install -c liyugong arlib\n```\n\n## Simple example\n\nThe abstract class *arlib.Archive* defines the common interface to\nhandle different archive types, such as tar file, zip file or an\ndirectory. Three concrete classes *arlib.TarArchive*,\n*arlib.ZipArchive* and *arlib.DirArchive* implement the interface\ncorrespondingly.\n\n### Open archive\n\nThe simplest way to open an archive is using *arlib.open* function\n``` python\nar = arlib.open('abc.tar.gz', 'r')\n```\n\nThis will determine the type of the archive automatically and return a\ncorresponding object of one of the three engine classes. If we don't\nwant the automatic engine determination mechanism, we can also\nspecify the class via argument *engine*, e.g.\n\n``` python\nar = arlib.open('abc.tar.gz', 'r', engine=ZipArchive)\n```\n\nor we can simply construct an object of the engine class\n\n``` python\nar = arlib.ZipArchive('abc.tar.gz', 'r')\n```\n\n### List member names\n\nThe property *member_names* will return a list of the names of members\ncontained in the archive, e.g.,\n\n``` python\nprint(ar.member_names)\n```\n\n### Check member\n\nUse the method *member_is_dir* and *member_is_file* to check whether a\nmember is a directory or a regular file\n\n``` python\nar = arlib.open('abc.tar', 'r')\nar.member_is_dir('member_name')\nar.member_is_file('member_name')\n```\n\n### Open a member\n\nUse the method *open_member* to open a member in the archive as a file\nobject\n\n``` python\nwith ar.open_member('a.txt', 'r') as f:\n # do sth by using f as an opened file object\n```\n\n### Extract members to a location\n\nUse the method *extract* to extract members to a specified location\n\n``` python\nar = arlib.open('abc.tar', 'r')\nar.extract() # extract all the members to the current working directory\nar.extract(path='d:/hello', members=['abc.txt', 'dir1/'])\n```\n\n## License\n\nThe *arlib* package is released under the [MIT License](LICENSE)\n\n## Documentation\n\nhttps://arlib.readthedocs.io\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/gongliyu/arlib", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "arlib", "package_url": "https://pypi.org/project/arlib/", "platform": "", "project_url": "https://pypi.org/project/arlib/", "project_urls": { "Homepage": "https://github.com/gongliyu/arlib" }, "release_url": "https://pypi.org/project/arlib/0.0.4/", "requires_dist": [ "decoutils" ], "requires_python": "", "summary": "Common interface for archive manipulation", "version": "0.0.4" }, "last_serial": 4858903, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "5836270d8a032d01539ec8344c51659d", "sha256": "ddf6d7e08ec5f5119e7ed437a886258ce7209b04b3f7476857d8e5e8dd6c780c" }, "downloads": -1, "filename": "arlib-0.0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "5836270d8a032d01539ec8344c51659d", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 5545, "upload_time": "2018-11-29T05:43:57", "url": "https://files.pythonhosted.org/packages/db/a1/53226d8d40fd96eeaebd4c179d51818b3c3ba92c484b95023021eb18d351/arlib-0.0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "6eb0b64f71807d67cf4310eaeae734d0", "sha256": "c2e53e89c5df83928aef893dea8eb443177e7c14893395ef8d7f2cc87506bab9" }, "downloads": -1, "filename": "arlib-0.0.1.tar.gz", "has_sig": false, "md5_digest": "6eb0b64f71807d67cf4310eaeae734d0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6424, "upload_time": "2018-11-29T05:43:59", "url": "https://files.pythonhosted.org/packages/05/68/e03f94074cd8bafe3e455664b892b0d8c68bdb40e2a65a1fcd34d2b39eca/arlib-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "5ea1448fe16eb3c58061056131858c60", "sha256": "13ff610488c3930eb39488ecca1afbd8b0d1045bb8acbc3a4309b273eef6a97c" }, "downloads": -1, "filename": "arlib-0.0.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "5ea1448fe16eb3c58061056131858c60", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 5820, "upload_time": "2018-12-06T03:19:32", "url": "https://files.pythonhosted.org/packages/a2/e2/9c9445017ebf541a8403a7f9aa06c848986373ea169549ee29cf0911ffdf/arlib-0.0.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "21339d2339a40caa8adb561d45695647", "sha256": "b056b6af71bdf64654932661f861b2a24a9af3ea20dc8fb89b33cfde53f03ae7" }, "downloads": -1, "filename": "arlib-0.0.2.tar.gz", "has_sig": false, "md5_digest": "21339d2339a40caa8adb561d45695647", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6674, "upload_time": "2018-12-06T03:19:34", "url": "https://files.pythonhosted.org/packages/17/8f/53bad3c8ebc264aa71d71451e3c7ef6c4f80fc7358ae597fbdbe87fb428b/arlib-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "4dc970a05a8bb190d8f02f016cfca965", "sha256": "0b6e118fe71878082e144d5e2fb045a6b59a851795cb26d7077e56553971a221" }, "downloads": -1, "filename": "arlib-0.0.3-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "4dc970a05a8bb190d8f02f016cfca965", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 5740, "upload_time": "2018-12-06T16:20:37", "url": "https://files.pythonhosted.org/packages/82/9c/460d0d13e61bb07243f6f023936738e0a6863c4d43c00ea8e69962f58ba9/arlib-0.0.3-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ac8d4c3f70ce0341816d668aae417987", "sha256": "a425afb4725b141b46269c6a9e77b2d8c13c5fbb7d92f03877091e170811c625" }, "downloads": -1, "filename": "arlib-0.0.3.tar.gz", "has_sig": false, "md5_digest": "ac8d4c3f70ce0341816d668aae417987", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6707, "upload_time": "2018-12-06T16:20:38", "url": "https://files.pythonhosted.org/packages/2e/8e/39c764d1af363b59cd0e22e0626df9a6bb54c2524af3b034deb3a9547069/arlib-0.0.3.tar.gz" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "3faa336b60983cb7ae8f61dd76417d44", "sha256": "7e537bee5a157f5a1f1b06ec10d0ff662ca40ddf673362ce2ef352b20dbd4fad" }, "downloads": -1, "filename": "arlib-0.0.4-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "3faa336b60983cb7ae8f61dd76417d44", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 7862, "upload_time": "2019-02-23T18:23:18", "url": "https://files.pythonhosted.org/packages/62/fe/d500a4b80583f87ce742defb2bea161a7485642da52331eb0c7d4e7c1b58/arlib-0.0.4-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "9b01c52bb16695aaff3d98a9ef8eca8e", "sha256": "1ebd9f77da1c6323f0340c5444643b753c2f0dda9c396afedb49d2538180cb9c" }, "downloads": -1, "filename": "arlib-0.0.4.tar.gz", "has_sig": false, "md5_digest": "9b01c52bb16695aaff3d98a9ef8eca8e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8183, "upload_time": "2019-02-23T18:23:20", "url": "https://files.pythonhosted.org/packages/78/69/541eb2f17dc1992bb391095a50775b7d2b4c9510905f6f9d2c0dd4996699/arlib-0.0.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "3faa336b60983cb7ae8f61dd76417d44", "sha256": "7e537bee5a157f5a1f1b06ec10d0ff662ca40ddf673362ce2ef352b20dbd4fad" }, "downloads": -1, "filename": "arlib-0.0.4-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "3faa336b60983cb7ae8f61dd76417d44", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 7862, "upload_time": "2019-02-23T18:23:18", "url": "https://files.pythonhosted.org/packages/62/fe/d500a4b80583f87ce742defb2bea161a7485642da52331eb0c7d4e7c1b58/arlib-0.0.4-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "9b01c52bb16695aaff3d98a9ef8eca8e", "sha256": "1ebd9f77da1c6323f0340c5444643b753c2f0dda9c396afedb49d2538180cb9c" }, "downloads": -1, "filename": "arlib-0.0.4.tar.gz", "has_sig": false, "md5_digest": "9b01c52bb16695aaff3d98a9ef8eca8e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8183, "upload_time": "2019-02-23T18:23:20", "url": "https://files.pythonhosted.org/packages/78/69/541eb2f17dc1992bb391095a50775b7d2b4c9510905f6f9d2c0dd4996699/arlib-0.0.4.tar.gz" } ] }