Skip to content

Remove (some) pytz compat code - #1472

Open
tomasr8 wants to merge 2 commits into
python-babel:masterfrom
tomasr8:pytz
Open

tomasr8 wants to merge 2 commits into
python-babel:masterfrom
tomasr8:pytz

Conversation

@tomasr8

@tomasr8 tomasr8 commented Nov 16, 2026

Copy link
Copy Markdown
Member

Babel currently prefers pytz over zoneinfo if it is installed. Now that all supported versions (3.9+) support zoneinfo I think we should default to zoneinfo instead.

In particular, Babel should stop creating pytz timezone objects regardless of the availability of pytz and always return zoneinfo instances instead. We should still accept user-supplied pytz timezones for backwards compatibility though.

@codecov

codecov Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 91.66667% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 93.98%. Comparing base (aeca9fa) to head (b489f1b).

Files with missing lines Patch % Lines
babel/localtime/_helpers.py 80.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1472      +/-   ##
==========================================
+ Coverage   93.67%   93.98%   +0.30%     
==========================================
  Files          27       27              
  Lines        4983     4957      -26     
==========================================
- Hits         4668     4659       -9     
+ Misses        315      298      -17     
Flag Coverage Δ
macos-26-3.10 93.06% <91.66%> (+0.30%) ⬆️
macos-26-3.11 92.99% <91.66%> (+0.30%) ⬆️
macos-26-3.12 93.26% <91.66%> (+0.30%) ⬆️
macos-26-3.13 93.26% <91.66%> (+0.30%) ⬆️
macos-26-3.14 93.24% <91.66%> (+0.30%) ⬆️
macos-26-3.15 93.24% <91.66%> (+0.30%) ⬆️
macos-26-3.9 92.99% <91.66%> (+0.30%) ⬆️
macos-26-pypy3.11 92.99% <91.66%> (+0.30%) ⬆️
macos-26-pypy3.12 93.26% <91.66%> (+0.30%) ⬆️
ubuntu-24.04-3.10 93.08% <91.66%> (+0.30%) ⬆️
ubuntu-24.04-3.11 93.01% <91.66%> (+0.30%) ⬆️
ubuntu-24.04-3.12 93.28% <91.66%> (+0.30%) ⬆️
ubuntu-24.04-3.13 93.28% <91.66%> (+0.30%) ⬆️
ubuntu-24.04-3.14 93.26% <91.66%> (+0.30%) ⬆️
ubuntu-24.04-3.15 93.26% <91.66%> (+0.30%) ⬆️
ubuntu-24.04-3.9 93.01% <91.66%> (+0.30%) ⬆️
ubuntu-24.04-pypy3.11 93.01% <91.66%> (+0.30%) ⬆️
ubuntu-24.04-pypy3.12 93.28% <91.66%> (+0.30%) ⬆️
windows-2025-3.10 93.19% <75.00%> (+0.42%) ⬆️
windows-2025-3.11 93.13% <75.00%> (+0.42%) ⬆️
windows-2025-3.12 93.39% <75.00%> (+0.42%) ⬆️
windows-2025-3.13 93.39% <75.00%> (+0.42%) ⬆️
windows-2025-3.14 93.37% <75.00%> (+0.42%) ⬆️
windows-2025-3.15 93.37% <75.00%> (+0.42%) ⬆️
windows-2025-3.9 93.12% <75.00%> (+0.42%) ⬆️
windows-2025-pypy3.11 93.13% <75.00%> (+0.42%) ⬆️
windows-2025-pypy3.12 93.39% <75.00%> (+0.42%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@codspeed

codspeed Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 88 untouched benchmarks


Comparing tomasr8:pytz (b489f1b) with master (aeca9fa)

Open in CodSpeed

This branch has not been deployed

No deployments
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.

1 participant