Skip to content

[WIP] simplify the CI workflows by leveraging UV features #13519

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

Draft
wants to merge 10 commits into
base: master
Choose a base branch
from
Draft
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
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
*.png binary
*.zip binary

# lockfiles
uv.lock -diff

# Unix-style line endings
[attr]unix text eol=lf

Expand Down
52 changes: 11 additions & 41 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ concurrency:
env:
FORCE_COLOR: "1"
UV_SYSTEM_PYTHON: "1" # make uv do global installs
UV_FROZEN: "1" # make uv use the frozen lockfile

jobs:
# If you update any of these commands, don't forget to update the equivalent
Expand All @@ -26,17 +27,14 @@ jobs:
- uses: actions/checkout@v4
with:
persist-credentials: false

- name: Install Ruff
uses: astral-sh/ruff-action@v3
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
args: --version

enable-cache: false
- name: Lint with Ruff
run: ruff check --output-format=github

run: uv run ruff check --output-format=github
- name: Format with Ruff
run: ruff format --diff
run: uv run ruff format --diff

mypy:
runs-on: ubuntu-latest
Expand All @@ -45,19 +43,12 @@ jobs:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3"
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
version: latest
enable-cache: false
- name: Install dependencies
run: uv pip install -r pyproject.toml --group package --group test --group types
- name: Type check with mypy
run: mypy
run: uv run mypy
Comment on lines -57 to +51
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which packages does uv install here? Does it pick up the dependency groups automatically?

Copy link
Contributor Author

@danieleades danieleades Apr 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is skipping the fine-grained dependency groups. This could be re-added but the micro optimisation just didn't seem worth the complexity

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in fact, given UV resolves the dependencies damn near instantly, i'd be in favour of collapsing these groups into something much more simple


pyright:
runs-on: ubuntu-latest
Expand All @@ -66,19 +57,12 @@ jobs:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3"
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
version: latest
enable-cache: false
- name: Install dependencies
run: uv pip install -r pyproject.toml --group package --group test --group types
- name: Type check with pyright
run: pyright
run: uv run pyright

docs-lint:
runs-on: ubuntu-latest
Expand All @@ -87,19 +71,12 @@ jobs:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3"
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
version: latest
enable-cache: false
- name: Install dependencies
run: uv pip install --group lint
- name: Lint documentation with sphinx-lint
run: make doclinter
run: uv run make doclinter

twine:
runs-on: ubuntu-latest
Expand All @@ -108,18 +85,11 @@ jobs:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3"
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
version: latest
enable-cache: false
- name: Install dependencies
run: uv pip install --group package
- name: Lint with twine
run: |
python -m build .
twine check dist/*
uv build
uv run twine check dist/*
7 changes: 0 additions & 7 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ jobs:
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
version: latest
enable-cache: false
- name: Install dependencies
run: uv pip install . --group test
Expand Down Expand Up @@ -176,7 +175,6 @@ jobs:
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
version: latest
enable-cache: false
- name: Install dependencies
run: uv pip install . --group test
Expand Down Expand Up @@ -205,7 +203,6 @@ jobs:
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
version: latest
enable-cache: false
- name: Install dependencies
run: uv pip install . --group test
Expand Down Expand Up @@ -240,7 +237,6 @@ jobs:
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
version: latest
enable-cache: false
- name: Install dependencies
run: uv pip install . --group test
Expand Down Expand Up @@ -273,7 +269,6 @@ jobs:
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
version: latest
enable-cache: false
- name: Install dependencies
run: |
Expand Down Expand Up @@ -304,7 +299,6 @@ jobs:
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
version: latest
enable-cache: false
- name: Install dependencies
run: uv pip install . --group test
Expand Down Expand Up @@ -335,7 +329,6 @@ jobs:
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
version: latest
enable-cache: false
- name: Install dependencies
run: uv pip install . --group test pytest-cov
Expand Down
Loading
Loading