Skip to content

fix(api): declare __all__ and export UndefinedLiteral - #83

Merged
david-debest merged 3 commits into
mainfrom
82-fix/public-reexports
Oct 27, 2026
Merged

david-debest merged 3 commits into
mainfrom
82-fix/public-reexports

Conversation

@david-debest

Copy link
Copy Markdown
Contributor

Fixes #82

Problem

Since py.typed is shipped, pyright applies typed-library re-export rules. The package __init__.py files had no __all__, so documented imports such as from knowledge_mapper import Uri were reported as reportPrivateImportUsage. knowledge_mapper.ke (Client) had the same problem.

Changes

  • Add explicit __all__ to knowledge_mapper, knowledge_mapper.ke and knowledge_mapper.testing.
  • Export UndefinedLiteral from knowledge_mapper and document it in the README.
  • Add 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.
  • Document the check in CONTRIBUTING.md.

Notes

Pyright runs through uvx in CI, so it isn't added to the project's dependencies.

david-debest and others added 2 commits October 27, 2026 14:54
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]>
@david-debest david-debest self-assigned this Oct 27, 2026
@david-debest
david-debest merged commit c54eeb1 into main Oct 27, 2026
3 checks passed
@david-debest
david-debest deleted the 82-fix/public-reexports branch October 27, 2026 14:32
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.

Pyright reports public imports as private: missing __all__ and UndefinedLiteral export

1 participant