This project has been archived by its maintainers, and is no longer receiving any updates.
A library for working with Python modules.
Module Contents
lazy_import(importer_name, to_import)
Returns the importing module and a callable for lazy importing.
The module named by importer_name represents the module performing the
import to help facilitate resolving relative imports.
to_import is an iterable of the modules to be potentially imported. Modules
may be specified either as absolute and relative names. The attribute name
that the specified module is ultimately bound to is specified in one of two
ways. First, the general case is the end of the dotted name of the module is
what the attribute name will be, e.g. pkg.mod will be bound to mod on
the importer module. Second, the as format of importing is also supported,
so one may say, e.g. "pkg.mod as spam" and have pkg.mod bound to the
attribute spam on the importer module.
This function returns a tuple of two items. The first is the importer
module itself for easy reference within itself. The second item is a callable
which is expected to be set to __getattr__ within the importer module to allow
for lazy importing. For instance:
mod, __getattr__ = lazy_import(__name__, {'sys', '.submodule',
'importlib.abc as i_abc'})
def func():
return mod.i_abc.answer == 42
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file modutil-1.0.0.tar.gz.
File metadata
- Download URL: modutil-1.0.0.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8b1205dd4900abe62d2fa126dac18d27b6af5720bb746f1bb6d99c87959a9f31
|
|
| MD5 |
7954b350e8221c63fa4e6b28f0c7c1c3
|
|
| BLAKE2b-256 |
c5f4b944b16d818eb96858f14e09db2db6fe89fe87c6b0e8225d2465447cefd3
|
File details
Details for the file modutil-1.0.0-py3-none-any.whl.
File metadata
- Download URL: modutil-1.0.0-py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c410966aefba16c5faeba05c08bba44499a7aa7f03fcee128ab05aced30f2730
|
|
| MD5 |
d75ae980670249c7242fe24e47cb4a1c
|
|
| BLAKE2b-256 |
7633a365bfd0f293e5ab6e61f55eb9a2cef92ca4949bf8135b78a625ab965d60
|