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:
pip install lazypimp
using conda:
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:
# 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:
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)
Metadata
Release files for lazypimp 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| lazypimp-0.1.0.tar.gz | 2.9 kB | Without provenance | Details for lazypimp-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| lazypimp-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for lazypimp-0.1.0-py3-none-any.whl |
Total release size: 6.3 kB
Release files / lazypimp-0.1.0.tar.gz
| Download URL | lazypimp-0.1.0.tar.gz |
|---|---|
| Size | 2.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bf3c58d15e668a9e54f7f8692b40539ded39f8c2af63c736090895c36d7f8f5e
|
|
BLAKE2b-256 checksum How to use checksums |
b3162f6b16d231b5dcbba61276dbc233f561db38e03aa6f36149a70acf9069d7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.9
|
Release files / lazypimp-0.1.0-py3-none-any.whl
| Download URL | lazypimp-0.1.0-py3-none-any.whl |
|---|---|
| Size | 3.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7ad8099b582cf0fdb89fd362c6af7df97ec2006aedf75f5068a135149b554530
|
|
BLAKE2b-256 checksum How to use checksums |
5e1ea2c5c1a5377caeef873de9531967ff0c2fb24852687575e56b89ce22aa8f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.9
|
Security for lazypimp 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.