-
Notifications
You must be signed in to change notification settings - Fork 260
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
Import type information directly from the typing
module.
#657
Conversation
This is done to work around microsoft/pyright#3044, which doesn't recognize types imported indirectly through another module.
Codecov Report
@@ Coverage Diff @@
## master #657 +/- ##
=======================================
Coverage 98.80% 98.80%
=======================================
Files 63 63
Lines 7005 7009 +4
=======================================
+ Hits 6921 6925 +4
Misses 84 84
Continue to review full report at Codecov.
|
Hi @TonyRippy thank you! So I actually doubled down on that an hour ago 😆, which is why there is a conflict now. You surely noticed that we do this so we don't have those conditional imports all over the place. Single source of truth and all that jazz. As you mentioned in that other issue, my first take would be that pyright should get this right. Pretty sure we are not alone in doing this.
|
Thanks for taking a look!
AFAIK, it's only the
I only noticed pyright failures in |
microsoft/pyright#3025 (comment) is the full list of typing members that are affected by this issue.
|
Hey @TonyRippy, please review #658. i took the liberty of doing a minimal change while hopefully accommodating pyright. Let me know if that works for you. |
accommodate pyright limitations #657
superceded by #658 |
Hello, thank you for all your hard work on drf-spectacular!
At Materialize, we currently use pyright as our static type checker. In the most recent update, we ran into an issue (microsoft/pyright#3044) that the pyright authors are declining to fix. As a result
OpenApiParameter.QUERY
,PATH
, etc. are not being typed correctly and fail validation.This PR works around the issue by importing from the
typing
module directly instead of indirectly through thedrainage
module. Is this something you'd be willing to consider?