8000 DEPS/TST: tzdata is optional, not required by lithomas1 · Pull Request #47467 · pandas-dev/pandas · GitHub
[go: up one dir, main page]

Skip to content

DEPS/TST: tzdata is optional, not required #47467

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

Merged
merged 17 commits into from
Aug 12, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
update
  • Loading branch information
lithomas1 committed Aug 3, 2022
commit eba2fb92b097daba2a84ee7558e3dcdea3f2e6a1
14 changes: 9 additions & 5 deletions doc/source/getting_started/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -273,11 +273,15 @@ the method requiring that dependency is called.
Timezones
^^^^^^^^^

========================= ================== =============================================================
Dependency Minimum Version Notes
========================= ================== =============================================================
tzdata 2022.1 Allows the use of ``zoneinfo`` timezones with pandas
========================= ================== =============================================================
========================= ========================= =============================================================
Dependency Minimum Version Notes
========================= ========================= =============================================================
tzdata 2022.1(pypi)/ Allows the use of ``zoneinfo`` timezones with pandas.
2022a(for system tzdata) **Note**: You only need to install the pypi package, if your
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like the 2022a is a conda forge package?
https://anaconda.org/conda-forge/tzdata
https://github.com/eggert/tz

Which is a different project from tzdata (2022.1).
https://pypi.org/project/tzdata/#history
https://github.com/python/tzdata

I'm not sure it's a good idea to recommend 2 differently maintained packages here. Can we just recommend the pypi one since it's the once recommended in the official docs https://docs.python.org/3/library/zoneinfo.html#data-sources?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we'd still want to state a min version for system tzdata for consistency. 2022a is also the version of the actual IANA tz db(it's python's tzdata versioning scheme that's different).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah okay sounds reasonable then. Might be good then to mention that the system tzdata can be updated by installing the conda forge package?

system does not already provide the IANA tz database.
However, the minimum tzdata version still applies, even if it
is not enforced through an error.
========================= ========================= =============================================================

Visualization
^^^^^^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ dependencies:
- scipy
- sqlalchemy
- tabulate
- tzdata>=2022.1
- tzdata>=2022a
- xarray
- xlrd
- xlsxwriter
Expand Down
4 changes: 3 additions & 1 deletion pandas/_libs/tslibs/timezones.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ try:
# py39+
import zoneinfo
from zoneinfo import ZoneInfo
import_optional_dependency("tzdata", errors="raise", min_version="2022.1")
except ImportError:
zoneinfo = None
ZoneInfo = None
Expand Down Expand Up @@ -70,6 +69,9 @@ cdef inline bint is_utc_zoneinfo(tzinfo tz):
utc_zoneinfo = ZoneInfo("UTC")
except zoneinfo.ZoneInfoNotFoundError:
return False
# Warn if tzdata is too old, even if there is a system tzdata to alert
# users about the mismatch between local/system tzdata
import_optional_dependency("tzdata", errors="warn", min_version="2022.1")

return tz is utc_zoneinfo

Expand Down
4 changes: 3 additions & 1 deletion scripts/generate_pip_deps_from_conda.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import yaml

EXCLUDE = {"python", "c-compiler", "cxx-compiler"}
REMAP_VERSION = {"tzdata": "2022.1"}
RENAME = {"pytables": "tables", "geopandas-base": "geopandas", "pytorch": "torch"}


Expand All @@ -41,7 +42,8 @@ def conda_package_to_pip(package: str):
pkg, version = package.split(compare)
if pkg in EXCLUDE:
return

if pkg in REMAP_VERSION:
return "".join((pkg, compare, REMAP_VERSION[pkg]))
if pkg in RENAME:
return "".join((RENAME[pkg], compare, version))

Expand Down
0