Skip to content
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

RFE: use zoneinfo instead of pytz #98

Open
kloczek opened this issue May 30, 2024 · 3 comments · May be fixed by #107
Open

RFE: use zoneinfo instead of pytz #98

kloczek opened this issue May 30, 2024 · 3 comments · May be fixed by #107

Comments

@kloczek
Copy link

kloczek commented May 30, 2024

Switch to standard zoneinfo module.
Below may help pydantic/pydantic-core@fd262933

[tkloczko@pers-jacek dirty-equals-0.7.1]$ grep -r pytz
dirty_equals/_datetime.py:    Instantiate a `ZoneInfo` object from a string, falling back to `pytz.timezone` when `ZoneInfo` is not available
dirty_equals/_datetime.py:            import pytz
dirty_equals/_datetime.py:            raise ImportError('`pytz` or `zoneinfo` required for tz handling') from e
dirty_equals/_datetime.py:            return pytz.timezone(tz)  # type: ignore[return-value]
dirty_equals/_datetime.py:                (or `pytz.timezone` on 3.8) to get a timezone,
requirements/linting.in:types-pytz
requirements/linting.txt:types-pytz==2023.3.1.1
requirements/tests.in:pytz
requirements/tests.txt:pytz==2023.3.post1
tests/test_datetime.py:import pytz
tests/test_datetime.py:            pytz.timezone('Europe/London').localize(datetime(2022, 2, 15, 15, 15)),
tests/test_datetime.py:                approx=pytz.timezone('America/New_York').localize(datetime(2022, 2, 15, 10, 15)), enforce_tz=False
tests/test_datetime.py:            pytz.timezone('Europe/London').localize(datetime(2022, 2, 15, 15, 15)),
tests/test_datetime.py:            IsDatetime(approx=pytz.timezone('America/New_York').localize(datetime(2022, 2, 15, 10, 15))),
@samuelcolvin
Copy link
Owner

We'll have to continue to use pytz until we drop support for 3.8. are you sure it makes sense to switch now.

@kloczek
Copy link
Author

kloczek commented May 30, 2024

Pointed commit shows how to handle 3.8 (plus my comment pydantic/pydantic-core@fd262933#r142482296)

@samuelcolvin
Copy link
Owner

PR welcome to adopt zoneinfo.

@FBruzzesi FBruzzesi linked a pull request Sep 15, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants