Metadata-Version: 2.1
Name: lazypimp
Version: 0.1.0
Summary: A Python package to lazy import modules and functions.
Author-email: Silvano Rosenau <silvano.rosenau@uni-hamburg.de>
Project-URL: Repository, https://github.com/Gordi42/lazypimp
Keywords: lazy,import,module,function,package,python,lazypimp
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Development Status :: 3 - Alpha
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE

# 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)
```
