-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
ast.pyi: add # type: ignore[deprecated]
for type checker versions > requirements-tests.txt
pinned versions
#13905
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
What problem is this solving for you? |
This comment has been minimized.
This comment has been minimized.
I am not sure I understand your question, however: It suppresses those diagnostic reports when I am working with the file. https://github.com/hunterhogan/astToolkit Hypothetically, but only hypothetically at this point, it could help here, too. https://github.com/hunterhogan/stubFileNotFound |
We add type ignores to silence errors from type checkers in our CI. They shouldn't matter if you merely use the That's why Shantanu asked what problem this solves for you. |
Ah, that explains many things! I apologize for my ignorance causing extra work for y'all. Now that I understand the connections between the failed tests and other things, I can (and will) go learn some more things. Please give me a day to figure this out so it passes the tests. |
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
# type: ignore[deprecated]
# type: ignore[deprecated]
for type checker versions > requirements-tests.txt
pinned versions
The successful tests confirm that my Pull Request is less wrong than it was before. I changed the title to something better, but I suspect it needs improvement in ways I don't know about. I hope the content of the commits is now up to standards. I am working directly with the stub file, so I see the diagnostic errors. |
I'm still not sure what exactly your use case is, but any type checker should not warn about problems in third-party stub files (i.e. stubs from typeshed). We generally only add type ignores to stubs to satisfy our CI tests. In particular, the deprecation warnings should never be triggered, since the stubs themselves will never call any of the deprecated functions. If the deprecation warnings are triggered in your local project, you need to add the |
:(
To create the halfway decent tools in https://github.com/hunterhogan/astToolkit, I directly use the "ast.pyi" file. Then I use inexpert programming skills to extract and transform the information.
You are probably right, but I'm not qualified to agree or disagree with you. I cannot think of a direct "benefit to the typeshed project." Furthermore, I cannot think of a direct benefit to those who use the typeshed project in a "normal" way. I sincerely don't know whether a utilitarian analysis of this Pull Request would or would not suggest it should be merged. Because Shantanu asked and because you said you didn't know about the potential utility for me, I have tried to concisely explain it, above. |
I see, that's definitely an unusual use case. You're welcome to do that sort of thing, but it's not a use case we officially support, and if you're generating a patched version of |
That's a pretty cool use case for the type stubs – and helps me with my argument that stubs can be used in unexpected ways. But I agree with what Jelle wrote. This is also safer for your project as that use case is something that we're probably not keeping in mind when editing/improving our type stubs, so doing this yourself makes your project more resilient against changes on our side. |
Based on the existing usage of
# type: ignore[deprecated]
attypeshed/stdlib/ast.pyi
Lines 2026 to 2036 in 49afeeb
Added
# type: ignore[deprecated]
to the code block below# visit methods for deprecated nodes
typeshed/stdlib/ast.pyi
Lines 2018 to 2024 in 49afeeb
Added
# type: ignore[deprecated]
and modified# type: ignore[misc]
typeshed/stdlib/ast.pyi
Lines 1182 to 1188 in 49afeeb