{ "info": { "author": "Roman Neuhauser", "author_email": "neuhauser@sigpipe.cz", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Environment :: Plugins", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Operating System :: OS Independent", "Operating System :: POSIX", "Programming Language :: Python", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.4", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: Software Development :: Testing" ], "description": ".. vim: ft=rst sts=2 sw=2 tw=70\n.. default-role:: literal\n\n.. This file is marked up using reStructuredText.\n Lines beginning with \"..\" are reST directives.\n \"foo_\" or \"`foo bar`_\" is a link, defined at \".. _foo\" or\n \".. _foo bar\".\n \"::\" introduces a literal block (usually some form of code).\n \"`foo`\" is some kind of identifier.\n Suspicious backslashes in the text (\"`std::string`\\s\") are required\n for reST to recognize the preceding character as syntax.\n\n======================================================================\n py-impala\n======================================================================\n----------------------------------------------------------------------\n Import packages and modules from arbitrary directories and files\n----------------------------------------------------------------------\n\n:Author: Roman Neuhauser\n:Contact: neuhauser@sigpipe.cz\n:Copyright: This document is in the public domain.\n\n\nOverview\n========\n\nImpala is a PEP302_ protocol (`sys.meta_path` hook for the `import`\nstatement) implementation allowing the user to import packages and\nmodules from arbitrarily named directories and files.\n\n.. _PEP302: http://www.python.org/dev/peps/pep-0302/\n\n\nMotivation\n==========\n\n* Comfort and freedom in development\n* Installed interface available without installation\n\nLet's say I'm developing a Python package called `pyoneer`. I want to\nlay the source code out like this: ::\n\n README.txt\n src/\n __init__.py\n some.py\n more.py\n tests/\n ...\n\nThe question then is, how do I `import pyoneer` in the test files\n(`/tests/...`) and have it load `/src/__init__.py`?\nThe default `import` mechanism requires packages to live in eponymous\ndirectories.\n\nWhat's the fuss about, you ask? I should simply rename the `src`\ndirectory to `pyoneer` or maybe `src/pyoneer`, no?\n\nIndeed, this would be tolerable, at least with top-level packages.\nHowever, if I'm working on something that will be available as\n`foo.bar.baz` after installation, I certainly don't want to wade\nthrough the desolate `src/foo/bar` to get to the source code.\n\nMaybe I could `import src` in the tests instead? Well, tests are\na form of documentation, and doubly so with `doctest`_. \"Proper\"\ndocumentation (README.txt, etc) can also contain snippets which\nshould be verifiable without the CUT being installed.\n\n*Impala* to the rescue!\n\n::\n\n from os.path import abspath, dirname\n import impala\n\n root = abspath(dirname(__file__))\n\n impala.register(dict(\n pyoneer = '%s/src' % root\n ))\n\n import pyoneer\n\n.. _doctest: http://docs.python.org/2/library/doctest.html\n\n\nDescription\n===========\n\n`impala.register(aliases)`\n++++++++++++++++++++++++++\n\n`aliases` is a `dict` mapping from fully-qualified module/package\nnames to paths to load from. To import a package `p` from path\n`/a/b/c`, `aliases` must include the key `p` with associated value\n`/a/b/c`, and `/a/b/c/__init__.py` must be a valid package entry\npoint. To import a module `m` from path `/f/g/h.py`, `aliases` must\ninclude the key `m` with associated value `/f/g/h.py`.\n\nExample: ::\n\n from os.path import abspath, dirname\n import impala\n\n r = dirname(abspath(__file__))\n\n impala.register({\n 'p': '%s/a/b/c' % r,\n 'p.q': '%s/f/g/h' % r,\n 'p.q.m': '%s/k.py' % r,\n })\n\n import p\n import p.q\n import p.q.m\n\n\nLicense\n=======\n\n*py-impala* is distributed under the `MIT license`_. See `LICENSE`\nfor details.\n\n.. _MIT license: http://opensource.org/licenses/MIT\n\n\nInstallation\n============\n\nUsing `pip` from PyPI_, the Python Package Index: ::\n\n pip install impala\n\nFrom a checkout_ or extracted tarball: ::\n\n python setup.py install\n\n.. _PyPI: http://pypi.python.org/pypi\n.. _checkout: https://github.com/roman-neuhauser/py-impala.git\n\n\nDevelopment\n===========\n\nSource code and issue tracker are at Github:\n\n https://github.com/roman-neuhauser/py-impala", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/roman-neuhauser/py-impala", "keywords": "PEP302 import", "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "impala", "package_url": "https://pypi.org/project/impala/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/impala/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/roman-neuhauser/py-impala" }, "release_url": "https://pypi.org/project/impala/0.2/", "requires_dist": null, "requires_python": null, "summary": "Import packages from \"wrongly\" named directories", "version": "0.2" }, "last_serial": 1271329, "releases": { "0.1.1": [ { "comment_text": "", "digests": { "md5": "2975fcfb27ba3fb8a7cd899cd7706b5f", "sha256": "1d76e7a6c114818109f0d9fc1cf996dbfc5a0de50b73accbed3cad74d3639456" }, "downloads": -1, "filename": "impala-0.1.1.tar.gz", "has_sig": false, "md5_digest": "2975fcfb27ba3fb8a7cd899cd7706b5f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8786, "upload_time": "2013-10-17T16:07:08", "url": "https://files.pythonhosted.org/packages/5c/fb/2cded2b842fb1a518fe0873269b93dfedbb0891d13e963a5d4249dac7ed1/impala-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "df91ac35e0f5b0dbf7b0af04d7258995", "sha256": "744033b19b091a1e3b853dbfc25425d728ff1ab6d6390d0cc38b476190f349ca" }, "downloads": -1, "filename": "impala-0.1.2.tar.gz", "has_sig": false, "md5_digest": "df91ac35e0f5b0dbf7b0af04d7258995", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8589, "upload_time": "2014-03-03T12:16:25", "url": "https://files.pythonhosted.org/packages/17/9d/9d50d68051cb9f373972ec2b3c553a7c1eb5252f8d6e6ef09a84f5d25c1e/impala-0.1.2.tar.gz" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "7dc7cf9158de5626a3ec06d7954939df", "sha256": "f7b1f7f34af30ea9912c4afd65dc0c76c0ab30aa1fe64d0c81f72f31f5720523" }, "downloads": -1, "filename": "impala-0.2.tar.gz", "has_sig": false, "md5_digest": "7dc7cf9158de5626a3ec06d7954939df", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8827, "upload_time": "2014-10-15T14:24:01", "url": "https://files.pythonhosted.org/packages/eb/0b/bd4f93aecc6c09f00085678f98d386f9a09ce5d8f8206110c1e549e35b0a/impala-0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "7dc7cf9158de5626a3ec06d7954939df", "sha256": "f7b1f7f34af30ea9912c4afd65dc0c76c0ab30aa1fe64d0c81f72f31f5720523" }, "downloads": -1, "filename": "impala-0.2.tar.gz", "has_sig": false, "md5_digest": "7dc7cf9158de5626a3ec06d7954939df", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8827, "upload_time": "2014-10-15T14:24:01", "url": "https://files.pythonhosted.org/packages/eb/0b/bd4f93aecc6c09f00085678f98d386f9a09ce5d8f8206110c1e549e35b0a/impala-0.2.tar.gz" } ] }