imports_missing_name check

Importing a name the resolved module does not define

from M import name only proves that the module path M resolves to a file; it says nothing about name. When M is a workspace .py source Basilisk can see every module-level binding, so importing a name that is neither bound in M, nor an existing submodule of the package, is an ImportError waiting for runtime (GitHub #55).

from demo.late_module import provide_value  # late_module.py defines nothing

The rule is deliberately conservative — silence over guessing:

- Every module-level binding form counts as defined: def/class, every assignment form, import/from re-exports, for/with/match/ except targets, walrus expressions, and type alias statements. - A module-level __getattr__ (PEP 562) permits any name. - A target containing from x import * has an unknowable member set and suppresses the rule for that module. - from pkg import mod is satisfied by an existing pkg/mod.py, pkg/mod.pyi, or pkg/mod/ submodule.

Scope: from-imports resolved to workspace .py sources. Stub-backed imports are covered by imports_module_attribute; site-packages sources stay with missing_type_stubs (PEP 561 draws the trust boundary there).

Canonical documentation

How to handle it

This core typing rule is enabled by default. Fix the reported type error, or adjust imports_missing_name for a specific path in the pyproject.toml configuration. See the core rule group for related diagnostics.

Canonical URL: https://www.basilisk-python.dev/errors/imports_missing_name