Skip to content

Commit adb368b

Browse files
committed
uv migrate
1 parent 1a5effb commit adb368b

File tree

10 files changed

+1533
-109
lines changed

10 files changed

+1533
-109
lines changed

.github/dependabot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
version: 2
22
updates:
3-
- package-ecosystem: pip
3+
- package-ecosystem: uv
44
directory: /
55
schedule:
66
interval: weekly

.github/workflows/ci-cd.yml

Lines changed: 63 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,15 @@ jobs:
3737
- name: Check out repository
3838
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
3939

40-
- name: Set up Python
41-
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c
40+
- name: Install uv
41+
uses: astral-sh/setup-uv@5a7eac68fb9809dea845d802897dc5c723910fa3
4242
with:
43-
check-latest: true
4443
python-version: '3.14'
44+
version: '0.9.9'
4545

4646
- name: Run pre-commit
47-
uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd
47+
run: |
48+
uv tool run pre-commit run --all-files
4849
4950
code-ql:
5051
name: CodeQL
@@ -88,22 +89,34 @@ jobs:
8889
- name: Check out repository
8990
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
9091

91-
- name: Set up Python ${{ matrix.python-version }}
92-
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c
92+
- name: Install uv
93+
uses: astral-sh/setup-uv@5a7eac68fb9809dea845d802897dc5c723910fa3
9394
with:
94-
allow-prereleases: true
95-
cache: pip
96-
cache-dependency-path: |
97-
requirements/runtime.txt
98-
requirements/tests.txt
99-
check-latest: true
95+
activate-environment: true
96+
# setup-uv doesn't use latest Python 3.9 on macos
97+
# https://github.com/astral-sh/setup-uv/issues/212
10098
python-version: ${{ matrix.python-version }}
99+
version: '0.9.9'
100+
101+
# - name: Set up Python ${{ matrix.python-version }}
102+
# uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065
103+
# with:
104+
# allow-prereleases: true
105+
# cache: pip
106+
# cache-dependency-path: |
107+
# requirements/runtime.txt
108+
# requirements/tests.txt
109+
# check-latest: true
110+
# python-version: ${{ matrix.python-version }}
101111

102-
- name: Install dependencies
112+
- name: Set up Python ${{ matrix.python-version }}
103113
run: |
104-
python -m pip install --upgrade pip
105-
python -m pip install --requirement requirements/tests.txt
106-
python -m pip install .
114+
uv python install --managed-python
115+
116+
- name: Install project
117+
run: |
118+
uv sync --locked --no-default-groups --group tests
119+
uv pip install .
107120
108121
- name: Run tests
109122
run: |
@@ -122,20 +135,27 @@ jobs:
122135
- name: Check out repository
123136
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
124137

125-
- name: Set up Python
126-
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c
138+
- name: Install uv
139+
uses: astral-sh/setup-uv@5a7eac68fb9809dea845d802897dc5c723910fa3
127140
with:
128-
cache: pip
129-
cache-dependency-path: |
130-
requirements/build.txt
131-
check-latest: true
141+
activate-environment: true
132142
python-version: '3.14'
133-
134-
- name: Install dependencies
135-
run: |
136-
python -m pip install --upgrade pip
137-
python -m pip install -r requirements/build.txt
138-
python -m pip install .
143+
version: '0.9.9'
144+
145+
# - name: Set up Python
146+
# uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065
147+
# with:
148+
# cache: pip
149+
# cache-dependency-path: |
150+
# requirements/build.txt
151+
# check-latest: true
152+
# python-version: '3.14'
153+
154+
# - name: Install dependencies
155+
# run: |
156+
# python -m pip install --upgrade pip
157+
# python -m pip install -r requirements/build.txt
158+
# python -m pip install .
139159

140160
- name: Build distribution
141161
run: |
@@ -152,12 +172,12 @@ jobs:
152172
run: echo "VERSION=$(echo ${{ github.ref_name }} | sed 's/^v//')" >> $GITHUB_ENV
153173

