{ "info": { "author": "metagriffin", "author_email": "mg.pypi@uberdev.org", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python" ], "description": "================================\nGeneralized Package Asset Loader\n================================\n\nLoads resources and symbols from a python package, whether installed\nas a directory, an egg, or in source form. Also provides some other\npackage-related helper methods, including ``asset.version()``,\n``asset.caller()``, and ``asset.chunks()``.\n\nTL;DR\n=====\n\nInstall:\n\n.. code:: bash\n\n $ pip install asset\n\nLoad symbols (e.g. functions, classes, or variables) from a package by\nname:\n\n.. code:: python\n\n import asset\n\n # load the 'mypackage.foo.myfunc' function and call it with some parameter\n retval = asset.symbol('mypackage.foo.myfunc')(param='value')\n\nLoad data files from a package:\n\n.. code:: python\n\n # load the file 'mypackage/templates/data.txt' into string\n data = asset.load('mypackage:templates/data.txt').read()\n\n # or as a file-like stream\n stream = asset.load('mypackage:templates/data.txt').stream()\n data = stream.read()\n\nMultiple files can be operated on at once by using `globre\n`_ style wildcards:\n\n.. code:: python\n\n # concatenate all 'css' files into one string:\n css = asset.load('mypackage:static/style/**.css').read()\n\n # load all '.txt' files, XML-escaping the data and wrapping\n # each file in an ... element.\n import xml.etree.ElementTree as ET\n data = ET.Element('nodes')\n for item in asset.load('asset:**.txt'):\n cur = ET.SubElement(data, 'node', name=item.name)\n cur.text = item.read()\n data = ET.tostring(data)\n\nQuery the installed version of a package:\n\n.. code:: python\n\n asset.version('asset')\n # ==> '0.0.5'\n\n asset.version('python')\n # ==> '2.7'\n\n asset.version('no-such-package')\n # ==> None\n\nFind out what package is calling the current function:\n\n.. code:: python\n\n # assuming the call stack is:\n # in package \"zig\" a function \"x\", which calls\n # in package \"bar\" a function \"y\", which calls\n # in package \"foo\" a function \"callfoo\" defined as:\n\n def callfoo():\n\n asset.caller()\n # ==> 'bar'\n\n asset.caller(ignore='bar')\n # ==> 'zig'\n\n asset.caller(ignore=['bar', 'zig'])\n # ==> None\n\nCall all the plugins for a given group:\n\n.. code:: python\n\n for plugin in asset.plugins('mypackage.plugins'):\n plugin.handle()\n\nFilter an object through all the plugins for a given group (if there\nare no plugins, this will simply return `thing`):\n\n.. code:: python\n\n result = asset.plugins('mypackage.plugins').filter(thing)\n\nLoad all registered plugins, select the ones named `foo` and invoke\nthem (this will fail if there is no `foo` plugin):\n\n.. code:: python\n\n result = asset.plugins('mypackage.plugins').select('foo').handle(thing)\n\nChunk a file (or any file-like object) into 1 KiB chunks:\n\n.. code:: python\n\n with open('/var/binary/data', 'rb') as fp:\n for chunk in asset.chunks(fp, 1024):\n # ... do something with `chunk` ...\n\nChunk an Asset stream (here using the `.chunks` alias method):\n\n.. code:: python\n\n for chunk in asset.load('mypackage:data/**.bin').chunks():\n # ... using the default chunk size (usually 8 KiB) ...\n\n\nTesting\n=======\n\nIn order to run the unit tests correctly, the `pxml` package needs to\nbe installed as a zipped package (i.e. an \"egg\") and the `globre`\npackage needs to be installed unzipped. To accomplish that, do:\n\n.. code:: bash\n\n $ easy_install --zip-ok pxml\n $ easy_install --always-unzip globre\n\nThe reason is that the unit tests confirm that `asset` can load assets\nfrom both zipped and unzipped packages, and can also identify in which\nmode it is operating.\n\n\nDetails\n=======\n\nTODO: add detailed docs...\n\n* ``Asset.filename``:\n\n If the asset represents a file on the filesystem, is the absolute\n path to the specified file. Otherwise is ``None``.\n\n* ``AssetGroupStream.readline()``:\n\n Returns the next line from the aggregate asset group stream, as if\n the assets had been concatenate into a single asset.\n\n **IMPORTANT**: if an asset ends with content that is not terminated\n by an EOL token, it is returned as-is, i.e. it does NOT append the\n first line from the next asset.\n\nNote: because ``asset.load()`` does lazy-loading, it only throws a\n`NoSuchAsset` exception when you actually attempt to use the\nAssetGroup! If you need an immediate error, use the `peek()` method.\nNote that it returns itself, so you can do something like:\n\n.. code:: python\n\n import asset\n\n def my_function_that_returns_an_iterable():\n\n return asset.load(my_spec).peek()\n\n # this returns exactly the same thing as the following:\n #\n # return asset.load(my_spec)\n #\n # but throws an exception early if there are no matching assets.\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/metagriffin/asset", "keywords": "python package pkg_resources asset resolve lookup loader", "license": "GPLv3+", "maintainer": "", "maintainer_email": "", "name": "asset", "package_url": "https://pypi.org/project/asset/", "platform": "any", "project_url": "https://pypi.org/project/asset/", "project_urls": { "Homepage": "http://github.com/metagriffin/asset" }, "release_url": "https://pypi.org/project/asset/0.6.12/", "requires_dist": null, "requires_python": "", "summary": "A package resource and symbol loading helper library.", "version": "0.6.12" }, "last_serial": 2804858, "releases": { "0.0.1": [], "0.0.4": [ { "comment_text": "", "digests": { "md5": "f815d7fddc754f90beb53c879696223e", "sha256": "40b748f6145ce7cb65bfd5443b1283ff5ea3114ad4527019052aa2da3725df58" }, "downloads": -1, "filename": "asset-0.0.4.tar.gz", "has_sig": false, "md5_digest": "f815d7fddc754f90beb53c879696223e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5838, "upload_time": "2013-10-31T15:08:20", "url": "https://files.pythonhosted.org/packages/3e/f6/154c4f86eca7175a1b7efb0b1747d1e9f0045fafd06182df3743054de93d/asset-0.0.4.tar.gz" } ], "0.0.5": [ { "comment_text": "", "digests": { "md5": "2645fa0038515c39b021846efa1418f6", "sha256": "e42be7ccee2ff2f26b3d0ca3b17a4df6556378333822e4cc767a1010874ba5cb" }, "downloads": -1, "filename": "asset-0.0.5.tar.gz", "has_sig": false, "md5_digest": "2645fa0038515c39b021846efa1418f6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18945, "upload_time": "2013-11-17T22:19:36", "url": "https://files.pythonhosted.org/packages/c6/e6/132eccbef3e054cff7770fdfd570446f5a6a844f6fca9b1f2da209c3b6e0/asset-0.0.5.tar.gz" } ], "0.0.5b": [ { "comment_text": "", "digests": { "md5": "4a48eda5c266c0fc262aa39bc3efd59f", "sha256": "7f4b46768d7f086868b9ae4a8b1ba15eaba19439352833d4381bf024a0ea5e94" }, "downloads": -1, "filename": "asset-0.0.5b.tar.gz", "has_sig": false, "md5_digest": "4a48eda5c266c0fc262aa39bc3efd59f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18439, "upload_time": "2013-11-17T21:43:41", "url": "https://files.pythonhosted.org/packages/46/10/19f930280762d1bb84b8b9ea2c8d27b44e2455f5eb026676cf362c5564f8/asset-0.0.5b.tar.gz" } ], "0.0.5b3": [ { "comment_text": "", "digests": { "md5": "683df1b6cec667b930c76d1e4e203f84", "sha256": "7c4dcf0a42a32e2e5f7bdaf70c1c717f16e06200aff71099a49e085ec13a613f" }, "downloads": -1, "filename": "asset-0.0.5b3.tar.gz", "has_sig": false, "md5_digest": "683df1b6cec667b930c76d1e4e203f84", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18967, "upload_time": "2013-11-17T22:17:48", "url": "https://files.pythonhosted.org/packages/43/ca/5e7579e704269f4599898c8d94dcaa4ed488a532adeef74f1ed176978c37/asset-0.0.5b3.tar.gz" } ], "0.6": [ { "comment_text": "", "digests": { "md5": "def2ba200064d47fc2a2bcd01b4df95b", "sha256": "f4fa322c11dfd2dff613f221a7a70809943c7b830d80f75944a99efcf0194a1c" }, "downloads": -1, "filename": "asset-0.6.tar.gz", "has_sig": false, "md5_digest": "def2ba200064d47fc2a2bcd01b4df95b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19794, "upload_time": "2014-01-30T20:45:33", "url": "https://files.pythonhosted.org/packages/b1/e5/240ec620b81835a45a3de121e13c8379a89e5f36c6a30814d12adc63d98f/asset-0.6.tar.gz" } ], "0.6.1": [ { "comment_text": "", "digests": { "md5": "7024d40b47a3eeab2debc05cefc82b25", "sha256": "071fcbf93b03d791b4e301c1459dc6bd1779407f9c0326fa136f03449c4bb4c4" }, "downloads": -1, "filename": "asset-0.6.1.tar.gz", "has_sig": false, "md5_digest": "7024d40b47a3eeab2debc05cefc82b25", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 20613, "upload_time": "2015-04-04T20:24:49", "url": "https://files.pythonhosted.org/packages/98/e1/dce64dffe39b7ec076409b31a9a8dd8a497adb10bdcacab4b1a7f3c8d859/asset-0.6.1.tar.gz" } ], "0.6.10": [ { "comment_text": "", "digests": { "md5": "a477532b167b15c492b87a903ccdffc8", "sha256": "0fe8b24f095c7bc6700e94df99eef91ab7135ce665056b45f8e17316d2019142" }, "downloads": -1, "filename": "asset-0.6.10.tar.gz", "has_sig": false, "md5_digest": "a477532b167b15c492b87a903ccdffc8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 27844, "upload_time": "2016-01-16T15:42:16", "url": "https://files.pythonhosted.org/packages/54/2e/0c0ca0614f7cc9b4a1b50c3ba1dbba971781c58e227b35aec8e42a5b2252/asset-0.6.10.tar.gz" } ], "0.6.11": [ { "comment_text": "", "digests": { "md5": "39fed905ffe41b6215034bfa4deca52e", "sha256": "985bf10e0123911ce5ca549598f84b483a908588c7e57d89fa70627d252d391e" }, "downloads": -1, "filename": "asset-0.6.11.tar.gz", "has_sig": false, "md5_digest": "39fed905ffe41b6215034bfa4deca52e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 28071, "upload_time": "2016-08-18T20:05:55", "url": "https://files.pythonhosted.org/packages/b5/76/73d05b7034f62d9f07f453bafb780bf2160418ae9fe44da6d4f7ca2ab26c/asset-0.6.11.tar.gz" } ], "0.6.12": [ { "comment_text": "", "digests": { "md5": "f24d15a772449b24e3e15789edd0926a", "sha256": "addb25dbdbfa820c667e246f9c09122401df21cd9e94db919c72f8f04fc972eb" }, "downloads": -1, "filename": "asset-0.6.12.tar.gz", "has_sig": false, "md5_digest": "f24d15a772449b24e3e15789edd0926a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 28300, "upload_time": "2017-04-14T21:45:28", "url": "https://files.pythonhosted.org/packages/47/f6/3fd40111e48cf242211c65976b9c3a1729450803adad67de5dcbb8419bad/asset-0.6.12.tar.gz" } ], "0.6.2": [ { "comment_text": "", "digests": { "md5": "8ed8ee182008ff046f126ca72ad9198f", "sha256": "5d4e5735a28408e84a61cbf22b41736fa2dfbe8807df2a4b50d2fa8ef3e0f0f9" }, "downloads": -1, "filename": "asset-0.6.2.tar.gz", "has_sig": false, "md5_digest": "8ed8ee182008ff046f126ca72ad9198f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 20961, "upload_time": "2015-08-17T23:39:27", "url": "https://files.pythonhosted.org/packages/a0/b5/13965fca17f195c79d457319af96283b07275905d53a4e2a886db9e2f04c/asset-0.6.2.tar.gz" } ], "0.6.3": [ { "comment_text": "", "digests": { "md5": "9aa0c0fbfcb276fddb9317c050ec0cac", "sha256": "1ac30617c42afb30c7bdaf87ff933e956067287b4b2d6cc04e34bd658b5bde46" }, "downloads": -1, "filename": "asset-0.6.3.tar.gz", "has_sig": false, "md5_digest": "9aa0c0fbfcb276fddb9317c050ec0cac", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 21110, "upload_time": "2015-09-05T14:22:08", "url": "https://files.pythonhosted.org/packages/d7/16/9965b399d0da96e05eace54a0b293c382efe2c326f62c112c3db8ac7d13d/asset-0.6.3.tar.gz" } ], "0.6.4": [ { "comment_text": "", "digests": { "md5": "2aad365fc9aa59293cec3ba6447eb595", "sha256": "54bdeb133100335f169cd6a586ccfa7619673cb6015e32d9a882e4d778d1225e" }, "downloads": -1, "filename": "asset-0.6.4.tar.gz", "has_sig": false, "md5_digest": "2aad365fc9aa59293cec3ba6447eb595", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 23956, "upload_time": "2015-11-13T02:18:10", "url": "https://files.pythonhosted.org/packages/84/32/d6407a246e3aea2b3bcf075b13fb0dc965cf9df3f25a590a4003dc5b44fd/asset-0.6.4.tar.gz" } ], "0.6.5": [ { "comment_text": "", "digests": { "md5": "d6727d313ea3b4749d65dbf07096da91", "sha256": "6a6301a9025971ede6d9d08ac6db2b662b36e4b10794a6dfbdbfab36025bfb99" }, "downloads": -1, "filename": "asset-0.6.5.tar.gz", "has_sig": false, "md5_digest": "d6727d313ea3b4749d65dbf07096da91", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 25264, "upload_time": "2015-11-17T17:10:53", "url": "https://files.pythonhosted.org/packages/69/e7/38e53433461a7fd303bb13d8f8094a9dd06e4038d1f157da0b7bdbb53ffd/asset-0.6.5.tar.gz" } ], "0.6.6": [ { "comment_text": "", "digests": { "md5": "205bfb51acd64960e7c457199e07e1c6", "sha256": "3b96632b59a1dbec483b3a14f40d360d825684bb48695a9f202657ce0a65af35" }, "downloads": -1, "filename": "asset-0.6.6.tar.gz", "has_sig": false, "md5_digest": "205bfb51acd64960e7c457199e07e1c6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 25372, "upload_time": "2015-11-17T19:29:15", "url": "https://files.pythonhosted.org/packages/c4/ca/1b0644f13fd59ed86a54d37b17e519d5fd4541b3d1a9f3023ce72e6234f6/asset-0.6.6.tar.gz" } ], "0.6.7": [ { "comment_text": "", "digests": { "md5": "b3dd8f57065915716ff013e5f32d0286", "sha256": "f409131c40426a1c1662a319ab86480e704992991e18b6417c27ceb56f1756d4" }, "downloads": -1, "filename": "asset-0.6.7.tar.gz", "has_sig": false, "md5_digest": "b3dd8f57065915716ff013e5f32d0286", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 25819, "upload_time": "2015-11-19T19:57:28", "url": "https://files.pythonhosted.org/packages/67/4d/8081b716de5b4db8bed432b3e38efe9777f82e95000c729602f8ce2ae641/asset-0.6.7.tar.gz" } ], "0.6.8": [ { "comment_text": "", "digests": { "md5": "fcbd42f1b73e346283b3a349ccfce4e0", "sha256": "fb2aa2ca90cc8c999114876063a1a2d2d60a2c26c542fe6191a09cb37bcd076e" }, "downloads": -1, "filename": "asset-0.6.8.tar.gz", "has_sig": false, "md5_digest": "fcbd42f1b73e346283b3a349ccfce4e0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 26619, "upload_time": "2016-01-02T04:50:47", "url": "https://files.pythonhosted.org/packages/53/7d/d58cb18fa42a50b61a00c149757ff38edb4cf51110981aedaa836fefe323/asset-0.6.8.tar.gz" } ], "0.6.9": [ { "comment_text": "", "digests": { "md5": "e8a0729871ed192201a48e24a4b96098", "sha256": "5a120593b8545dd8481454d340376144565081286ec018460909affce0a8ec41" }, "downloads": -1, "filename": "asset-0.6.9.tar.gz", "has_sig": false, "md5_digest": "e8a0729871ed192201a48e24a4b96098", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 27666, "upload_time": "2016-01-04T20:44:56", "url": "https://files.pythonhosted.org/packages/c0/58/c5482536c2e3edd9d8ea32fddd3ae557c385f4e42e38ae7072b776818b53/asset-0.6.9.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "f24d15a772449b24e3e15789edd0926a", "sha256": "addb25dbdbfa820c667e246f9c09122401df21cd9e94db919c72f8f04fc972eb" }, "downloads": -1, "filename": "asset-0.6.12.tar.gz", "has_sig": false, "md5_digest": "f24d15a772449b24e3e15789edd0926a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 28300, "upload_time": "2017-04-14T21:45:28", "url": "https://files.pythonhosted.org/packages/47/f6/3fd40111e48cf242211c65976b9c3a1729450803adad67de5dcbb8419bad/asset-0.6.12.tar.gz" } ] }