{ "info": { "author": "Cristian Garcia", "author_email": "cgarcia.e88@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "# Python Path\n`python_path` is a simple utility that lets you cleanly add routes to your `PYTHON_PATH`. Its very useful to safely load scripts from other folders.\n\n## Installing\nYou can install `python_path` from pip\n```\npip install python_path\n```\n\n## Usage\nLets do an example, image you have the following project structure\n\n```\n- my_project/\n - main.py\n - some_folder/\n - other.py\n - another_folder/\n - another.py\n```\n\nSay we want to load `other.py` form `main.py`, since some_folder is not a submodule because it doesn't contain a `__init__.py` then we need to add `some_folder` to the `PYTHON_PATH`. To make this very easy we'll use `python_path` like this:\n\n```python\n# my_project/main.py\n\nfrom python_path import PythonPath\n\nwith PythonPath(\"some_folder\"):\n import other\n```\nand execute the file like this:\n```bash\ncd my_project\npython main.py\n```\nHere `some_folder` is added relative the `PWD` (`my_project`), if you are executing `main.py` from another directory and still want to reference `some_folder`, then you should directly state relative to what file or folder the operations are being done:\n```python\n# my_project/main.py\n\nfrom python_path import PythonPath\n\nwith PythonPath(\"some_folder\", relative_to = __file__):\n import other\n```\nThe previous is equivalent to:\n```python\n# my_project/main.py\n\nfrom python_path import PythonPath\nimport os\n\npath = os.path.dirname(__file__)\npath = os.path.join(path, \"some_folder\")\n\nwith PythonPath(path):\n import other\n```\nNow we can also execute the script from any path and it sould still work e.g:\n```bash\npython my_project/main.py\n```\n\nFinally we can also navigate the folder structure by passing multiple parameters, so if we want to import `main.py` from `another.py` which is inside `another_folder` we could do it like this\n\n```python\n# my_project/some_folder/another_folder/another.py\n\nfrom python_path import PythonPath\n\nwith PythonPath(\"..\", \"..\", relative_to = __file__):\n import main\n```\nThis is equivalent to\n```python\n# my_project/some_folder/another_folder/another.py\n\nfrom python_path import PythonPath\nimport os\n\npath = os.path.join(\"..\", \"..\")\n\nwith PythonPath(path, relative_to = __file__):\n import main\n```\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/cgarciae/python_path", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "python-path", "package_url": "https://pypi.org/project/python-path/", "platform": "", "project_url": "https://pypi.org/project/python-path/", "project_urls": { "Homepage": "https://github.com/cgarciae/python_path" }, "release_url": "https://pypi.org/project/python-path/0.1.3/", "requires_dist": null, "requires_python": "", "summary": "A clean way to import scripts on other folders via a context manager.", "version": "0.1.3" }, "last_serial": 3750060, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "01d6b8d67a75240409a67aac11b9548b", "sha256": "659b80e38572cee104c83fcd473eb7c7466f3c86b016a1ebb08334fad282def2" }, "downloads": -1, "filename": "python_path-0.0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "01d6b8d67a75240409a67aac11b9548b", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 2320, "upload_time": "2017-12-21T19:48:26", "url": "https://files.pythonhosted.org/packages/91/99/9083ff3e38909b3dd9c6a1765c03b5a0c4cb8e9674126b2519d9a3100c1c/python_path-0.0.1-py2.py3-none-any.whl" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "9685d0034ce8c9fd70e45bff4cde38d7", "sha256": "aad18523705a37c325f6c046c8691ef8a1e23d88ed5ae618bcdb38743cb7b4c0" }, "downloads": -1, "filename": "python_path-0.0.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "9685d0034ce8c9fd70e45bff4cde38d7", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 2337, "upload_time": "2018-01-18T23:12:54", "url": "https://files.pythonhosted.org/packages/ad/b3/10ba226a530aa854281e5da67db5922e9698f3fda0961e042ad172e8f31c/python_path-0.0.2-py2.py3-none-any.whl" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "7b400d691c6e5d7e782f138a98f193dd", "sha256": "dfb5f91fe8ee014f9174b3dab2dbf50730b96a7c64dda4af9dc4f819093da7ed" }, "downloads": -1, "filename": "python_path-0.0.3-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "7b400d691c6e5d7e782f138a98f193dd", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 2355, "upload_time": "2018-01-18T23:17:47", "url": "https://files.pythonhosted.org/packages/1a/fd/79622f023feae59fbe42619f13ebb13827ca3c1c41a3657a1c13589bf884/python_path-0.0.3-py2.py3-none-any.whl" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "c533ef8f6d54e1fb3c135034c78f327d", "sha256": "57c89cc3869a507546dd30b7f5ee0e41df0357932b02543676c8c918d2a4a34d" }, "downloads": -1, "filename": "python_path-0.0.4-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "c533ef8f6d54e1fb3c135034c78f327d", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 2349, "upload_time": "2018-01-31T03:05:12", "url": "https://files.pythonhosted.org/packages/e1/27/14d2aa2522add289def9754863889a89a22601dd96d2cd7483d7dc2cc847/python_path-0.0.4-py2.py3-none-any.whl" } ], "0.1.0": [ { "comment_text": "", "digests": { "md5": "b5e9128a3057a45c6c27447eb119780d", "sha256": "8981936f47e5b103aa1f8d30ff91bec659f6895d7fe861bc8e630e26168c74b9" }, "downloads": -1, "filename": "python_path-0.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "b5e9128a3057a45c6c27447eb119780d", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 3622, "upload_time": "2018-03-21T18:31:24", "url": "https://files.pythonhosted.org/packages/c8/03/a48bbbd8307c8914d9691f633bffea6380d54043d05df33bc46532c8e4df/python_path-0.1.0-py2.py3-none-any.whl" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "8d35c25f1984892c31bf04a07d760a22", "sha256": "867f006486fa98789506262862635043f562224800dc7f6f2c06cce9dccf5d0f" }, "downloads": -1, "filename": "python_path-0.1.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "8d35c25f1984892c31bf04a07d760a22", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 3893, "upload_time": "2018-03-21T23:35:34", "url": "https://files.pythonhosted.org/packages/ff/dd/63cce3bb0655199bd902d48c288c1c0d3a1134c089325beed178eb0fde94/python_path-0.1.1-py2.py3-none-any.whl" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "54ed180d61b5b20b00c51f8e97aa9fd8", "sha256": "6a931878ac6e40a924221ba1f371fb5b60fd58f12c5b7fab48b27c34a0f034a2" }, "downloads": -1, "filename": "python_path-0.1.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "54ed180d61b5b20b00c51f8e97aa9fd8", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 3891, "upload_time": "2018-03-22T18:00:21", "url": "https://files.pythonhosted.org/packages/dc/53/fd22f47d0b1873d9d7ca8286ed28810ecc4dbebdea4cc713cd878147b875/python_path-0.1.2-py2.py3-none-any.whl" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "11036351878fd2f33af072b5c9c69277", "sha256": "b62d9aac1da4daee3f036ed088532cf8b68666d3aa103567dc22b6539316c8b3" }, "downloads": -1, "filename": "python_path-0.1.3.tar.gz", "has_sig": false, "md5_digest": "11036351878fd2f33af072b5c9c69277", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2253, "upload_time": "2018-04-09T22:23:41", "url": "https://files.pythonhosted.org/packages/14/95/88242c8d41bd18e825f8b76f38746d52b25746509e73d3909d9e19947dc1/python_path-0.1.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "11036351878fd2f33af072b5c9c69277", "sha256": "b62d9aac1da4daee3f036ed088532cf8b68666d3aa103567dc22b6539316c8b3" }, "downloads": -1, "filename": "python_path-0.1.3.tar.gz", "has_sig": false, "md5_digest": "11036351878fd2f33af072b5c9c69277", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2253, "upload_time": "2018-04-09T22:23:41", "url": "https://files.pythonhosted.org/packages/14/95/88242c8d41bd18e825f8b76f38746d52b25746509e73d3909d9e19947dc1/python_path-0.1.3.tar.gz" } ] }