mirror of
https://github.com/TheAlgorithms/Python.git
synced 2026-09-28 13:33:11 +08:00
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:
@@ -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
|
||||
|
||||
@@ -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: |
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user