Skip to content

Drop Python 3.9 support#2998

Merged
arkid15r merged 14 commits intovacanza:devfrom
PPsyrius:python_39_deprecation
Oct 30, 2025
Merged

Drop Python 3.9 support#2998
arkid15r merged 14 commits intovacanza:devfrom
PPsyrius:python_39_deprecation

Conversation

@PPsyrius
Copy link
Copy Markdown
Collaborator

@PPsyrius PPsyrius commented Oct 9, 2025

Proposed change

  • Drops Python 3.9 support due to its impending EOL status as of October 2025 - I'm waiting for the final deprecation notice before marking this as ready.
  • Upgrades syntax to Python 3.10 standard (mainly PEP 604 and dropping importlib-metadata which is now built-in as importlib.metadata).
  • Remove zipp>=3.19.1 pinning in dev and test requirements (from what I understand, this was previously only used by importlib-metadata).

Type of change

  • New country/market holidays support (thank you!)
  • Supported country/market holidays update (calendar discrepancy fix, localization)
  • Existing code/documentation/test/process quality improvement (best practice, cleanup, refactoring, optimization)
  • Dependency update (version deprecation/pin/upgrade)
  • Bugfix (non-breaking change which fixes an issue)
  • Breaking change (a code change causing existing functionality to break)
  • New feature (new holidays functionality in general)

Checklist

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Oct 9, 2025

Summary by CodeRabbit

Release Notes

  • Chores

    • Dropped Python 3.9 support; minimum required version is now Python 3.10
    • Updated CI/CD pipelines, build tools, and test configurations to reflect new version requirements
    • Consolidated and optimized dependency specifications
  • Refactor

    • Modernized type annotations throughout the codebase using PEP 604 union syntax (e.g., X | None instead of Optional[X])
    • Simplified import statements by removing obsolete type compatibility layers

Walkthrough

Removed Python 3.9 support and updated tooling targets to >=3.10; migrated many typing annotations from typing.Optional/typing.Union to PEP 604 union syntax (X | None, A | B). Changes are signature/import-only; runtime logic unchanged.

Changes

Cohort / File(s) Summary of changes
CI & tooling
.github/workflows/ci-cd.yml, tox.ini, pyproject.toml, .pre-commit-config.yaml, requirements/dev.txt, requirements/tests.txt
Removed Python 3.9 from test matrices and classifiers; bumped requires-python to >=3.10; updated pyupgrade/ruff target versions; adjusted test dependency pins and removed zipp pin.
Core framework & utilities
holidays/holiday_base.py, holidays/observed_holiday_base.py, holidays/utils.py, holidays/registry.py, holidays/ical.py, holidays/mixins/child_entity.py, holidays/holiday_base.py
Replaced Optional/Union with PEP 604 unions across public/internal aliases, attributes and method signatures (e.g., _add_holiday, get_closest_holiday, ObservedRule, ICalExporter.generate, registry returns).
Calendars
holidays/calendars/* (e.g., .../balinese_saka.py, .../buddhist.py, .../burmese.py, .../chinese.py, .../hebrew.py, .../hindu.py, .../mandaean.py, .../mongolian.py, .../persian.py, .../sinhala.py, .../thai.py, .../tibetan.py)
Converted many return and tuple annotations from Optional[...]/Union[...] to `date
Groups
holidays/groups/* (e.g., .../balinese_saka.py, .../buddhist.py, .../burmese.py, .../chinese.py, .../eastern.py, .../hebrew.py, .../hindu.py, .../mandaean.py, .../mongolian.py, .../persian.py, .../sinhala.py, .../thai.py, .../tibetan.py)
Updated many _add_* helpers and internal APIs to PEP 604 unions for optional dates and union params (e.g., `int
Countries
holidays/countries/* (e.g., .../angola.py, .../guernsey.py, .../jersey.py, .../taiwan.py, .../united_kingdom.py, .../united_states.py)
Replaced Optional/Union types with `
Scripts & tests
scripts/archive_links.py, tests/test_package.py
Switched script/test type hints from Optional[...] to `X

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Points to check during review:

  • Observed/holiday APIs in holidays/observed_holiday_base.py and callers for any missed compatible annotations.
  • Public API signatures in holidays/holiday_base.py, holidays/utils.py to ensure downstream type consumers are compatible.
  • CI/tooling and packaging changes (pyproject.toml, workflows, tox) for intended Python-version targeting.

Possibly related PRs

Suggested reviewers

  • arkid15r
  • KJhellico

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title "Drop Python 3.9 support" is directly aligned with the primary objective of this changeset. The pull request comprehensively addresses Python 3.9 deprecation across multiple files including CI/CD workflows, project configuration, type annotations, and dependency requirements. The title is concise, specific, and clearly communicates the main change without unnecessary detail or vague language.
Description Check ✅ Passed The description meaningfully relates to the changeset by explaining the rationale for dropping Python 3.9 (impending EOL), identifying the key syntax upgrades (PEP 604 union types), and noting dependency cleanup (zipp removal). It provides concrete context about the changes rather than vague generalities, directly connecting the PR's scope to its implementation across workflows, configuration files, and type annotations.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0dad4d4 and bc28527.

📒 Files selected for processing (2)
  • .github/workflows/ci-cd.yml (0 hunks)
  • requirements/dev.txt (0 hunks)
💤 Files with no reviewable changes (2)
  • .github/workflows/ci-cd.yml
  • requirements/dev.txt
⏰ Context from checks skipped due to timeout of 300000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Test docs build
  • GitHub Check: Build distribution

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link
Copy Markdown

codecov bot commented Oct 9, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (21adbcf) to head (bc28527).
⚠️ Report is 1 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff            @@
##               dev     #2998   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          306       306           
  Lines        18064     18030   -34     
  Branches      2333      2333           
=========================================
- Hits         18064     18030   -34     

☔ View full report in Codecov by Sentry.
📢 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.

Copy link
Copy Markdown
Collaborator

@arkid15r arkid15r left a comment

Choose a reason for hiding this comment

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

It seems this one is ready for merging when time comes.
Will take another look closer to the next release date.

@PPsyrius PPsyrius marked this pull request as ready for review October 30, 2025 06:11
@PPsyrius PPsyrius requested a review from KJhellico as a code owner October 30, 2025 06:11
@sonarqubecloud
Copy link
Copy Markdown

@PPsyrius
Copy link
Copy Markdown
Collaborator Author

IMO, considering that https://devguide.python.org/versions/ won't specify the specific dates, and that our next release won't be out until November anyway - it's probably safe to merge this in now, PTAL 🙏

@PPsyrius PPsyrius requested a review from arkid15r October 30, 2025 06:13
Copy link
Copy Markdown
Collaborator

@KJhellico KJhellico left a comment

Choose a reason for hiding this comment

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

LGTM.

Copy link
Copy Markdown
Collaborator

@arkid15r arkid15r left a comment

Choose a reason for hiding this comment

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

IMO, considering that https://devguide.python.org/versions/ won't specify the specific dates, and that our next release won't be out until November anyway - it's probably safe to merge this in now, PTAL 🙏

Sounds reasonable 👍

@arkid15r arkid15r added this pull request to the merge queue Oct 30, 2025
Merged via the queue into vacanza:dev with commit 120f0f8 Oct 30, 2025
33 checks passed
@PPsyrius PPsyrius deleted the python_39_deprecation branch October 31, 2025 02:44
@arkid15r arkid15r mentioned this pull request Nov 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants