Name | recursive-import JSON |
Version |
1.0.0
JSON |
| download |
home_page | None |
Summary | Trivial library that will import the whole module tree |
upload_time | 2024-07-12 16:57:53 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.5 |
license | MIT License Copyright (c) 2024 Filip Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
keywords |
import
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# recursive_import
[![CI](https://github.com/FilipMalczak/recursive_import/actions/workflows/ci.yml/badge.svg)](https://github.com/FilipMalczak/recursive-import/actions/workflows/ci.yml)
[![PyPI version](https://badge.fury.io/py/recursive-import.svg)](https://badge.fury.io/py/recursive-import)
Trivial library that will import the whole module tree.
Main use case for this library is importing everything in given package. Simplest exaple are
decorators that register stuff for CI, a bit like annotation scanning in Java.
> Requires python 3.5+, because of `typing`. Besides that, there are no dependencies.
> System-independent. Tested on CPython 3.9-3.12 (to simplify CI), but its really trivial.
The whole API is best documented by docstrings:
```python
def package_root(pkg: ModuleType) -> str:
"""
Find out where is the root directory holding code for specified package or module.
:param pkg: package to be located.
:raise ValueError: if the argument is a module and not a package
:return: absolute path to the directory holding the `__init__` file of the package
"""
(...)
def current_project_root() -> str:
"""
Find out where is the root directory holding code for currently running app.
By "currently running app" we mean the module that is present as `__main__`.
:return: absolute path to the directory holding the module that is `__main__`
"""
(...)
def import_package_recursively(root_package: str) -> None:
"""
Will import the package specified by name and all its subpackages and submodules recursively.
Order is: each subpackage or submodule of the package, then recurse in that same order.
:param root_package: name of the package to be scanned. If that's already a subpackage, its parent packages
will get imported by default (because that's how python works)
"""
(...)
```
Reading [the test suite](./test/test_recursive_import_from_root.py) is gonna be useful too, in case of uncertainty.
Raw data
{
"_id": null,
"home_page": null,
"name": "recursive-import",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.5",
"maintainer_email": null,
"keywords": "import",
"author": null,
"author_email": "Filip Malczak <filip.malczak@gmail.com>",
"download_url": null,
"platform": null,
"description": "# recursive_import\n\n[![CI](https://github.com/FilipMalczak/recursive_import/actions/workflows/ci.yml/badge.svg)](https://github.com/FilipMalczak/recursive-import/actions/workflows/ci.yml)\n[![PyPI version](https://badge.fury.io/py/recursive-import.svg)](https://badge.fury.io/py/recursive-import)\n\nTrivial library that will import the whole module tree.\n\nMain use case for this library is importing everything in given package. Simplest exaple are\ndecorators that register stuff for CI, a bit like annotation scanning in Java.\n\n> Requires python 3.5+, because of `typing`. Besides that, there are no dependencies.\n\n> System-independent. Tested on CPython 3.9-3.12 (to simplify CI), but its really trivial. \n\nThe whole API is best documented by docstrings:\n\n```python\ndef package_root(pkg: ModuleType) -> str:\n \"\"\"\n Find out where is the root directory holding code for specified package or module.\n :param pkg: package to be located.\n :raise ValueError: if the argument is a module and not a package\n :return: absolute path to the directory holding the `__init__` file of the package\n \"\"\"\n (...)\n\ndef current_project_root() -> str:\n \"\"\"\n Find out where is the root directory holding code for currently running app.\n By \"currently running app\" we mean the module that is present as `__main__`.\n :return: absolute path to the directory holding the module that is `__main__`\n \"\"\"\n (...)\n\ndef import_package_recursively(root_package: str) -> None:\n \"\"\"\n Will import the package specified by name and all its subpackages and submodules recursively.\n Order is: each subpackage or submodule of the package, then recurse in that same order.\n :param root_package: name of the package to be scanned. If that's already a subpackage, its parent packages\n will get imported by default (because that's how python works)\n \"\"\"\n (...)\n```\n\nReading [the test suite](./test/test_recursive_import_from_root.py) is gonna be useful too, in case of uncertainty.\n",
"bugtrack_url": null,
"license": "MIT License Copyright (c) 2024 Filip Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
"summary": "Trivial library that will import the whole module tree",
"version": "1.0.0",
"project_urls": {
"Homepage": "https://github.com/FilipMalczak/recursive_import"
},
"split_keywords": [
"import"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "44d6ea30fa4cee12ee1f39b1dfe7e14c4199aa6306b559d6070cbda2f3a0bf03",
"md5": "f8308ec59d2277a641f9dbb0b6051f71",
"sha256": "5fff19508675bda5afbec884bcccf54ad267f9948d4f9874c272ac8348c76843"
},
"downloads": -1,
"filename": "recursive_import-1.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "f8308ec59d2277a641f9dbb0b6051f71",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.5",
"size": 4774,
"upload_time": "2024-07-12T16:57:53",
"upload_time_iso_8601": "2024-07-12T16:57:53.110529Z",
"url": "https://files.pythonhosted.org/packages/44/d6/ea30fa4cee12ee1f39b1dfe7e14c4199aa6306b559d6070cbda2f3a0bf03/recursive_import-1.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-07-12 16:57:53",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "FilipMalczak",
"github_project": "recursive_import",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "recursive-import"
}