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 configuration option to enable strict enforcement of typing.override (PEP 698) #4788

Closed
NeilGirdhar opened this issue Mar 16, 2023 · 5 comments
Labels
addressed in next version Issue is fixed and will appear in next published version enhancement request New feature or request

Comments

@NeilGirdhar
Copy link

Will Pyright be implementing the strict enforcement of typing.override described in PEP 698?

@NeilGirdhar NeilGirdhar added the enhancement request New feature or request label Mar 16, 2023
@erictraut
Copy link
Collaborator

I've added a new optional diagnostic check called reportImplicitOverride. It's off by default even in strict mode. When enabled, it implements strict enforcement of PEP 698.

One open question that's not addressed in PEP 698 is whether __init__ and __new__ should be exempt from this check. For now, I've opted to not exempt these methods, but I could be convinced that they should be exempted since they are exempt from LSP checks.

@erictraut erictraut added the addressed in next version Issue is fixed and will appear in next published version label Mar 16, 2023
@NeilGirdhar
Copy link
Author

NeilGirdhar commented Mar 16, 2023

I've added a new optional diagnostic check called reportImplicitOverride.

Oh, my mistake! Somehow, I missed this when I checked the documentation. (Edit: Oh, I see you just added it to the docs 😄. Perfect, thanks!)

but I could be convinced that they should be exempted since they are exempt from LSP checks.

I share the same logic. If you don't exempt them, users will have to always mark them as @override, which doesn't seem that helpful?

@erictraut
Copy link
Collaborator

I'll close the issue once the next version of pyright is published.

@NeilGirdhar
Copy link
Author

Okay, sorry, and thanks again!

@erictraut
Copy link
Collaborator

This is included in pyright 1.1.300, which I just published. It will also be included in a future release of pylance.

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

2 participants