Migrate to uv for dependency management#3101
Conversation
Summary by CodeRabbitRelease Notes
✏️ Tip: You can customize this high-level summary in your review settings. WalkthroughReplaces pip/requirements-based dependency management and CI steps with UV-based tooling (astral-sh/setup-uv, Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes
Possibly related PRs
Suggested labels
Suggested reviewers
Pre-merge checks and finishing touches✅ Passed checks (5 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
⛔ Files ignored due to path filters (1)
uv.lockis excluded by!**/*.lock
📒 Files selected for processing (13)
.github/workflows/ci-cd.yml(5 hunks).github/workflows/update-snapshots.yml(1 hunks)CONTRIBUTING.md(1 hunks)MANIFEST.in(0 hunks)Makefile(1 hunks)make.cmd(2 hunks)pyproject.toml(1 hunks)requirements/build.txt(0 hunks)requirements/dev.txt(0 hunks)requirements/docs.txt(0 hunks)requirements/runtime.txt(0 hunks)requirements/tests.txt(0 hunks)tox.ini(2 hunks)
💤 Files with no reviewable changes (6)
- requirements/build.txt
- MANIFEST.in
- requirements/runtime.txt
- requirements/docs.txt
- requirements/dev.txt
- requirements/tests.txt
🧰 Additional context used
🧠 Learnings (12)
📓 Common learnings
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2608
File: holidays/countries/saint_vincent_and_the_grenadines.py:30-30
Timestamp: 2025-06-07T07:37:55.516Z
Learning: For the vacanza/holidays repository, defer to the ruff configuration and pre-commit checks for coding standards rather than making manual suggestions about line length or style issues. If the automated checks pass, the code follows the project's standards.
📚 Learning: 2025-11-17T05:45:27.759Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 3062
File: scripts/generate_snapshots.py:69-80
Timestamp: 2025-11-17T05:45:27.759Z
Learning: The vacanza/holidays project requires Python 3.10+ as of November 2025 (specified in pyproject.toml as "requires-python = ">=3.10""). Python 3.9 support has been deprecated.
Applied to files:
pyproject.toml
📚 Learning: 2025-04-26T19:55:09.581Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2501
File: scripts/docs/gen_index.py:1-12
Timestamp: 2025-04-26T19:55:09.581Z
Learning: The holidays project uses a standard header for all Python (.py) files in the repository that describes the overall holidays library, including authors, website and license information, regardless of the specific purpose of individual script files.
Applied to files:
pyproject.toml
📚 Learning: 2025-09-15T15:54:52.871Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2929
File: scripts/generate_release_notes.py:82-82
Timestamp: 2025-09-15T15:54:52.871Z
Learning: The vacanza/holidays project requires Python 3.9+ and uses PyGithub 2.8.1, so there's no need for backward compatibility with PyGithub 1.x when reviewing authentication code.
Applied to files:
pyproject.toml
📚 Learning: 2025-06-05T09:31:22.753Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2599
File: holidays/countries/__init__.py:193-193
Timestamp: 2025-06-05T09:31:22.753Z
Learning: For the holidays Python library, when encountering line length or formatting issues, suggest contributors run `make pre-commit` to auto-format their files instead of providing specific manual formatting fixes like line splitting or noqa comments.
Applied to files:
CONTRIBUTING.md
📚 Learning: 2025-04-01T14:14:01.519Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2398
File: holidays/groups/islamic.py:301-301
Timestamp: 2025-04-01T14:14:01.519Z
Learning: Running `make pre-commit` in the holidays project can automatically fix common code style issues like whitespace in blank lines.
Applied to files:
CONTRIBUTING.mdtox.ini
📚 Learning: 2025-06-16T15:48:33.931Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2615
File: tests/countries/test_anguilla.py:20-24
Timestamp: 2025-06-16T15:48:33.931Z
Learning: The holidays project uses `make pre-commit` test which includes `ruff` as the primary linter. If `ruff` passes, then Pylint warnings that don't appear in `ruff` are considered acceptable and can be ignored.
Applied to files:
CONTRIBUTING.md
📚 Learning: 2025-04-05T04:47:27.213Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2416
File: tests/countries/test_turkmenistan.py:52-64
Timestamp: 2025-04-05T04:47:27.213Z
Learning: For holiday tests in the vacanza/holidays project, structure tests by individual holidays rather than by years. Each test method should focus on a specific holiday and test it across multiple years (from start_year through 2050) using helper methods like `assertHolidayName`. For fixed holidays, use generators like `(f"{year}-01-01" for year in range(1991, 2051))`. For movable holidays, specify individual dates for specific years followed by a range check.
Applied to files:
CONTRIBUTING.md
📚 Learning: 2025-04-05T04:29:38.042Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2416
File: tests/countries/test_turkmenistan.py:85-86
Timestamp: 2025-04-05T04:29:38.042Z
Learning: For testing holiday implementations in the vacanza/holidays repository, recommend using `from tests.common import CommonCountryTests` as the base class instead of directly using `unittest.TestCase` to maintain consistency with project conventions and leverage common test utilities.
Applied to files:
CONTRIBUTING.md
📚 Learning: 2025-06-16T15:48:48.680Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2615
File: tests/countries/test_anguilla.py:1-12
Timestamp: 2025-06-16T15:48:48.680Z
Learning: Test files in the holidays repository follow a standardized structure without module or class docstrings. All country test files use the same pattern: license header, imports, and class definition (`class Test{Country}(CommonCountryTests, TestCase):`) without docstrings. This is an established codebase convention that should be maintained for consistency.
Applied to files:
CONTRIBUTING.md
📚 Learning: 2025-03-26T22:40:52.932Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2375
File: snapshots/countries/AR_G.json:2-2008
Timestamp: 2025-03-26T22:40:52.932Z
Learning: Snapshot files in the `snapshots/` directory are automatically generated by `scripts/generate_snapshots.py` and are intended for internal use only. There is no point in analyzing or suggesting changes to their contents as they are not meant to be manually edited.
Applied to files:
.github/workflows/update-snapshots.yml
📚 Learning: 2025-06-05T18:24:26.712Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2600
File: holidays/countries/philippines.py:56-56
Timestamp: 2025-06-05T18:24:26.712Z
Learning: In the holidays repository, if code passes `make pre-commit` checks, then it's allowed regardless of individual static analysis tool warnings like Pylint line length violations. The pre-commit hooks are the definitive source of truth for their coding standards.
Applied to files:
tox.ini
🪛 checkmake (0.2.2)
Makefile
[warning] 47-47: Target body for "setup" exceeds allowed length of 5 (6).
(maxbodylength)
🪛 markdownlint-cli2 (0.18.1)
CONTRIBUTING.md
27-27: Code block style
Expected: fenced; Actual: indented
(MD046, code-block-style)
🔇 Additional comments (11)
CONTRIBUTING.md (1)
19-19: LGTM - helpful addition for Windows contributors.The WSL permission fix documentation is clear and actionable. The uv installation reference aligns well with the migration goals.
Also applies to: 25-58
tox.ini (2)
4-4: Good addition for improved test performance.Adding tox-uv aligns with the migration strategy and should provide faster environment setup.
12-13: Clean migration to extras-based dependency management.The switch from file-based deps to extras properly reflects the new pyproject.toml structure.
Also applies to: 19-21, 30-31
pyproject.toml (3)
43-43: Verify the relaxed version constraint for python-dateutil.Changed from an exact pin to
>=2.9.0.post0, which allows patch and minor updates. Ensure this aligns with compatibility testing.
44-77: Well-structured optional dependencies.The categorization into build, dev, docs, and tests extras is clear. Security pins with explanatory comments are good practice.
78-80: Useful metadata additions.Adding project URLs improves discoverability and follows modern packaging standards.
.github/workflows/update-snapshots.yml (1)
29-30: Clean migration to uv for snapshot generation.The workflow properly initializes a clean venv and syncs build dependencies before running the snapshot generation.
Also applies to: 33-33
Makefile (2)
48-51: Comprehensive setup target.The setup properly initializes a clean venv and syncs all necessary extras for development. The --link-mode=copy ensures proper file handling.
26-26: Consistent uv run migration across all targets.All make targets properly route commands through uv run, ensuring execution in the managed environment.
Also applies to: 30-31, 34-35, 38-38, 56-57, 60-61, 64-64
make.cmd (1)
29-29: Windows make script properly updated.All changes mirror the Makefile updates with appropriate Windows path separators. Consistent uv run usage throughout.
Also applies to: 46-47, 51-52, 56-56, 60-60, 64-65, 69-72, 78-79, 84-84, 88-88
.github/workflows/ci-cd.yml (1)
99-99: CI/CD workflow properly migrated to uv.The workflow consistently uses uv for dependency management and command execution across all test environments and platforms.
Also applies to: 102-102, 124-124, 127-127, 141-141, 179-185, 204-204
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #3101 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 306 306
Lines 18083 18083
Branches 2292 2292
=========================================
Hits 18083 18083 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (2)
.github/workflows/ci-cd.yml(5 hunks).github/workflows/update-snapshots.yml(1 hunks)
⏰ 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). (5)
- GitHub Check: Test Python 3.14 on windows-latest
- GitHub Check: Test Python 3.13 on windows-latest
- GitHub Check: Test Python 3.10 on windows-latest
- GitHub Check: Test Python 3.11 on windows-latest
- GitHub Check: Test Python 3.12 on windows-latest
🔇 Additional comments (5)
.github/workflows/update-snapshots.yml (2)
27-33: uv setup looks solid. Venv initialized cleanly, deps synced with build extras. Good foundation for the subsequent make invocation.
35-36: Snapshot generation via uv is correct. Theuv run make snapshotpattern properly invokes make within the uv-managed environment..github/workflows/ci-cd.yml (3)
98-105: Test job uv integration is correct. Proper sequencing: install uv, sync test extras, invoke make through uv.
179-191: test-build job flow is well-structured. Clean venv setup, dual-artifact testing (wheel then tarball), and proper uv command usage. Good coverage for package distribution validation.
206-213: test-docs job properly configured. uv installed, doc extras synced correctly with--extra docs, and make invoked through uv. Past review flagging--docsusage appears resolved.
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (3)
.github/workflows/ci-cd.yml(5 hunks).github/workflows/update-snapshots.yml(1 hunks)Makefile(1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-03-26T22:40:52.932Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2375
File: snapshots/countries/AR_G.json:2-2008
Timestamp: 2025-03-26T22:40:52.932Z
Learning: Snapshot files in the `snapshots/` directory are automatically generated by `scripts/generate_snapshots.py` and are intended for internal use only. There is no point in analyzing or suggesting changes to their contents as they are not meant to be manually edited.
Applied to files:
.github/workflows/update-snapshots.yml
🪛 checkmake (0.2.2)
Makefile
[warning] 47-47: Target body for "setup" exceeds allowed length of 5 (6).
(maxbodylength)
⏰ 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). (4)
- GitHub Check: Test Python 3.13 on windows-latest
- GitHub Check: Test Python 3.14 on windows-latest
- GitHub Check: Test Python 3.11 on windows-latest
- GitHub Check: Test Python 3.10 on windows-latest
🔇 Additional comments (1)
Makefile (1)
48-51: Setup target complexity is acceptable despite style analysis flag.Static analysis flags the
setuptarget body as exceeding 5 lines (currently 6), but this multi-line command with proper Makefile continuation syntax is legitimate and acceptable. No functional issue here.
There was a problem hiding this comment.
Actionable comments posted: 2
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/ci-cd.yml(5 hunks)
⏰ 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). (3)
- GitHub Check: Test Python 3.12 on windows-latest
- GitHub Check: Test Python 3.14 on windows-latest
- GitHub Check: Test Python 3.11 on windows-latest
🔇 Additional comments (1)
.github/workflows/ci-cd.yml (1)
98-105: uv migration flow looks solid.All four jobs (
test,build,test-build,test-docs) now properly install uv, runuv sync --extra <group>to pull dependencies, and useuv runto invoke commands. Prior critical issues (invalid flags, missing uv setup, bareuv install/uv uninstall) are addressed. The workflow is well-structured for reproducible builds.Also applies to: 126-133, 182-194, 209-216
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (4)
.github/workflows/ci-cd.yml(5 hunks).github/workflows/update-snapshots.yml(1 hunks)Makefile(1 hunks)make.cmd(2 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2608
File: holidays/countries/saint_vincent_and_the_grenadines.py:30-30
Timestamp: 2025-06-07T07:37:55.516Z
Learning: For the vacanza/holidays repository, defer to the ruff configuration and pre-commit checks for coding standards rather than making manual suggestions about line length or style issues. If the automated checks pass, the code follows the project's standards.
🪛 checkmake (0.2.2)
Makefile
[warning] 47-47: Target body for "setup" exceeds allowed length of 5 (6).
(maxbodylength)
⏰ 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). (4)
- GitHub Check: Test Python 3.13 on windows-latest
- GitHub Check: Test Python 3.12 on windows-latest
- GitHub Check: Test Python 3.14 on windows-latest
- GitHub Check: Test Python 3.11 on windows-latest
🔇 Additional comments (12)
.github/workflows/update-snapshots.yml (1)
27-36: Clean uv migration for snapshot workflow.The workflow correctly sets up uv, creates a fresh venv, syncs build dependencies, and runs the snapshot generation through uv. The
--link-mode=copyflag ensures dependencies are copied rather than symlinked, which is appropriate for CI environments..github/workflows/ci-cd.yml (4)
98-105: Test job properly migrated to uv.The test matrix correctly installs uv, syncs test dependencies, and runs tests through uv. The removal of pip caching is appropriate since uv manages its own cache.
126-147: Build and SBOM generation correctly use uv.The build job now properly installs uv before using it, syncs build dependencies, and executes both package building and SBOM generation through uv. Good to see the critical issue from the previous review was addressed.
182-194: Test-build job comprehensively validates distributions.This job creates a fresh venv, installs test dependencies, then validates both wheel and source distribution by installing and running tests for each. The use of
uv pip installanduv pip uninstallis correct syntax for pip-compatible operations within uv.
209-216: Docs build cleanly migrated to uv.The test-docs job correctly syncs documentation dependencies and builds docs through uv. The simpler setup without
check-latestis appropriate for documentation building as discussed in previous review.Makefile (5)
25-35: Documentation, localization, and packaging targets properly migrated.All three targets correctly use uv for execution:
docruns mkdocs through uvl10ngenerates .po and .mo files via uvpackageusesuv buildinstead ofpython -m buildThe migration maintains the original workflow logic while leveraging uv's environment management.
37-41: Pre-commit and release-notes targets use correct uv syntax.Both targets properly invoke their commands through
uv run, ensuring they execute within the project's managed environment. Good to see the@prefix issue from the previous review was resolved.
43-45: SBOM generation correctly uses uv tool infrastructure.The target syncs build dependencies then uses
uv tool runto execute cyclonedx-py without permanently installing it. The$(uv python find)command locates the managed Python interpreter. This is the recommended approach for running one-off tools with uv.
47-53: Setup target comprehensively configures development environment.The setup flow is well-structured:
- Creates a clean venv
- Syncs all dependency extras needed for development
- Installs pre-commit hooks
- Generates localization and package artifacts
The static analysis warning about body length is pedantic—six lines for a comprehensive setup target is reasonable and maintains clarity.
55-64: Snapshot, test, and tox targets correctly migrated.All three targets properly invoke their commands through
uv run:
snapshotgenerates localization files then creates test snapshotstestruns pytest with coverage and parallel executiontoxexecutes tox in parallel modeThe migration preserves all original flags and options while routing execution through uv's managed environment.
make.cmd (2)
28-53: Windows commands properly use backslash path separators.The Doc, L10n, and Package targets correctly adapt the Unix commands for Windows:
- Script paths use backslash (
scripts\l10n\...) instead of forward slashuv run pythonexplicitly invokes the Python interpreter on Windowsuv buildanduv run mkdocswork identically across platformsThe migration maintains parity with the Unix Makefile while respecting Windows conventions.
68-89: Setup, Snapshot, Test, and Tox targets correctly adapted for Windows.These targets properly use:
- Windows path separators (backslash) for all script paths
uv run pythonfor explicit Python invocation on Windows- Platform-independent uv commands (
uv venv,uv sync,uv run)The implementation maintains functional parity with the Unix Makefile while respecting Windows batch file syntax.
I tested it in my repo when I tried this task. |
…setup-uv` Co-authored-by: ~Jhellico <[email protected]>
Co-authored-by: ~Jhellico <[email protected]> Signed-off-by: Panpakorn Siripanich <[email protected]>
arkid15r
left a comment
There was a problem hiding this comment.
LGTM, great work 👍
I discussed the setup approach w/ @KJhellico in Slack. We agreed to merge it as is and revisit the CI/CD Python setup later
|
For documentation build we need to update also Index: .readthedocs.yaml
<+>UTF-8
===================================================================
diff --git a/.readthedocs.yaml b/.readthedocs.yaml
--- a/.readthedocs.yaml (revision f148513cc6a835d3450164117a73206ceca95f1b)
+++ b/.readthedocs.yaml (date 1765045969961)
@@ -7,6 +7,15 @@
tools:
# https://docs.readthedocs.com/platform/stable/config-file/v2.html#build-tools-python
python: '3.14'
+ jobs:
+ pre_create_environment:
+ - asdf plugin add uv
+ - asdf install uv latest
+ - asdf global uv latest
+ create_environment:
+ - uv venv "${READTHEDOCS_VIRTUALENV_PATH}"
+ install:
+ - UV_PROJECT_ENVIRONMENT="${READTHEDOCS_VIRTUALENV_PATH}" uv sync --frozen --extra docs
mkdocs:
configuration: mkdocs.yml(based on this) |
|
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
.readthedocs.yaml (1)
24-25: Remove stale pip-based install configuration.The old
python.installsection still referencesrequirements/docs.txt, which conflicts with the new uv-based approach. Per the PR objectives,requirements/*files should be removed. This section needs to be deleted since the newjobs.installblock (line 18) now handles dependency installation viauv sync.Apply this diff to remove the stale configuration:
mkdocs: configuration: mkdocs.yml -python: - install: - - requirements: requirements/docs.txt - version: 2
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
.readthedocs.yaml(1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2608
File: holidays/countries/saint_vincent_and_the_grenadines.py:30-30
Timestamp: 2025-06-07T07:37:55.516Z
Learning: For the vacanza/holidays repository, defer to the ruff configuration and pre-commit checks for coding standards rather than making manual suggestions about line length or style issues. If the automated checks pass, the code follows the project's standards.



Proposed change
Pretty much a proof-of-concept at the moment (as I cannot test GitHub action ones locally), I've also updated the
CONTRIBUTING.mdup a bit to be clearer for Windows-based contributors.Also, turns out CycloneDX doesn't officially support
uvat the moment, but this workaround from CycloneDX/cyclonedx-python#857 works. I knowuvdid recently implement theirs as part ofuv exportin astral-sh/uv#16523 (v0.9.11) but I haven't tried that yet.Resolves #2342
Type of change
holidaysfunctionality in general)Checklist
make checklocally; all checks and tests passed.