Add __all__ to __init__.py for type checker re-export compatibility#381
Merged
t20100 merged 2 commits intosilx-kit:mainfrom Apr 27, 2026
Merged
Add __all__ to __init__.py for type checker re-export compatibility#381t20100 merged 2 commits intosilx-kit:mainfrom
__all__ to __init__.py for type checker re-export compatibility#381t20100 merged 2 commits intosilx-kit:mainfrom
Conversation
t20100
reviewed
Apr 24, 2026
| "ZSTD_ID", | ||
| # Utilities | ||
| "FILTERS", | ||
| "PLUGIN_PATH", |
Member
There was a problem hiding this comment.
from_filter_options is missing:
Suggested change
| "PLUGIN_PATH", | |
| "PLUGIN_PATH", | |
| "from_filter_options", |
Comment on lines
+77
to
+88
| # Filter ID constants | ||
| "BLOSC_ID", | ||
| "BLOSC2_ID", | ||
| "BSHUF_ID", | ||
| "BZIP2_ID", | ||
| "FCIDECOMP_ID", | ||
| "LZ4_ID", | ||
| "SPERR_ID", | ||
| "SZ_ID", | ||
| "SZ3_ID", | ||
| "ZFP_ID", | ||
| "ZSTD_ID", |
Member
There was a problem hiding this comment.
I propose to remove the *_ID constants from __all__: The ids are accessible from the filter classes, e.g., Blosc2.filter_id, and I would consider deprecating the *_ID constants (not in this PR).
Suggested change
| # Filter ID constants | |
| "BLOSC_ID", | |
| "BLOSC2_ID", | |
| "BSHUF_ID", | |
| "BZIP2_ID", | |
| "FCIDECOMP_ID", | |
| "LZ4_ID", | |
| "SPERR_ID", | |
| "SZ_ID", | |
| "SZ3_ID", | |
| "ZFP_ID", | |
| "ZSTD_ID", |
Contributor
Author
|
Done, I've added |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Pyright/Pylance (and other PEP 484-compliant type checkers) do not treat
from .module import Namein a package__init__.pyas a public re-export. As a result, users ofhdf5pluginwith strict type checking enabled see errors such as:even though the import works correctly at runtime.
Root Cause
Pyright follows the rule defined in the typing spec: a name imported in a package's
__init__.pyis only considered a public re-export if it is:from x import y as yform, or__all__.The existing
# noqacomments suppress linter warnings (e.g. flake8 F401) but have no effect on type checker re-export analysis.Change
Update all public re-exports in
__init__.pyto use the explicitfrom ._filters import Blosc2 as Blosc2form, which satisfies both type checkers and linters without requiring an__all__declaration.It has no runtime behaviour changes.