Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@jacobcheatley
Copy link
Contributor

This makes:

import jinjax

# And then using...
jinjax.JinjaX
# Or some other symbol

behave properly for type checkers like pyright by conforming to the PEP561 / type information in libraries spec. Linters also stop complaining, so you can remove the #noqa.

Without the change, pyright reports: error: "JinjaX" is not exported from module "jinjax" (reportPrivateImportUsage)

This can be worked around by ignoring the reportPrivateImportUsage rule, but it's nice to have.

An alternative to setting __all__ would be redundant aliases (e.g. from .jinjax import JinjaX as JinjaX) but I figured those were less nice.

microsoft/pyright#2639 (comment)

@jpsca jpsca merged commit 6cb8383 into jpsca:main Oct 19, 2024
3 of 4 checks passed
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.

2 participants