154174
- name: Generate SBOM
155-
if: startsWith(github.event.ref, 'refs/tags/v')
175+
# if: startsWith(github.event.ref, 'refs/tags/v')
156176
run: |
157177
make sbom > holidays-${{ env.VERSION }}-sbom.json
158178
159179
- name: Upload SBOM
160-
if: startsWith(github.event.ref, 'refs/tags/v')
180+
# if: startsWith(github.event.ref, 'refs/tags/v')
161181
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4
162182
with:
163183
name: sbom
@@ -212,17 +232,23 @@ jobs:
212232
- name: Check out repository
213233
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
214234

215-
- name: Set Up Python
216-
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c
235+
- name: Install uv
236+
uses: astral-sh/setup-uv@5a7eac68fb9809dea845d802897dc5c723910fa3
217237
with:
218-
cache: pip
219-
cache-dependency-path: requirements/docs.txt
238+
activate-environment: true
220239
python-version: '3.14'
240+
version: '0.9.9'
241+
242+
# - name: Set Up Python
243+
# uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065
244+
# with:
245+
# cache: pip
246+
# cache-dependency-path: requirements/docs.txt
247+
# python-version: '3.13'
221248

222-
- name: Install dependencies
249+
- name: Install project
223250
run: |
224-
python -m pip install --requirement requirements/docs.txt
225-
python -m pip install .
251+
uv sync --locked --no-default-groups --group docs
226252
227253
- name: Build docs
228254
run: |

.github/workflows/pre-commit-autoupdate.yml

Lines changed: 17 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -11,42 +11,32 @@ env:
1111
jobs:
1212
auto-update:
1313
name: Update pre-commit hooks
14-
if: ${{ github.repository == 'vacanza/holidays' }}
14+
# if: ${{ github.repository == 'vacanza/holidays' }}
1515
permissions:
1616
contents: write
1717
pull-requests: write
1818
runs-on: ubuntu-24.04
1919
steps:
2020
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
2121

