ci: single-source Python version via pyproject.toml + add uv-lock pre-commit hook (#15111)

- Add astral-sh/uv-pre-commit (uv-lock) so uv.lock stays in sync with
  pyproject.toml automatically instead of relying on manual relocks.
- Replace 'python-version: 3.14' with 'python-version-file: pyproject.toml'
  in every workflow that uses actions/setup-python (build, project_euler,
  sphinx, directory_writer), making requires-python the single source of
  truth for the interpreter version.
This commit is contained in:
priya-sundaram-dev
2026-08-28 13:39:50 +02:00
committed by GitHub
parent 74f8c784e1
commit 02c6850fe9
5 changed files with 10 additions and 5 deletions
+1 -1
View File
@@ -17,7 +17,7 @@ jobs:
cache-dependency-glob: uv.lock
- uses: actions/setup-python@v7
with:
python-version: 3.14
python-version-file: pyproject.toml
allow-prereleases: true
- run: uv sync --group=test
- name: Run tests
+1 -1
View File
@@ -11,7 +11,7 @@ jobs:
fetch-depth: 0
- uses: actions/setup-python@v7
with:
python-version: 3.14
python-version-file: pyproject.toml
allow-prereleases: true
- name: Write DIRECTORY.md
run: |
+2 -2
View File
@@ -25,7 +25,7 @@ jobs:
- uses: astral-sh/setup-uv@v7
- uses: actions/setup-python@v7
with:
python-version: 3.14
python-version-file: pyproject.toml
allow-prereleases: true
- run: uv sync --group=euler-validate --group=test
- run: uv run pytest --doctest-modules --cov-report=term-missing:skip-covered --cov=project_euler/ project_euler/
@@ -43,7 +43,7 @@ jobs:
- uses: astral-sh/setup-uv@v7
- uses: actions/setup-python@v7
with:
python-version: 3.14
python-version-file: pyproject.toml
allow-prereleases: true
- run: uv sync --group=euler-validate --group=test
- run: uv run pytest scripts/validate_solutions.py
+1 -1
View File
@@ -36,7 +36,7 @@ jobs:
- uses: astral-sh/setup-uv@v7
- uses: actions/setup-python@v7
with:
python-version: 3.14
python-version-file: pyproject.toml
allow-prereleases: true
- run: uv sync --group=docs
- uses: actions/configure-pages@v6
+5
View File
@@ -18,6 +18,11 @@ repos:
hooks:
- id: auto-walrus
- repo: https://github.com/astral-sh/uv-pre-commit
rev: 0.12.7
hooks:
- id: uv-lock
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.16.1
hooks: