Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add check for runtime use of classes or functions decorated with type_check_only #5810

Closed
erictraut opened this issue Aug 25, 2023 · 1 comment
Labels
addressed in next version Issue is fixed and will appear in next published version enhancement request New feature or request

Comments

@erictraut
Copy link
Collaborator

The typing.type_check_only is a documented way to specify that a class or function within a stub file is not present at runtime and should therefore not be referenced outside of an annotation. Currently, pyright (and mypy) do not check for such uses.

This is related to mypy issue python/mypy#9531.

@erictraut erictraut added the enhancement request New feature or request label Aug 25, 2023
erictraut added a commit that referenced this issue Aug 26, 2023
…#5817)

Co-authored-by: Eric Traut <erictr@microsoft.com>
@erictraut erictraut added the addressed in next version Issue is fixed and will appear in next published version label Aug 26, 2023
@erictraut
Copy link
Collaborator Author

This is included in pyright 1.1.325, which I just published. It will also be included in an upcoming pylance release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addressed in next version Issue is fixed and will appear in next published version enhancement request New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant