Skip to content

Commit 0708c6e

Browse files
authored
build: migrate from pip to uv for dependency management (#445)
* build: migrate from pip to uv for dependency management ## What Replace pip-based dependency management with uv across the entire project: pyproject.toml and uv.lock replace requirements.txt and requirements-test.txt, all CI workflows use astral-sh/setup-uv, Makefile commands prefixed with uv run, and Dockerfile uses uv for production installs. ## Why uv provides significantly faster dependency resolution and installation, deterministic lockfile-based builds, and a single pyproject.toml as the source of truth for all dependencies. This aligns with the approach already adopted by the contributors and cleanowners repos. ## Notes - CI matrix expanded to Python 3.11-3.14 - New update-uv-lock.yml workflow handles Dependabot PR lockfile sync - Docker image copies uv binary from ghcr.io/astral-sh/uv:0.10.9 - Added .codespellrc to ignore "astroid" (pylint dependency) - Added .venv to .jscpd.json ignore list Signed-off-by: jmeridth <jmeridth@gmail.com> * chore(deps): bump astral-sh/setup-uv from 5.4.1 to 7.3.1 ## What Updated the astral-sh/setup-uv GitHub Action from v5.4.1 (0c5e2b8115b80b4c7c5ddf6ffdd634974642d182) to v7.3.1 (5a095e7a2014a4212f075830d4f7277575a9d098) across all workflow files. ## Why Aligns with the same dependency bump applied in the contributors repo (PR #420) to keep all github-community-projects repos on a consistent setup-uv version. ## Notes - This is a major version bump (v5 → v7); review the setup-uv release notes for any breaking changes in action inputs or behavior - The v7.3.1 release adds support for running in containers like debian:testing/unstable Signed-off-by: jmeridth <jmeridth@gmail.com> * build: replace GITHUB_TOKEN with octo-sts token federation in update-uv-lock workflow ## What Use octo-sts OIDC-federated token instead of GITHUB_TOKEN in the update-uv-lock workflow, with a corresponding trust policy. ## Why Commits made with GITHUB_TOKEN do not trigger subsequent workflow runs, so Dependabot PRs with uv.lock updates were not getting CI checks on the lockfile commit. ## Notes - Trust policy scoped to pull_request events with job_workflow_ref matching update-uv-lock.yml - Requires octo-sts app installed on the org (already present) Signed-off-by: jmeridth <jmeridth@gmail.com> * fix: ospo-reusable-workflows path Signed-off-by: jmeridth <jmeridth@gmail.com> --------- Signed-off-by: jmeridth <jmeridth@gmail.com>
1 parent 9a21b81 commit 0708c6e

17 files changed

+1067
-85
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
issuer: https://token.actions.githubusercontent.com
2+
subject_pattern: "repo:github-community-projects/stale-repos:pull_request"
3+
claim_pattern:
4+
job_workflow_ref: "github-community-projects/stale-repos/.github/workflows/update-uv-lock.yml@.*"
5+
6+
permissions:
7+
contents: write

.github/linters/.codespellrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[codespell]
2+
ignore-words-list = astroid

.github/linters/.jscpd.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"threshold": 25,
3-
"ignore": ["test*"],
3+
"ignore": ["test*", "**/.venv/**"],
44
"absolute": true
55
}

.github/workflows/auto-labeler.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
permissions:
1212
contents: read
1313
pull-requests: write
14-
uses: github/ospo-reusable-workflows/.github/workflows/auto-labeler.yaml@3b691dff6b68489c8548e1295d125c93c9c29a4e
14+
uses: github-community-projects/ospo-reusable-workflows/.github/workflows/auto-labeler.yaml@3b691dff6b68489c8548e1295d125c93c9c29a4e
1515
with:
1616
config-name: release-drafter.yml
1717
secrets:

.github/workflows/copilot-setup-steps.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ jobs:
3030
with:
3131
persist-credentials: false
3232

33-
- name: Set up Python
34-
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
35-
with:
36-
python-version: 3.12
33+
- name: Install uv
34+
uses: astral-sh/setup-uv@5a095e7a2014a4212f075830d4f7277575a9d098 # v7.3.1
35+
36+
- name: Install Python
37+
run: uv python install 3.14
3738

3839
- name: Install dependencies
39-
run: |
40-
pip install -r requirements.txt -r requirements-test.txt
40+
run: uv sync --frozen --python 3.14

.github/workflows/linter.yaml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,10 @@ jobs:
2424
# list of changed files within `super-linter`
2525
fetch-depth: 0
2626
persist-credentials: false
27-
- name: Setup Python
28-
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
29-
with:
30-
python-version: "3.12"
27+
- name: Install uv
28+
uses: astral-sh/setup-uv@5a095e7a2014a4212f075830d4f7277575a9d098 # v7.3.1
3129
- name: Install dependencies
32-
run: |
33-
python -m pip install --upgrade pip
34-
pip install -r requirements.txt -r requirements-test.txt
30+
run: uv sync --frozen
3531
- name: Lint Code Base
3632
uses: super-linter/super-linter@61abc07d755095a68f4987d1c2c3d1d64408f1f9 # v8.5.0
3733
env:

