-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Use tz.gettz() instead of zoneinfo.gettz() #9123
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
Conversation
the is an api issue for dateutil the current settings work on all platforms pandas should not be fixing the problem rather dateutil should |
@jlec so this completely breaks windows. That is the reason I changed it in the first place. That said if you wanted to put in different imports (e.g. use the current code if on windows, else use what you did). I think that would be acceptable, until dateutil actually fixes this. lmk |
@jlec any interest in doing the change I propose above? |
@jreback I didn't saw your direct reply. I will look into this this week. |
@jreback which way do you prefer to check for windows, os.name or sys.platform? |
use sys.platform != 'win32' |
Sorry for the long delay. Somehow I don't get mails from GH correctly |
@@ -5021,7 +5021,10 @@ def test_getitem_setitem_datetime_tz_pytz(self): | |||
def test_getitem_setitem_datetime_tz_dateutil(self): | |||
tm._skip_if_no_dateutil(); | |||
from dateutil.tz import tzutc | |||
from dateutil.zoneinfo import gettz | |||
if sys.platform != 'win32': |
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.
maybe make a function in pandas/compat/__init__.py
like: is_platform_windows()/mac/linux
just for convenience
@jlec can you update? |
It's not the wrong rebase, I have a merge commit. I will try to clean that up. |
5810306
to
cef371b
Compare
ok, pls add a release note in v0.17.0.txt mentioned all the above issues (you can just list them with a single note). and squash to a single commit. |
d638212
to
6dedd02
Compare
python-dateutil provides two implementations for gettz(), tz.gettz() and zoneinfo.gettz(). The former tries first to use system provided timezone data, where as the later always uses a bundled tarball. Upstreams recommandation for library consumers is only using tz.gettz() (1 & 2). Further more, on system which do not install the zoninfo tarball (e.g. Debian, Gentoo and Fedora) but rely on the system zoneinfo files the direct usage of zoneinfo.gettz() creates problems which result in test failures (3 - 6). For compatibility in pandas code pandas.tslib._dateutil_gettz() should be used. 1 dateutil/dateutil#8 2 dateutil/dateutil#11 3 pandas-dev#9059 4 pandas-dev#8639 5 pandas-dev#10121 6 pandas-dev#9663 Signed-off-by: Justin Lecher <[email protected]>
Hopefully everything is now respecting the contribution guidelines. If not, please tell me what needs to be fixed. |
ok, ping me when travis is green and I will merge. |
@jlec thanks. |
zoneinfo.gettz() seems to have problems (1 & 2) on system which do not install
the zoninfo tarball (e.g. Debian, Gentoo and Fedora) but rely on the system
zoneinfo files. This results in test failures (3 & 4)
tz.gettz() doesn't suffer from this problem.
1 dateutil/dateutil#8
2 dateutil/dateutil#11
closes #9059
closes #8639
closes #10121
Signed-off-by: Justin Lecher [email protected]