-
Notifications
You must be signed in to change notification settings - Fork 14.4k
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
Always use Literal from typing_extensions #33794
Conversation
airflow/models/taskinstance.py
Outdated
@@ -65,6 +65,7 @@ | |||
from sqlalchemy.orm.session import Session | |||
from sqlalchemy.sql.elements import BooleanClauseList | |||
from sqlalchemy.sql.expression import ColumnOperators, case | |||
from typing_extensions import Literal, TypeGuard |
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 TypeGuard
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.
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 Literal
instead offrom typing import Literal
from airflow.typing_compat import Literal
In additional
Literal
has other known bugs which finally resolved in Python 3.10.1+, so personally I thought that better just usefrom typing_extension import Literal
rather than outairflow.typing_compat
resolver^ 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.rst
or{issue_number}.significant.rst
, in newsfragments.