-
Notifications
You must be signed in to change notification settings - Fork 14.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
Support stdlib zoneinfo.ZoneInfo (new in Python 3.10) #19450
Comments
👍, but it's arguably a DAG breaking change to replace pendulum, since all the dates exposed via the (template) context are Pendulum instances, and I know I've used pendulum specific methods on those data objects in python operators |
Yet another reason to start thinking about Airlfow 3 ? (just saying). |
Yeah I don’t think replacing Pendulum is viable now (it would be a big undertaking), the most reasonable approach for the moment would be to simp[ly accept |
Is there any reason for this? |
As a user of Airflow I would like to point out two use cases that will make transitioning off Pendulum difficult for users:
As an example, this is a macro I commonly write (usually as part of a filepath construction or something):
The formatting is easy to migrate (although not as nice) but I don't think there's anything in regular Python that makes it easy to switch the time zone of datetime correctly. |
|
I foresee three main hurdles with converting from
There are definitely fractional second formatting using I'm not saying migrating moving off Pendulum will be impossible, just raising that for at least some users it will not be pain free. |
From the recent Pendulum PRs (#34744 and #34683) I’m starting to really want to remove our reliance on Pendulum-specific timezones in Airflow core. Pendulum will still be used as the implementation, but we switch to only use standard tzinfo interface instead. Want to get a feel if this is viable and/or worthwhile. Any thoughts? @Taragolis @bolkedebruin |
I think Pendulum 3 is switching to using the default provided timezones, system and then pytz in that order, anyway. Note: there is no such thing as the standard tzinfo interface. Pendulum 2 by default also used pytz timezones through a package , which just wasn't updated frequently and can use the system provided ones. I'd prefer keep using Pendulum's interface as that at least is consistent within (-: major releases. |
There is a tzinfo (and timezone) interface, and it is in the stdlib. The problem is pendulum and pytz does not follow that. |
yes it is in stdlib, but it does not have a standard interface in the way of 'what you see is what you get'. tzname() is a prime example. The documentation reads that it will return a timezone name, but PST is not a timezone name. So the problem is that the stdlib does not stipulate sufficiently what needs to be done. |
Body
Python 3.10 introduced
zoneinfo
which covers usages ofpendulum.tz
(for Airflow uses, from what I can tell). Airflow should supportzoneinfo.ZoneInfo
for all places where it currently usespendulum.tz.Timezone
. This should be a good first step to phase out Pendulum from Airflow.The module is also backported as
backports.zoneinfo
to Python 3.6+, but it's probably not a priority to replace Pendulum usages with it for now.Committer
The text was updated successfully, but these errors were encountered: