-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
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 support for strings and __future__ annotations #451
Conversation
Nice! Good job!
No problem with that. We bump the version to release it.
Perfect. Let me know when you can check those things. |
@tiangolo Thanks for the feedback! I actually discussed this with Ivan Levkivskyi on the python/typing gitter, and he suggested I make a bpo post (which I did here: https://bugs.python.org/issue37923). So far it hasn't gotten much attention 😕 but I figured I'd at least ask the question. Having dug a little more into the various related PEPs and python stdlib source, I feel pretty good about the approach in this PR, so I'm inclined to run with it, and just add more edge-case handling and tests for them. Hopefully in the future there will be first class support for this built directly into the I'll try to get this into a mergeable state this weekend. |
495f6ea
to
8d3f05a
Compare
@tiangolo I reworked the implementation, and now it should be 100% backward compatible (no changes to the annotations in the case of optionals, etc.), and only change any of the behavior when string-valued annotations are present. (And the only behavior change will be that it works instead of raising errors.) |
8d3f05a
to
e071ee5
Compare
Codecov Report
@@ Coverage Diff @@
## master #451 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 251 251
Lines 5988 6001 +13
=====================================
+ Hits 5988 6001 +13
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #451 +/- ##
==========================================
- Coverage 100% 99.83% -0.17%
==========================================
Files 251 251
Lines 5988 5899 -89
==========================================
- Hits 5988 5889 -99
- Misses 0 10 +10
Continue to review full report at Codecov.
|
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.
Awesome job! 🎉 🚀
I think it's fine to leave the tests with your modifications and test both things at the same time. I just requested comments on top of them to remind us to not "refactor" them into their non-string version.
e071ee5
to
59d59ee
Compare
c952af6
to
a8fa981
Compare
|
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.
Awesome! Thanks a lot!
LGTM 🎉 🚀
This pull request adds support for forward references, string annotations, and
from __future__ import annotations
in decorated endpoint signatures.