22-
- uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c
22+
- name: Install uv
23+
uses: astral-sh/setup-uv@bd01e18f51369d5a26f1651c3cb451d3417e3bba
2324
with:
24-
cache: pip
2525
python-version: '3.14'
26-
27-
- name: Install dependencies
28-
run: |
29-
python -m pip install pre-commit
30-
31-
- name: Use pre-commit environment cache
32-
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830
33-
with:
34-
key: ${{ runner.os }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
35-
path: ~/.cache/pre-commit
36-
restore-keys: ${{ runner.os }}-pre-commit-
26+
version: '0.9.9'
3727

3828
- name: Run pre-commit automatic update
3929
run: |
40-
pre-commit autoupdate
41-
pre-commit run --all-files
42-
43-
- uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e
44-
with:
45-
base: dev
46-
body: Update pre-commit hooks to their latest versions.
47-
branch: update-pre-commit-hooks
48-
commit-message: 'chore: Update pre-commit hooks'
49-
committer: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
50-
delete-branch: true
51-
title: Update pre-commit hooks
52-
token: ${{ github.token }}
30+
uv tool run pre-commit autoupdate
31+
uv tool run pre-commit run --all-files
32+
33+
# - uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e
34+
# with:
35+
# base: dev
36+
# body: Update pre-commit hooks to their latest versions.
37+
# branch: update-pre-commit-hooks
38+
# commit-message: 'chore: Update pre-commit hooks'
39+
# committer: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
40+
# delete-branch: true
41+
# title: Update pre-commit hooks
42+
# token: ${{ github.token }}

.github/workflows/update-snapshots.yml

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
jobs:
1010
update-snapshots:
1111
name: Update snapshots
12-
if: github.repository == 'vacanza/holidays'
12+
# if: github.repository == 'vacanza/holidays'
1313
permissions:
1414
contents: write
1515
pull-requests: write
@@ -18,33 +18,28 @@ jobs:
1818
- name: Check out repository
1919
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
2020

21-
- name: Set up Python
22-
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c
21+
- name: Install uv
22+
uses: astral-sh/setup-uv@bd01e18f51369d5a26f1651c3cb451d3417e3bba
2323
with:
24-
cache: pip
25-
cache-dependency-path: |
26-
requirements/build.txt
27-
requirements/runtime.txt
28-
check-latest: true
24+
activate-environment: true
2925
python-version: '3.14'
26+
version: '0.9.9'
3027

31-
- name: Install dependencies
28+
- name: Install project
3229
run: |
33-
python -m pip install --upgrade pip
34-
python -m pip install -r requirements/build.txt
35-
python -m pip install -r requirements/runtime.txt
30+
uv sync --locked --no-default-groups --group build
3631
3732
- name: Generate snapshots
3833
run: |
3934
make snapshot
4035
41-
- uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e
42-
with:
43-
base: dev
44-
body: Automatically generated snapshots update.
45-
branch: update-snapshots
46-
commit-message: 'Update snapshots [skip ci]'
47-
committer: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
48-
delete-branch: true
49-
title: 'chore: Update snapshots'
50-
token: ${{ github.token }}
36+
# - uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e
37+
# with:
38+
# base: dev
39+
# body: Automatically generated snapshots update.
40+
# branch: update-snapshots
41+
# commit-message: 'Update snapshots [skip ci]'
42+
# committer: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
43+
# delete-branch: true
44+
# title: 'chore: Update snapshots'
45+
# token: ${{ github.token }}

Makefile

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ help:
88
@echo " pre-commit run pre-commit against all files"
99
@echo " setup setup development environment"
1010
@echo " test run tests (in parallel)"
11-
@echo " tox run tox (in parallel)"
1211

1312
check:
1413
make l10n
@@ -25,14 +24,17 @@ clean:
2524
doc:
2625
mkdocs build
2726

27+
generate-mo:
28+
uv run --no-default-groups --group build scripts/l10n/generate_mo_files.py
29+
2830
l10n:
2931
find . -type f -name "*.pot" -delete
30-
scripts/l10n/generate_po_files.py >/dev/null 2>&1
31-
scripts/l10n/generate_mo_files.py
32+
uv run scripts/l10n/generate_po_files.py >/dev/null 2>&1
33+
make generate-mo
3234

3335
package:
34-
scripts/l10n/generate_mo_files.py
35-
python -m build
36+
make generate-mo
37+
uv build
3638

3739
pre-commit:
3840
pre-commit run --all-files
@@ -41,26 +43,22 @@ release-notes:
4143
@scripts/generate_release_notes.py
4244

4345
sbom:
44-
@python -m cyclonedx_py requirements requirements/runtime.txt
46+
uv tool run --from cyclonedx-bom cyclonedx-py requirements requirements/runtime.txt
4547

4648
setup:
47-
pip install --upgrade pip
48-
pip install --requirement requirements/dev.txt
49-
pip install --requirement requirements/docs.txt
50-
pip install --requirement requirements/runtime.txt
51-
pip install --requirement requirements/tests.txt
49+
curl -LsSf https://astral.sh/uv/install.sh | sh
50+
uv venv
51+
uv sync --all-groups
52+
uv tool install pre-commit --with pre-commit-uv
5253
pre-commit install --hook-type pre-commit
5354
pre-commit install --hook-type pre-push
5455
make l10n
5556
make package
5657

5758
snapshot:
58-
scripts/l10n/generate_mo_files.py
59-
scripts/generate_snapshots.py
59+
make generate-mo
60+
uv run scripts/generate_snapshots.py
6061

6162
test:
62-
scripts/l10n/generate_mo_files.py
63+
make generate-mo
6364
pytest --cov=. --cov-config=pyproject.toml --cov-report term-missing --cov-report xml --durations 10 --durations-min=0.75 --dist loadscope --no-cov-on-fail --numprocesses auto
64-
65-
tox:
66-
tox --parallel auto

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ exclude_lines = [
9999

100100
[tool.coverage.run]
101101
branch = true
102-
omit = [ "scripts/*", "tests/*" ]
103102

104103
[[tool.mypy.overrides]]
105104
module = "holidays.countries.*"

requirements/build.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
build==1.3.0
2-
cyclonedx-bom==7.2.1
31
polib==1.2.0

requirements/dev.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# Dev requirements.
22

3-
build==1.3.0
43
convertdate==2.4.0
54
gitpython==3.1.45
65
hijridate==2.5.0

requirements/docs.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,3 @@ mkdocs-gen-files==0.5.0
55
mkdocs-literate-nav==0.6.2
66
mkdocs==1.6.1
77
mkdocstrings-python==1.19.0
8-
zipp==3.23.0 # not directly required, pinned by Snyk to avoid a vulnerability

0 commit comments

Comments
 (0)