-
Notifications
You must be signed in to change notification settings - Fork 16.4k
Always use Literal from typing_extensions #33794
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
Always use Literal from typing_extensions #33794
Conversation
airflow/models/taskinstance.py
Outdated
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.
TypeGuard also presented in our airflow.typing_compat so we might want to use two imports here:
from typing_extensions import Literal
from airflow.typing_compat import TypeGuardThere 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.
Yes.
ed9d450 to
cc1ffc2
Compare
cc1ffc2 to
7fec822
Compare
|
I hope I've finally finish rebasing and resolve conflicts 🤣 |
I will wait your PR before merging the other PRs |
|
No problem, that was just funny. |
|
Flaky test, you can merge it if there is nothing to change. |
|
Why is typing_extension used unconditionally instead of only for 3.10.1+ (or more conveniently just 3.11+)? |
For provider just for do not write something this condition everywhere, seem like we save to use until we can get rid of it. For core, maybe here we should use such condition, and I was merge before got additional review comments 😞 |
|
Should I do that? (Asking in case you’re already doing it) |
|
I could do that. |
During the removing support of Python 3.7 #30963, we incidentally create this block
This PR fix by use everywhere
from typing_extension import Literalinstead offrom typing import Literalfrom airflow.typing_compat import LiteralIn additional
Literalhas other known bugs which finally resolved in Python 3.10.1+, so personally I thought that better just usefrom typing_extension import Literalrather than outairflow.typing_compatresolver^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named
{pr_number}.significant.rstor{issue_number}.significant.rst, in newsfragments.