.github/workflows/pr-title.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ jobs:
1212
contents: read
1313
pull-requests: read
1414
statuses: write
15-
uses: github/ospo-reusable-workflows/.github/workflows/pr-title.yaml@3b691dff6b68489c8548e1295d125c93c9c29a4e
15+
uses: github-community-projects/ospo-reusable-workflows/.github/workflows/pr-title.yaml@3b691dff6b68489c8548e1295d125c93c9c29a4e
1616
secrets:
1717
github-token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/python-package.yml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,17 @@ jobs:
1717
runs-on: ubuntu-latest
1818
strategy:
1919
matrix:
20-
python-version: [3.11, 3.12, 3.13]
20+
python-version: [3.11, 3.12, 3.13, 3.14]
2121
steps:
2222
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2323
with:
2424
persist-credentials: false
25-
- name: Set up Python ${{ matrix.python-version }}
26-
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
27-
with:
28-
python-version: ${{ matrix.python-version }}
25+
- name: Install uv
26+
uses: astral-sh/setup-uv@5a095e7a2014a4212f075830d4f7277575a9d098 # v7.3.1
27+
- name: Install Python ${{ matrix.python-version }}
28+
run: uv python install ${{ matrix.python-version }}
2929
- name: Install dependencies
30-
run: |
31-
python -m pip install --upgrade pip
32-
pip install -r requirements.txt -r requirements-test.txt
30+
run: uv sync --frozen --python ${{ matrix.python-version }}
3331
- name: Lint with flake8 and pylint
3432
run: |
3533
make lint

.github/workflows/release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
permissions:
1313
contents: write
1414
pull-requests: read
15-
uses: github/ospo-reusable-workflows/.github/workflows/release.yaml@3b691dff6b68489c8548e1295d125c93c9c29a4e
15+
uses: github-community-projects/ospo-reusable-workflows/.github/workflows/release.yaml@3b691dff6b68489c8548e1295d125c93c9c29a4e
1616
with:
1717
publish: true
1818
release-config-name: release-drafter.yml
@@ -25,7 +25,7 @@ jobs:
2525
packages: write
2626
id-token: write
2727
attestations: write
28-
uses: github/ospo-reusable-workflows/.github/workflows/release-image.yaml@3b691dff6b68489c8548e1295d125c93c9c29a4e
28+
uses: github-community-projects/ospo-reusable-workflows/.github/workflows/release-image.yaml@3b691dff6b68489c8548e1295d125c93c9c29a4e
2929
with:
3030
image-name: ${{ github.repository_owner }}/stale_repos
3131
full-tag: ${{ needs.release.outputs.full-tag }}
@@ -40,7 +40,7 @@ jobs:
4040
permissions:
4141
contents: read
4242
discussions: write
43-
uses: github/ospo-reusable-workflows/.github/workflows/release-discussion.yaml@3b691dff6b68489c8548e1295d125c93c9c29a4e
43+
uses: github-community-projects/ospo-reusable-workflows/.github/workflows/release-discussion.yaml@3b691dff6b68489c8548e1295d125c93c9c29a4e
4444
with:
4545
full-tag: ${{ needs.release.outputs.full-tag }}
4646
body: ${{ needs.release.outputs.body }}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
name: Update uv.lock
3+
4+
on:
5+
pull_request:
6+
paths:
7+
- pyproject.toml
8+
9+
permissions:
10+
id-token: write
11+
12+
jobs:
13+
update-lock:
14+
if: github.event.pull_request.user.login == 'dependabot[bot]'
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Get GitHub App token via octo-sts
18+
uses: octo-sts/action@f603d3be9d8dd9871a265776e625a27b00effe05 # v1.1.1
19+
id: octo-sts
20+
with:
21+
scope: github-community-projects/stale-repos
22+
identity: update-uv-lock
23+
24+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
25+
with:
26+
ref: ${{ github.head_ref }}
27+
persist-credentials: true # Use the workflow temporary token from octo-sts to allow pushing changes back to the dependabot branch
28+
token: ${{ steps.octo-sts.outputs.token }}
29+
30+
- name: Install uv
31+
uses: astral-sh/setup-uv@5a095e7a2014a4212f075830d4f7277575a9d098 # v7.3.1
32+
33+
- name: Update uv.lock
34+
run: uv lock
35+
36+
- name: Commit and push updated lockfile
37+
run: |
38+
git config user.name "octo-sts[bot]"
39+
git config user.email "801323+octo-sts[bot]@users.noreply.github.com"
40+
git add uv.lock
41+
git diff --cached --quiet || git commit -s -m "chore(deps): update uv.lock"
42+
git push

0 commit comments

Comments
 (0)