Skip to content

Commit 4e7e01c

Browse files
author
Release Manager
committed
gh-39701: Use uv for linter workflow <!-- ^ Please provide a concise and informative title. --> <!-- ^ Don't put issue numbers in the title, do this in the PR description below. --> <!-- ^ For example, instead of "Fixes #12345" use "Introduce new method to calculate 1 + 2". --> <!-- v Describe your changes below in detail. --> <!-- v Why is this change required? What problem does it solve? --> <!-- v If this PR resolves an open issue, please link to it here. For example, "Fixes #12345". --> Currently, the linter workflow always uses the latest release of all dependencies. Thus, updates to these linters may result in broken CI (just happened yesterday see #39699). Here, we use `uv` to lock the dependency of all tools used in the linter workflow. The lock file will be automatically updated using renovate. Also remove `pycodestyle` as by now it can be replaced by ruff. (The lock file also contains all sage dependencies and thus may be used to replace the manual updates of python deps in sage-the-distro @dimpase) ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [ ] The title is concise and informative. - [ ] The description explains in detail what this PR is about. - [ ] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - #12345: short description why this is a dependency --> <!-- - #34567: ... --> URL: #39701 Reported by: Tobias Diez Reviewer(s): Dima Pasechnik
2 parents df1c72d + e563fe4 commit 4e7e01c

File tree

5 files changed

+2680
-21
lines changed

5 files changed

+2680
-21
lines changed

.github/workflows/lint.yml

+5-16
Original file line numberDiff line numberDiff line change
@@ -26,30 +26,19 @@ jobs:
2626
.ci/merge-fixes.sh
2727
env:
2828
GH_TOKEN: ${{ github.token }}
29-
SAGE_CI_FIXES_FROM_REPOSITORIES: ${{ vars.SAGE_CI_FIXES_FROM_REPOSITORIES }}
3029

31-
- name: Install test prerequisites
30+
- name: Install prerequisites
3231
id: deps
33-
# From docker.yml
34-
run: |
35-
sudo DEBIAN_FRONTEND=noninteractive apt-get update
36-
sudo DEBIAN_FRONTEND=noninteractive apt-get install tox
32+
run: pip install uv
3733

3834
- name: Code style check with ruff-minimal
3935
if: (success() || failure()) && steps.deps.outcome == 'success'
40-
run: tox -e ruff-minimal
41-
env:
42-
# https://github.com/ChartBoost/ruff-action/issues/7#issuecomment-1887780308
43-
RUFF_OUTPUT_FORMAT: github
44-
45-
- name: Code style check with pycodestyle-minimal
46-
if: (success() || failure()) && steps.deps.outcome == 'success'
47-
run: tox -e pycodestyle-minimal
36+
run: uv run --frozen --only-group lint -- ruff check --output-format github --ignore E402,E721,E731,E741,E742,E743,F401,F402,F403,F405,F821,F841,I001,PLC0206,PLC0208,PLC2401,PLC3002,PLE0302,PLR0124,PLR0402,PLR0911,PLR0912,PLR0913,PLR0915,PLR1704,PLR1711,PLR1714,PLR1716,PLR1736,PLR2004,PLR5501,PLW0120,PLW0211,PLW0602,PLW0603,PLW0642,PLW1508,PLW1510,PLW2901,PLW3301
4837

4938
- name: Code style check with relint
5039
if: (success() || failure()) && steps.deps.outcome == 'success'
51-
run: tox -e relint -- src/sage/
40+
run: uv run --frozen --only-group lint -- relint -c src/.relint.yml -- src/sage/
5241

5342
- name: Validate docstring markup as RST
5443
if: (success() || failure()) && steps.deps.outcome == 'success'
55-
run: tox -e rst
44+
run: uv run --frozen --only-group lint -- flake8 --select=RST src/sage/ --config src/tox.ini

build/sage_bootstrap/package.py

+2-5
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,12 @@
1515
# https://www.gnu.org/licenses/
1616
# ****************************************************************************
1717

18-
import re
19-
import os
2018
import logging
19+
import os
20+
import re
2121

2222
from sage_bootstrap.env import SAGE_ROOT
2323

24-
2524
log = logging.getLogger()
2625

2726

@@ -443,8 +442,6 @@ def dependencies_runtime(self):
443442
# after a '|', we have order-only build dependencies
444443
return self.__dependencies.partition('|')[0].strip().split()
445444

446-
dependencies = dependencies_runtime
447-
448445
@property
449446
def dependencies_check(self):
450447
"""

renovate.json5

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
$schema: "https://docs.renovatebot.com/renovate-schema.json",
3+
extends: [
4+
'config:best-practices',
5+
// Update uv.lock: https://docs.renovatebot.com/presets-default/#maintainlockfilesmonthly
6+
':maintainLockFilesMonthly',
7+
// Disable dashboard: https://docs.renovatebot.com/key-concepts/dashboard/
8+
':disableDependencyDashboard',
9+
],
10+
}

src/doc/en/developer/tools.rst

+12
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,18 @@
88
Development and Testing Tools
99
=============================
1010

11+
uv
12+
==
13+
14+
`uv <https://docs.astral.sh/uv/>`_ is a versatile tool for
15+
managing and synchronizing project dependencies.
16+
17+
The lockfile `uv.lock` in the root captures the exact package versions for
18+
all systems and ensures consistent, reproducible installations.
19+
It is automatically updated during ``uv`` operations like ``uv add``
20+
and ``uv run``, or explicitly with ``uv lock``.
21+
Moreover, it is periodically updated by `Renovate <https://docs.renovatebot.com/>`_.
22+
1123
.. _section-tools-tox:
1224

1325
Tox

0 commit comments

Comments
 (0)