Package pygeodesy :: Module lazily |
[frames] | no frames]

# Module lazily

Lazily import `pygeodesy` modules and attributes, based on lazy_import from Brett Cannon's modutil.

`Lazy import` is supported only for Python 3.7+ and is enabled by default in PyGeodesy 18.11.10 and newer.

To enable `lazy import`, set `env` variable `PYGEODESY_LAZY_IMPORT` to `1`, `2`, `3` or higher prior to `import pygeodesy`. To disable `lazy import`, set `env` variable `PYGEODESY_LAZY_IMPORT` to `0` or an empty string. Use `2` or higher to print a message for each lazily imported module and attribute, similar to `env` variable `PYTHONVERBOSE` showing imports. Using `3` or higher also shows the importing file name and line number.

Notes:

- `Lazy import` applies only to top-level modules of `pygeodesy`. The `lazy import` of a top-level module invariably loads all sub-modules imported by that top-level module.
- `Lazy import` raises a LazyAttributeError or LazyImportError depending on the cause of the error and such errors can occur late, after all initial imports.

Version: 24.08.18

Classes
| LazyAttributeError Raised if a `lazily imported` attribute is missing or invalid.
| LazyImportError Raised if `lazy import` is not supported, disabled or failed some other way.

Variables
| isLazy = `None` hash(x)
| timeit
| t1 = `timeit(t1, number= 1000000)`
| t2 = `timeit(t2, number= 1000000)`