Features
- ⭐ Lazy import of aliases is now supported e.g.
lazimp.lazy_import('numpy', aliases={'np': 'numpy'})
will expose the attributenp
but lazy importsnumpy
. You can see an example here: https://github.com/Vikka/lazimp/tree/main/examples/aliases. - ⭐ Import with path.to.module is now supported e.g.
lazimp.lazy_import('package.submodule')
will exposepackage
but lazy importspackage.submodule
. You can see an example here: https://github.com/Vikka/lazimp/tree/main/examples/bare_sub_import.
Breaking changes
⚠️ lazimp.lazy_import
signature has changed i.e.:
def lazy_import(
*bare_imports: str,
aliases: collections.abc.Mapping[str, str] | None = None,
sub_import: collections.abc.Mapping[str, str] | None = None,
**kw_sub_import: str,
) -> collections.abc.Callable[[str], ModuleType]:
kw_sub_import
will be merge with the sub_import
mapping.
Fixes
- 🐛 Fix bare import who weren't working.
Docs
- ✏️ Example of usage folders: https://github.com/Vikka/lazimp/tree/main/examples.
- ✏️ Update example in README.md: 0.0.3...0.0.4#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5
Full Changelog: 0.0.3...0.0.4
PyPi release: https://pypi.org/project/lazimp/0.0.4/