Does sys.set_lazy_imports() accept 'none'
22:44 11 Nov 2026

According to the docs:

sys.set_lazy_imports(mode)

Sets the global lazy imports mode. The mode parameter must be one of the following strings:

  • "normal": Only imports explicitly marked with the lazy keyword are lazy

  • "all": All top-level imports become potentially lazy

However, according to typeshed:

_LazyImportMode: TypeAlias = Literal["normal", "all", "none"]

if sys.version_info >= (3, 15):
    def set_lazy_imports(mode: _LazyImportMode) -> None: ...

Is "none" a supported mode for sys.set_lazy_imports()? What does it do?


I'm not suprised if this is a documentation error, as lazy imports are still a new feature

python python-import lazy-loading