Skip to content

refactor: remove pytz and use standard library zoneinfo#2023

Open
waketzheng wants to merge 13 commits intotortoise:developfrom
waketzheng:replace-pytz
Open

refactor: remove pytz and use standard library zoneinfo#2023
waketzheng wants to merge 13 commits intotortoise:developfrom
waketzheng:replace-pytz

Conversation

@waketzheng
Copy link
Contributor

@waketzheng waketzheng commented Nov 30, 2025

Description

  1. Latest version of Django does not depends on pytz
  2. Python3.9 add a new module zoneinfo, which can be used to replace pytz

Motivation and Context

Reduce dependency suggested by #1956

How Has This Been Tested?

make ci

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added the changelog accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@codspeed-hq
Copy link

codspeed-hq bot commented Nov 30, 2025

Merging this PR will not alter performance

✅ 16 untouched benchmarks


Comparing waketzheng:replace-pytz (47847f8) with develop (2aa8e0d)

Open in CodSpeed

@coveralls
Copy link

coveralls commented Nov 30, 2025

Pull Request Test Coverage Report for Build 21782611814

Details

  • 27 of 29 (93.1%) changed or added relevant lines in 2 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage increased (+0.05%) to 84.036%

Changes Missing Coverage Covered Lines Changed/Added Lines %
tortoise/backends/oracle/client.py 1 2 50.0%
tortoise/timezone.py 26 27 96.3%
Files with Coverage Reduction New Missed Lines %
tortoise/timezone.py 1 83.33%
Totals Coverage Status
Change from base Build 21736468513: 0.05%
Covered Lines: 9980
Relevant Lines: 11464

💛 - Coveralls

@ockan
Copy link

ockan commented Dec 24, 2025

0.25.3 nothing changed

@waketzheng
Copy link
Contributor Author

0.25.3 nothing changed

@ockan This PR does not merge to develop branch yet. And it's a breaking change, will not release at 0.25.x, may be 0.26.0 or higher version (not promise)

@waketzheng
Copy link
Contributor Author

Before these PRs merged, you can use the slim branch for clean deps:

uv pip install -U "tortoise-orm @git+ssh://git@github.com/tortoise/tortoise-orm@slim"

# Or by http:
#uv pip install -U "tortoise-orm @git+https://github.com/tortoise/tortoise-orm@slim"

This branch only depends on pypika-tortoise

@waketzheng waketzheng marked this pull request as draft February 1, 2026 09:01
@waketzheng waketzheng changed the title refactor: use zoneinfo instead of pytz [WIP] refactor: use zoneinfo instead of pytz Feb 1, 2026
@waketzheng waketzheng changed the title [WIP] refactor: use zoneinfo instead of pytz refactor: move pytz to optional dependencies Feb 7, 2026
@waketzheng waketzheng marked this pull request as ready for review February 7, 2026 05:09
@abondar
Copy link
Member

abondar commented Feb 7, 2026

Is there any reason to keep pytz as even optional dependency?

@waketzheng waketzheng changed the title refactor: move pytz to optional dependencies refactor: remove pytz and use standard library zoneinfo Feb 7, 2026
@waketzheng
Copy link
Contributor Author

Is there any reason to keep pytz as even optional dependency?

Seem that is better to remove it. I updated code and add some tests.

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 this pull request may close these issues.

4 participants