# Lazypimp
Lazypimp stands for lazy python import. It is a python package that allows you to setup an importing system that loads all imports on demand. This is useful for large projects where you don't want to load all the imports at once.
## Installation
using pip:
```bash
pip install lazypimp
```
using conda:
```bash
conda install -c conda-forge lazypimp
```
## Usage
Let's say we have a file structure as follows:
```
mymodule/
__init__.py
submod1.py
submod2.py
submod3.py
subpackage/
__init__.py
submod4.py
class1.py
functions.py
```
And we want to have the following imports in the `__init__.py` file:
```python
# imports of submodules
from mymodule import submod1, submod2, submod3 as sm3
from mymodule.subpackage import submod4
# imports of classes, functions, etc.
from mymodule.class1 import MyClass1
from mymodule.functions import my_function
```
To set up the module `mymodule` to load submodules on demand, we can use the following code:
```python
from lazypimp import setup
all_modules_by_origin = {
"mymodule": ["submod1", "submod2", {"sm3": "submod3"}],
"mymodule.subpackage": ["submod4"]
}
all_imports_by_origin = {
"mymodule.class1": "MyClass1",
"mymodule.functions": "my_function"
}
setup(__name__, all_modules_by_origin, all_imports_by_origin)
```
Raw data
{
"_id": null,
"home_page": null,
"name": "lazypimp",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "lazy, import, module, function, package, python, lazypimp",
"author": null,
"author_email": "Silvano Rosenau <silvano.rosenau@uni-hamburg.de>",
"download_url": "https://files.pythonhosted.org/packages/b3/16/2f6b16d231b5dcbba61276dbc233f561db38e03aa6f36149a70acf9069d7/lazypimp-0.1.0.tar.gz",
"platform": null,
"description": "# Lazypimp\nLazypimp stands for lazy python import. It is a python package that allows you to setup an importing system that loads all imports on demand. This is useful for large projects where you don't want to load all the imports at once.\n\n## Installation\nusing pip:\n```bash\npip install lazypimp\n```\nusing conda:\n```bash\nconda install -c conda-forge lazypimp\n```\n\n## Usage\nLet's say we have a file structure as follows:\n```\nmymodule/\n __init__.py\n submod1.py\n submod2.py\n submod3.py\n subpackage/\n __init__.py\n submod4.py\n class1.py\n functions.py\n```\nAnd we want to have the following imports in the `__init__.py` file:\n```python\n# imports of submodules\nfrom mymodule import submod1, submod2, submod3 as sm3\nfrom mymodule.subpackage import submod4\n\n# imports of classes, functions, etc.\nfrom mymodule.class1 import MyClass1\nfrom mymodule.functions import my_function\n```\n\nTo set up the module `mymodule` to load submodules on demand, we can use the following code:\n```python\n\nfrom lazypimp import setup\n\nall_modules_by_origin = {\n \"mymodule\": [\"submod1\", \"submod2\", {\"sm3\": \"submod3\"}], \n \"mymodule.subpackage\": [\"submod4\"]\n}\n\nall_imports_by_origin = {\n \"mymodule.class1\": \"MyClass1\",\n \"mymodule.functions\": \"my_function\"\n}\n\nsetup(__name__, all_modules_by_origin, all_imports_by_origin)\n```\n",
"bugtrack_url": null,
"license": null,
"summary": "A Python package to lazy import modules and functions.",
"version": "0.1.0",
"project_urls": {
"Repository": "https://github.com/Gordi42/lazypimp"
},
"split_keywords": [
"lazy",
" import",
" module",
" function",
" package",
" python",
" lazypimp"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "5e1ea2c5c1a5377caeef873de9531967ff0c2fb24852687575e56b89ce22aa8f",
"md5": "18af5acf6354a65244ed8200e24999b3",
"sha256": "7ad8099b582cf0fdb89fd362c6af7df97ec2006aedf75f5068a135149b554530"
},
"downloads": -1,
"filename": "lazypimp-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "18af5acf6354a65244ed8200e24999b3",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 3407,
"upload_time": "2024-08-01T12:00:54",
"upload_time_iso_8601": "2024-08-01T12:00:54.540589Z",
"url": "https://files.pythonhosted.org/packages/5e/1e/a2c5c1a5377caeef873de9531967ff0c2fb24852687575e56b89ce22aa8f/lazypimp-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "b3162f6b16d231b5dcbba61276dbc233f561db38e03aa6f36149a70acf9069d7",
"md5": "552e2c2d823dea85912acaeca972093f",
"sha256": "bf3c58d15e668a9e54f7f8692b40539ded39f8c2af63c736090895c36d7f8f5e"
},
"downloads": -1,
"filename": "lazypimp-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "552e2c2d823dea85912acaeca972093f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 2875,
"upload_time": "2024-08-01T12:00:56",
"upload_time_iso_8601": "2024-08-01T12:00:56.105254Z",
"url": "https://files.pythonhosted.org/packages/b3/16/2f6b16d231b5dcbba61276dbc233f561db38e03aa6f36149a70acf9069d7/lazypimp-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-01 12:00:56",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Gordi42",
"github_project": "lazypimp",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "lazypimp"
}