-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Adopt typing_extensions.Override
#18695
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
Comments
can you clarify what overrides classes are? |
Hey @carmocca, I would like to solve this, can you assign me this issue? |
@seanbethard see https://peps.python.org/pep-0698 @SarthakJain333 Sure! I suggest that you do it for 1 or a few files per PR to avoid having it blow up in size |
Ok, I'll have a look around this framework and will try to solve the issue. Thanks for assigning me ! |
@SarthakJain333 let me know if you need any help! |
I understand what overrides and decorators are. it's not clear from the issue which classes you're targeting. good luck @SarthakJain333. |
Hey if this is not done yet, is this something I can pick up? I am a new contributor looking to help. |
Yes @sbshah97, you can pick a file from the list above |
@seanbethard This is feedback for #18866 but commenting here for everybody else who decides to help. This addition should only be done to the |
I can volunteer to start some files in the fabric directory to start off. Will try to avoid a large PR. |
I see. well, each commit in #18866 is associated with a single base class. I thought this way of breaking up the work was preferable to adding 17 PRs. |
removed overrides from all directories except |
@seanbethard You've covered a lot of classes in #18866. I believe https://github.com/Lightning-AI/lightning/blob/master/src/lightning/pytorch/strategies/strategy.py (among others) is still unchanged. Can I do that one? |
there were a few that I didn't think required any changes because the subclasses only implement abstract methods or define new ones. I believe pytorch |
As an example, Am I missing something? |
nice catch! for each of the base classes listed above I only checked for classes that inherit directly from them (children). I didn't check for grandchildren or additional generations. |
Alright! I'll cover |
@VictorPrins I might have missed some files/directories on my comment. Feel free to correct me and add the decorator elsewhere if it's needed |
@VictorPrins do you have an overview of which files are left to do? Or are we done? |
this shall be visible from |
Yes I'll finish this up shortly, thanks for the heads up. The appropriate command is |
@VictorPrins Do you think that setting should be added to our mypy config after all the relevant files have been updated? |
Automated checking might be desirable to avoid gradual slipping, especially since the
|
Uh oh!
There was an error while loading. Please reload this page.
Description & Motivation
We use overrides heavily.
Python 3.12 added support for this. See https://peps.python.org/pep-0698/
Mypy should support it: python/mypy#14072
Pitch
Use https://typing-extensions.readthedocs.io/en/latest/#override in our overrides classes.
Using this would require increasing the minimum
typing_extensions
to 4.4: https://github.com/Lightning-AI/lightning/blob/master/requirements/fabric/base.txt#L8Alternatives
No response
Additional context
No response
cc @Borda
The text was updated successfully, but these errors were encountered: