Skip to content

Commit df65548

Browse files
danielhollasunkcpz
authored andcommitted
Use uv-pre-commit to validate lockfile (aiidateam#6699)
The previous uv hook that checked whether uv lockfile is up-to-date required the developer to have uv installed. Using the official uv-pre-commit hook, this is no longer the case. The hook also updates the lock automatically, instead of just checking its status. Bump minimum version of uv to `0.5.21` fix issue astral-sh/uv#10689 uv does run the build backend for projects with dynamic versioning. Bump astral-sh/setup-uv action to v5.2.1. Change in `.github/workflows/ci-code.yml` (`file` -> `files`) is related to fixing a warning in the CI.
1 parent d0c9572 commit df65548

File tree

6 files changed

+19
-24
lines changed

6 files changed

+19
-24
lines changed

.github/actions/install-aiida-core/action.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ runs:
3131
python-version: ${{ inputs.python-version }}
3232

3333
- name: Set up uv
34-
uses: astral-sh/[email protected].0
34+
uses: astral-sh/[email protected].1
3535
with:
36-
version: 0.5.x
36+
version: 0.5.22
3737
python-version: ${{ inputs.python-version }}
3838

3939
- name: Install dependencies from uv lock

.github/workflows/ci-code.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ jobs:
8585
with:
8686
token: ${{ secrets.CODECOV_TOKEN }}
8787
name: aiida-pytests-py3.9
88-
file: ./coverage.xml
88+
files: ./coverage.xml
8989
fail_ci_if_error: false # don't fail job, if coverage upload fails
9090

9191
tests-presto:

.github/workflows/test-install.yml

+2-5
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,13 @@ jobs:
3838
python-version: '3.11'
3939

4040
- name: Set up uv
41-
uses: astral-sh/[email protected].0
41+
uses: astral-sh/[email protected].1
4242
with:
43-
version: 0.5.x
43+
version: latest
4444

4545
- name: Install utils/ dependencies
4646
run: uv pip install --system -r utils/requirements.txt
4747

48-
- name: Validate uv lockfile
49-
run: uv lock --check
50-
5148
- name: Validate conda environment file
5249
run: python ./utils/dependency_management.py validate-environment-yml
5350

.pre-commit-config.yaml

+7-13
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ ci:
22
autofix_prs: true
33
autoupdate_commit_msg: 'Devops: Update pre-commit dependencies'
44
autoupdate_schedule: quarterly
5-
skip: [mypy, check-uv-lock, generate-conda-environment, validate-conda-environment, verdi-autodocs]
5+
skip: [mypy, generate-conda-environment, validate-conda-environment, verdi-autodocs]
66

77
repos:
88
- repo: https://github.com/pre-commit/pre-commit-hooks
@@ -56,6 +56,12 @@ repos:
5656
environment.yml|
5757
)$
5858
59+
- repo: https://github.com/astral-sh/uv-pre-commit
60+
rev: 0.5.22
61+
hooks:
62+
# Check and update the uv lockfile
63+
- id: uv-lock
64+
5965
- repo: local
6066

6167
hooks:
@@ -187,18 +193,6 @@ repos:
187193
src/aiida/workflows/arithmetic/multiply_add.py|
188194
)$
189195
190-
- id: check-uv-lock
191-
name: Check uv lockfile up to date
192-
# NOTE: This will not automatically update the lockfile
193-
entry: uv lock --check
194-
language: system
195-
pass_filenames: false
196-
files: >-
197-
(?x)^(
198-
pyproject.toml|
199-
uv.lock|
200-
)$
201-
202196
- id: generate-conda-environment
203197
name: Update conda environment file
204198
entry: python ./utils/dependency_management.py generate-environment-yml

.readthedocs.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ build:
1717
# https://docs.readthedocs.io/en/stable/build-customization.html#install-dependencies-with-uv
1818
pre_create_environment:
1919
- asdf plugin add uv
20-
- asdf install uv 0.5.20
21-
- asdf global uv 0.5.20
20+
- asdf install uv 0.5.22
21+
- asdf global uv 0.5.22
2222
create_environment:
2323
- uv venv
2424
install:

pyproject.toml

+5-1
Original file line numberDiff line numberDiff line change
@@ -512,4 +512,8 @@ commands = molecule {posargs:test}
512512
"""
513513

514514
[tool.uv]
515-
required-version = ">=0.5.20"
515+
# NOTE: When you bump the minimum uv version, you also need to change it in:
516+
# .pre-commit-config.yaml
517+
# .github/actions/install-aiida-core/action.yml
518+
# .readthedocs.yml
519+
required-version = ">=0.5.21"

0 commit comments

Comments
 (0)