Skip to content

Add 'if typing.TYPE_CHECKING:' export declarations to maxtext/__init__.py and unit test. - #4875

Open
copybara-service[bot] wants to merge 1 commit into
mainfrom
test_963829855
Open

Add 'if typing.TYPE_CHECKING:' export declarations to maxtext/__init__.py and unit test.#4875
copybara-service[bot] wants to merge 1 commit into
mainfrom
test_963829855

Conversation

@copybara-service

Copy link
Copy Markdown
Contributor

Add 'if typing.TYPE_CHECKING:' export declarations to maxtext/init.py and unit test.

  1. Adds 'if typing.TYPE_CHECKING:' block declaring lazily-loaded exports (Sequence, Mesh, pyconfig, MaxTextConfig, models, Transformer, transformer_as_linen, maxtext_utils, model_creation_utils, from_config, from_pretrained). This provides static symbol visibility to linters (Pylint) and typecheckers (Pytype/MyPy) to resolve E0611 (no-name-in-module) while preserving zero-overhead runtime lazy loading.
  2. Adds tests/unit/maxtext_init_test.py to verify that 'if TYPE_CHECKING:' imports, all, and getattr match cases remain strictly in sync.

…_.py and unit test.

1. Adds 'if typing.TYPE_CHECKING:' block declaring lazily-loaded exports (Sequence, Mesh, pyconfig, MaxTextConfig, models, Transformer, transformer_as_linen, maxtext_utils, model_creation_utils, from_config, from_pretrained). This provides static symbol visibility to linters (Pylint) and typecheckers (Pytype/MyPy) to resolve E0611 (no-name-in-module) while preserving zero-overhead runtime lazy loading.
2. Adds tests/unit/maxtext_init_test.py to verify that 'if TYPE_CHECKING:' imports, __all__, and __getattr__ match cases remain strictly in sync.

PiperOrigin-RevId: 963829855
@codecov

codecov Bot commented Aug 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant