-
-
Notifications
You must be signed in to change notification settings - Fork 776
➖ Only install typing_extensions
for Python '<3.9'
#1306
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
base: master
Are you sure you want to change the base?
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as outdated.
This comment was marked as outdated.
typing_extensions
for python '<3.10'typing_extensions
for Python '<3.10'
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.
Thanks for the PR! This makes sense to me. Just a few questions/comments:
- I removed bumping the dependencies as this was causing conflicts and CI errors. Let's keep the PR atomic (dealing with one functionality only).
- Why < 3.10? Looking at
_typing.py
, it seems liketyping_extensions
is only used up to and including 3.8. - What is a bit unfortunate is that many of our tutorial examples use
from typing_extensions import Annotated
. I worry that users won't be able to execute this code directly if they haven't gottyping_extensions
installed in their normaltyper
environment.
This comment was marked as outdated.
This comment was marked as outdated.
Hi @waketzheng, I see you're running into the same typing error we've encountered before: #1048 (comment) Basically this happens when reimporting |
typing_extensions
for Python '<3.10'typing_extensions
for Python '<3.9'
This comment was marked as outdated.
This comment was marked as outdated.
How about use |
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.
This PR looks good to me - it's a good idea not to install typing_extensions
when we don't need it for Python 3.9 and above.
What is a bit unfortunate is that many of our tutorial examples use from typing_extensions import Annotated. I worry that users won't be able to execute this code directly if they haven't got typing_extensions installed in their normal typer environment.
How about use
from typer._typing import Annotated
instead?
As I see it, our options are:
- keep the examples as they are, and update them to
from typing import Annotated
when we drop Python 3.8 - update the examples to
from typer._typing import Annotated
as you suggest but this feels like adding unnecessary complexity to the tutorial examples (exposing what should be an implementation detail) - we can have explicit Python 3.9+ examples for all tutorial examples, that import from
typing
instead. While I wouldn't mind working on this, it feels like a lot of wasted effort, especially if we plan on dropping Python 3.8 soon.
I'll leave this decision with Tiangolo 🙏
This comment was marked as resolved.
This comment was marked as resolved.
📝 Docs preview for commit a3bdc86 at: https://58407af1.typertiangolo.pages.dev |
Description
typing_extensions
for python '<3.10'