Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use uv for linter workflow #39701

Merged
merged 4 commits into from
Mar 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 5 additions & 16 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,30 +26,19 @@ jobs:
.ci/merge-fixes.sh
env:
GH_TOKEN: ${{ github.token }}
SAGE_CI_FIXES_FROM_REPOSITORIES: ${{ vars.SAGE_CI_FIXES_FROM_REPOSITORIES }}

- name: Install test prerequisites
- name: Install prerequisites
id: deps
# From docker.yml
run: |
sudo DEBIAN_FRONTEND=noninteractive apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get install tox
run: pip install uv

- name: Code style check with ruff-minimal
if: (success() || failure()) && steps.deps.outcome == 'success'
run: tox -e ruff-minimal
env:
# https://github.com/ChartBoost/ruff-action/issues/7#issuecomment-1887780308
RUFF_OUTPUT_FORMAT: github

- name: Code style check with pycodestyle-minimal
if: (success() || failure()) && steps.deps.outcome == 'success'
run: tox -e pycodestyle-minimal
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

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

- name: Validate docstring markup as RST
if: (success() || failure()) && steps.deps.outcome == 'success'
run: tox -e rst
run: uv run --frozen --only-group lint -- flake8 --select=RST src/sage/ --config src/tox.ini
7 changes: 2 additions & 5 deletions build/sage_bootstrap/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,12 @@
# https://www.gnu.org/licenses/
# ****************************************************************************

import re
import os
import logging
import os
import re

from sage_bootstrap.env import SAGE_ROOT


log = logging.getLogger()


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

dependencies = dependencies_runtime

@property
def dependencies_check(self):
"""
Expand Down
10 changes: 10 additions & 0 deletions renovate.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
$schema: "https://docs.renovatebot.com/renovate-schema.json",
extends: [
'config:best-practices',
// Update uv.lock: https://docs.renovatebot.com/presets-default/#maintainlockfilesmonthly
':maintainLockFilesMonthly',
// Disable dashboard: https://docs.renovatebot.com/key-concepts/dashboard/
':disableDependencyDashboard',
],
}
12 changes: 12 additions & 0 deletions src/doc/en/developer/tools.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,18 @@
Development and Testing Tools
=============================

uv
==

`uv <https://docs.astral.sh/uv/>`_ is a versatile tool for
managing and synchronizing project dependencies.

The lockfile `uv.lock` in the root captures the exact package versions for
all systems and ensures consistent, reproducible installations.
It is automatically updated during ``uv`` operations like ``uv add``
and ``uv run``, or explicitly with ``uv lock``.
Moreover, it is periodically updated by `Renovate <https://docs.renovatebot.com/>`_.

.. _section-tools-tox:

Tox
Expand Down
Loading
Loading