Skip to content

Commit 4071c22

Browse files
authored
switch to uv for dependency management (#433)
2 parents b5593ca + 2e895e0 commit 4071c22

File tree

22 files changed

+1984
-567
lines changed

22 files changed

+1984
-567
lines changed

.github/workflows/lock.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ on:
1010
permissions:
1111
issues: write
1212
pull-requests: write
13+
discussions: write
1314
concurrency:
1415
group: lock
1516
jobs:
@@ -20,3 +21,4 @@ jobs:
2021
with:
2122
issue-inactive-days: 14
2223
pr-inactive-days: 14
24+
discussion-inactive-days: 14

.github/workflows/pre-commit.yaml

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,19 @@ jobs:
77
main:
88
runs-on: ubuntu-latest
99
steps:
10-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
11-
- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
12-
with:
13-
python-version: 3.x
14-
- uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1
15-
- uses: pre-commit-ci/lite-action@5d6cc0eb514c891a40562a58a8e71576c5c7fb43 # v1.1.0
16-
if: ${{ !cancelled() }}
10+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
11+
- uses: astral-sh/setup-uv@f0ec1fc3b38f5e7cd731bb6ce540c5af426746bb # v6.1.0
12+
with:
13+
enable-cache: true
14+
prune-cache: false
15+
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
16+
id: setup-python
17+
with:
18+
python-version-file: pyproject.toml
19+
- uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
20+
with:
21+
path: ~/.cache/pre-commit
22+
key: pre-commit|${{ hashFiles('pyproject.toml', '.pre-commit-config.yaml') }}
23+
- run: uv run --locked --group pre-commit pre-commit run --show-diff-on-failure --color=always --all-files
24+
- uses: pre-commit-ci/lite-action@5d6cc0eb514c891a40562a58a8e71576c5c7fb43 # v1.1.0
25+
if: ${{ !cancelled() }}

.github/workflows/publish.yaml

Lines changed: 15 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,45 @@
11
name: Publish
22
on:
33
push:
4-
tags:
5-
- '*'
4+
tags: ['*']
65
jobs:
76
build:
87
runs-on: ubuntu-latest
9-
outputs:
10-
hash: ${{ steps.hash.outputs.hash }}
118
steps:
129
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
13-
- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
10+
- uses: astral-sh/setup-uv@f0ec1fc3b38f5e7cd731bb6ce540c5af426746bb # v6.1.0
1411
with:
15-
python-version: '3.x'
16-
cache: pip
17-
cache-dependency-path: requirements*/*.txt
18-
- run: pip install -r requirements/build.txt
19-
# Use the commit date instead of the current date during the build.
12+
enable-cache: true
13+
prune-cache: false
14+
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
15+
with:
16+
python-version-file: pyproject.toml
2017
- run: echo "SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)" >> $GITHUB_ENV
21-
- run: python -m build
22-
# Generate hashes used for provenance.
23-
- name: generate hash
24-
id: hash
25-
run: cd dist && echo "hash=$(sha256sum * | base64 -w0)" >> $GITHUB_OUTPUT
26-
- uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
18+
- run: uv build
19+
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
2720
with:
2821
path: ./dist
29-
provenance:
30-
needs: [build]
31-
permissions:
32-
actions: read
33-
id-token: write
34-
contents: write
35-
# Can't pin with hash due to how this workflow works.
36-
uses: slsa-framework/slsa-github-generator/.github/workflows/[email protected]
37-
with:
38-
base64-subjects: ${{ needs.build.outputs.hash }}
3922
create-release:
40-
# Upload the sdist, wheels, and provenance to a GitHub release. They remain
41-
# available as build artifacts for a while as well.
42-
needs: [provenance]
23+
needs: [build]
4324
runs-on: ubuntu-latest
4425
permissions:
4526
contents: write
4627
steps:
47-
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
28+
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
4829
- name: create release
49-
run: >
50-
gh release create --draft --repo ${{ github.repository }}
51-
${{ github.ref_name }}
52-
*.intoto.jsonl/* artifact/*
30+
run: gh release create --draft --repo ${{ github.repository }} ${{ github.ref_name }} artifact/*
5331
env:
5432
GH_TOKEN: ${{ github.token }}
5533
publish-pypi:
56-
needs: [provenance]
57-
# Wait for approval before attempting to upload to PyPI. This allows reviewing the
58-
# files in the draft release.
34+
needs: [build]
5935
environment:
6036
name: publish
6137
url: https://pypi.org/project/Quart/${{ github.ref_name }}
6238
runs-on: ubuntu-latest
6339
permissions:
6440
id-token: write
6541
steps:
66-
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
67-
- uses: pypa/gh-action-pypi-publish@15c56dba361d8335944d31a2ecd17d700fc7bcbc # v1.12.2
42+
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
43+
- uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4
6844
with:
6945
packages-dir: artifact/

.github/workflows/tests.yaml

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
name: Tests
22
on:
3+
pull_request:
4+
paths-ignore: ['docs/**', 'README.md']
35
push:
46
branches: [main, stable]
5-
paths-ignore: ['docs/**', '*.md', '*.rst']
6-
pull_request:
7-
paths-ignore: [ 'docs/**', '*.md', '*.rst' ]
7+
paths-ignore: ['docs/**', 'README.md']
88
jobs:
99
tests:
1010
name: ${{ matrix.name || matrix.python }}
@@ -22,27 +22,28 @@ jobs:
2222
- {python: '3.9'}
2323
steps:
2424
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
25-
- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
25+
- uses: astral-sh/setup-uv@f0ec1fc3b38f5e7cd731bb6ce540c5af426746bb # v6.1.0
26+
with:
27+
enable-cache: true
28+
prune-cache: false
29+
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
2630
with:
2731
python-version: ${{ matrix.python }}
28-
allow-prereleases: true
29-
cache: pip
30-
cache-dependency-path: requirements*/*.txt
31-
- run: pip install tox
32-
- run: tox run -e ${{ matrix.tox || format('py{0}', matrix.python) }}
32+
- run: uv run --locked tox run -e ${{ matrix.tox || format('py{0}', matrix.python) }}
3333
typing:
3434
runs-on: ubuntu-latest
3535
steps:
3636
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
37-
- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
37+
- uses: astral-sh/setup-uv@f0ec1fc3b38f5e7cd731bb6ce540c5af426746bb # v6.1.0
38+
with:
39+
enable-cache: true
40+
prune-cache: false
41+
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
3842
with:
39-
python-version: '3.x'
40-
cache: pip
41-
cache-dependency-path: requirements*/*.txt
43+
python-version-file: pyproject.toml
4244
- name: cache mypy
43-
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
45+
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
4446
with:
4547
path: ./.mypy_cache
4648
key: mypy|${{ hashFiles('pyproject.toml') }}
47-
- run: pip install tox
48-
- run: tox run -e typing
49+
- run: uv run --locked tox run -e typing

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
.idea/
22
.vscode/
3-
.venv*/
4-
venv*/
53
__pycache__/
64
dist/
75
.coverage*
86
htmlcov/
97
.tox/
8+
.hypothesis/
109
docs/reference/source
1110
docs/_build/

.pre-commit-config.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
repos:
22
- repo: https://github.com/astral-sh/ruff-pre-commit
3-
rev: v0.7.3
3+
rev: 9aeda5d1f4bbd212c557da1ea78eca9e8c829e19 # frozen: v0.11.13
44
hooks:
55
- id: ruff
66
- id: ruff-format
7+
- repo: https://github.com/astral-sh/uv-pre-commit
8+
rev: a621b109bab2e7e832d98c88fd3e83399f4e6657 # frozen: 0.7.12
9+
hooks:
10+
- id: uv-lock
711
- repo: https://github.com/pre-commit/pre-commit-hooks
8-
rev: v5.0.0
12+
rev: cef0300fd0fc4d2a87a85fa2093c6b283ea36f4b # frozen: v5.0.0
913
hooks:
1014
- id: check-merge-conflict
1115
- id: debug-statements

.readthedocs.yaml

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
version: 2
22
build:
3-
os: ubuntu-22.04
3+
os: ubuntu-24.04
44
tools:
5-
python: '3.12'
6-
python:
7-
install:
8-
- requirements: requirements/docs.txt
9-
- method: pip
10-
path: .
11-
sphinx:
12-
builder: html
13-
fail_on_warning: false
5+
python: '3.13'
6+
commands:
7+
- asdf plugin add uv
8+
- asdf install uv latest
9+
- asdf global uv latest
10+
# TODO fix warnings and add -W
11+
- uv run --group docs sphinx-build -b dirhtml docs $READTHEDOCS_OUTPUT/html

0 commit comments

Comments
 (0)