-
Notifications
You must be signed in to change notification settings - Fork 6k
More explicit type annotations #3508
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
Conversation
|
Small update: Apparently pyright still thinks that PTb is not very type complete: {
"exportedSymbolCounts": {
"withKnownType": 415,
"withAmbiguousType": 30,
"withUnknownType": 294
},
"otherSymbolCounts": {
"withKnownType": 1815,
"withAmbiguousType": 702,
"withUnknownType": 566
},
"missingFunctionDocStringCount": 25,
"missingClassDocStringCount": 0,
"missingDefaultParamCount": 107,
"completenessScore": 0.5615696887686062,
} |
|
Update: {
"exportedSymbolCounts": {
"withKnownType": 426,
"withAmbiguousType": 277,
"withUnknownType": 36
},
"otherSymbolCounts": {
"withKnownType": 2292,
"withAmbiguousType": 671,
"withUnknownType": 120
},
"missingFunctionDocStringCount": 25,
"missingClassDocStringCount": 0,
"missingDefaultParamCount": 107,
"completenessScore": 0.5764546684709067,
}So at least a rather large jump from "unknown" to "ambiguous - even though the completeness increased only ~1.5 points 😄 Also I apparently messed up the tests big time |
{
"exportedSymbolCounts": {
"withKnownType": 705,
"withAmbiguousType": 0,
"withUnknownType": 34
},
"otherSymbolCounts": {
"withKnownType": 3180,
"withAmbiguousType": 0,
"withUnknownType": 102
},
"missingFunctionDocStringCount": 23,
"missingClassDocStringCount": 0,
"missingDefaultParamCount": 147,
"completenessScore": 0.9539918809201624,
}😎 |
|
Last update for today messe up the tests, but got to 96%: IISC most of what's left boils down to the generic nature of |
|
The GH Actions thingy doesn't quite work yet and sphinx is acting up while documenting |
|
Okay so I tested it and it's just as good as before, except now the autocompletion of Anyway running pyright on my machine still found some unknown types, sending a pastebin in dev chat |
|
@harshil21 Nice :) which Python version are did you run pyright on? did you use the |
This reverts commit 8f1e5ad.
harshil21
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it worth to also modify bot method parameters to Optional[...] as well? Even the newer mypy version complains of implicit optionals now
You mean e.g. |
yes
pylance complains about that while developing PTB. I mentioned mypy since they made a similar change with implicit_optional |
So this changed? #3367 (comment) If it has: Fair enough, let's do it. But I vote to do that in a different PR - we can reopen #3367 for that. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey! Looks like you edited the (optional) requirements or the pre-commit hooks. I'm just a friendly reminder to keep the additional dependencies for the hooks in sync with the requirements :)
Basically a long-time result of microsoft/pylance-release#1983: Explicity adds type annotations to attributes of classes.
While I still don't really like that there is a (partial) need for this, it's mostly a one-time effort.
Almost all additions where ofc automated. It's "only" type hints, so if I got something wrong here, it doesn't have runtime effect, but a "slow-scrolling-quick-read" review would still be good at some point :D
Todo:
pyright --verifytypes telegramwhat that tool thinks about the type completeness of our library and check what we can improve about it