test_lazy_exports

Importing this package must stay cheap, and its exports must stay honest.

Every model here is a ccflow model, and importing ccflow imports csp and pandas: about 0.9 s. Hydra’s searchpath plugin imports dau_core.config to discover what is installed, so a package that imports its model modules at import time puts that 0.9 s in front of every composition, for names discovery never reads.

Attributes

INIT

Functions

_init_tree() → ast.Module

_type_checking_imports() → dict[str, tuple[str, ...]]

What the TYPE_CHECKING block declares, read from the source.

test_the_declaration_and_the_type_checking_block_agree() → None

The two exist for different readers -- the resolver and a type

test_every_exported_name_resolves() → None

A name declared here and missing from its submodule would raise on

test_an_unknown_name_still_raises_attribute_error() → None

test_importing_the_package_does_not_import_ccflow() → None

The guard that keeps composition fast. Run in a fresh interpreter,

test_a_name_reached_through_the_package_is_the_submodule_object() → None

Lazily resolved is not a copy: the name a caller imports from the

Module Contents

test_lazy_exports.INIT
test_lazy_exports._init_tree() → ast.Module
test_lazy_exports._type_checking_imports() → dict[str, tuple[str, ...]]

What the TYPE_CHECKING block declares, read from the source.

test_lazy_exports.test_the_declaration_and_the_type_checking_block_agree() → None

The two exist for different readers – the resolver and a type checker – and a name in one and not the other is a name that imports for one of them and fails for the other.

test_lazy_exports.test_every_exported_name_resolves() → None

A name declared here and missing from its submodule would raise on first access, which is a broken import nobody sees until a caller reaches for it. Resolve all of them now.

test_lazy_exports.test_an_unknown_name_still_raises_attribute_error() → None
test_lazy_exports.test_importing_the_package_does_not_import_ccflow() → None

The guard that keeps composition fast. Run in a fresh interpreter, because this one has already imported everything.

test_lazy_exports.test_a_name_reached_through_the_package_is_the_submodule_object() → None

Lazily resolved is not a copy: the name a caller imports from the package is the one the submodule defines, so an isinstance check against either spelling holds.