-
Notifications
You must be signed in to change notification settings - Fork 523
Backport zoneinfo logic into dateutil.tz.tzfile #1130
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
|
@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:
|
|
Hey @pganssle, you said that this PR "is really not that hard for a motivated individual to finish". After two years since my last comment, I think I've become motivated enough :D I've started by rebasing this branch against However, I am kind of stuck on the list of "things left to do", so maybe you can comment on some things:
I assume this means that V2 (and V3) tests are ready? If so, where can I find them? I am a bit lost looking at huge Also, does this still mean that it would be enough to backport https://github.com/pganssle/zoneinfo/blob/666d80c27bda69541130758bbc7f1c9e035f79a0/tests/test_zoneinfo.py?
Do you mean
I guess I know how to do this in GitHub Actions, but do you have guidance on how to enable developers to test this, too? I will take my time to properly understand the changes in this PR, so no rush with your reply :) |
dateutil still isn't ready. Bug: https://bugs.gentoo.org/747538 Bug: dateutil/dateutil#1059 Bug: dateutil/dateutil#1091 Bug: dateutil/dateutil#1130 Signed-off-by: Sam James <sam@gentoo.org>
Summary of changes
This moves
tzfileinto its own submodule containing what is effectively a backport of the pure python implementation ofzoneinfo.ZoneInfo, but with the semantics of adateutil.tz.tzfileobject.The major differences from zoneinfo are:
tz.gettzrather than intz.tzfile.tzfileobjects are pickled by value, not by reference to the IANA key.tzfilehas equality-by-value semantics, whereaszoneinfohas equality-by-identity semantics.This does change the internal implementation details of the class. It also fixes at least two bugs:
dateutildid not use thefoldattribute 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
tzfilecould fall back to atz.tzstror some othertz.tzrange, or we could refactortzstrandtzrangein terms of _CalendarOffset, _DayOffset and _TZStr (or both, by refactoring the internal logic oftzstrand/ortzrange).Closes #462, #1059
Open Tasks:
keyparameter for consistency withzoneinfo.ZoneInfoTZPATHtzdatablack(at least trying to be incremental here when we can...)Pull Request Checklist