attach(module_name, submodules=None, submod_attrs=None)
Typically, modules import submodules and attributes as follows:
import mysubmodule import anothersubmodule from .foo import someattr
The idea of this function is to replace the :None:None:`__init__.py`
module's __getattr__
, :None:None:`__dir__`
, and :None:None:`__all__`
attributes such that all imports work exactly the way they normally would, except that the actual import is delayed until the resulting module object is first used.
The typical way to call this function, replacing the above imports, is:
__getattr__, __lazy_dir__, __all__ = lazy.attach( __name__, ['mysubmodule', 'anothersubmodule'], {'foo': 'someattr'} )
This functionality requires Python 3.7 or higher.
Typically use __name__.
List of submodules to lazily import.
Dictionary of submodule -> list of attributes / functions. These attributes are imported as they are used.
Attach lazily loaded submodules, and functions or other attributes.
Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.
Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)
SVG is more flexible but power hungry; and does not scale well to 50 + nodes.
All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them