Repository navigation
fix(api): declare __all__ and export UndefinedLiteral - #83
Merged
Merged
Conversation
Since py.typed is shipped, pyright applies re-export rules and flagged documented top-level imports as private (reportPrivateImportUsage). UndefinedLiteral is needed to annotate helpers returning the sentinel. Fixes #82 Co-authored-by: Copilot <[email protected]>
Catches re-export regressions that pyright only reports for installed typed packages, not for the project's own sources. Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
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.
Fixes #82
Problem
Since
py.typedis shipped, pyright applies typed-library re-export rules. The package__init__.pyfiles had no__all__, so documented imports such asfrom knowledge_mapper import Uriwere reported asreportPrivateImportUsage.knowledge_mapper.ke(Client) had the same problem.Changes
__all__toknowledge_mapper,knowledge_mapper.keandknowledge_mapper.testing.UndefinedLiteralfromknowledge_mapperand document it in the README.tests/typing/public_api.py, a consumer-style import snippet, with a CI step that runs pyright on it from that directory. Pyright only checks re-exports for installed packages, not project sources. Without the fix it reports 26 errors; with the fix, 0.CONTRIBUTING.md.Notes
Pyright runs through
uvxin CI, so it isn't added to the project's dependencies.