-
Notifications
You must be signed in to change notification settings - Fork 482
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
Backport zoneinfo logic into dateutil.tz.tzfile #1130
base: master
Are you sure you want to change the base?
Conversation
@pganssle do you want me to review this? |
@mariocj89 I still need to backport the tests, but you are welcome to review it. I expect in the long run we'll want to consolidate some of the logic around Also I believe some documentation changes will be necessary before we can merge this as well. |
OK, I'll take a look once all is ready. |
So @mariocj89 I suppose this is really the only remaining blocker for dropping support for Python 2? Dropping support for Python 2 would mean we could get into in-place typing info and all the new fun stuff right :)? Given this has been open for ages, should I try to prioritize this MR, open a new MR and see if we can get somewhere within the next few months? |
+1 |
Hi @mariocj89,
|
Without this change users in 2.7 will not get tz upgrades. This splits the tzdata from the package, allowing users to stay in an old version of the package but still get tzdata upgrades.
Correct
Needs to work for py2, so no type hints :). |
Now it completely makes sense! Thanks. |
@mariocj89 to improve visibility on the progress & smoothen the process a little. Can we open a new branch containing this work so far? I was diving a bit further (as I want to make sure I understand the full context before making changes) and was wondering the following: |
@pganssle are you still actively working on getting this change merged? |
Unfortunately I don't have the time anymore to work on this and made zero progress anyway. So I don't think anyone is working on this. The code is very complex and you are only doing this for python 2 users. Given that reached end of life years ago, I'm not to enthusiastic to work on this anyway. |
24c8f99
to
4d4bafa
Compare
06dd279
to
e362489
Compare
Made a lot of progress on this at the sprints, but I don't think I'm going to quite get there today. I believe the main things left to do are:
|
Summary of changes
This moves
tzfile
into its own submodule containing what is effectively a backport of the pure python implementation ofzoneinfo.ZoneInfo
, but with the semantics of adateutil.tz.tzfile
object.The major differences from zoneinfo are:
tz.gettz
rather than intz.tzfile
.tzfile
objects are pickled by value, not by reference to the IANA key.tzfile
has equality-by-value semantics, whereaszoneinfo
has equality-by-identity semantics.This does change the internal implementation details of the class. It also fixes at least two bugs:
dateutil
did not use thefold
attribute during gaps (only during folds), in violation of PEP 495. This fixes that, but that does change the semantics of imaginary times a bit (and thus may affect some mechanisms for detecting imaginary times).This is mostly a code dump with compatibility adjustments. It's quite possible that we'll want to refactor, particularly with respect to the way POSIX strings are handled. Theoretically
tzfile
could fall back to atz.tzstr
or some othertz.tzrange
, or we could refactortzstr
andtzrange
in terms of _CalendarOffset, _DayOffset and _TZStr (or both, by refactoring the internal logic oftzstr
and/ortzrange
).Closes #462, #1059
Open Tasks:
key
parameter for consistency withzoneinfo.ZoneInfo
TZPATH
tzdata
black
(at least trying to be incremental here when we can...)Pull Request Checklist