Skip to content

Commit 941efd4

Browse files
authored
use uv (#5727)
2 parents e785166 + 0109e49 commit 941efd4

24 files changed

+1876
-534
lines changed

.github/workflows/lock.yaml

Lines changed: 1 addition & 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:

.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@8d9ed9ac5c53483de85588cdf95a591a75ab9f55 # v5.5.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@6b9c6063abd6010835644d4c2e1bef4cf5cd0fca # v6.0.1
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: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,23 @@
11
name: Publish
22
on:
33
push:
4-
tags:
5-
- '*'
4+
tags: ['*']
65
jobs:
76
build:
87
runs-on: ubuntu-latest
98
outputs:
109
hash: ${{ steps.hash.outputs.hash }}
1110
steps:
1211
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
13-
- uses: actions/setup-python@8d9ed9ac5c53483de85588cdf95a591a75ab9f55 # v5.5.0
12+
- uses: astral-sh/setup-uv@6b9c6063abd6010835644d4c2e1bef4cf5cd0fca # v6.0.1
1413
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.
14+
enable-cache: true
15+
prune-cache: false
16+
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
17+
with:
18+
python-version-file: pyproject.toml
2019
- run: echo "SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)" >> $GITHUB_ENV
21-
- run: python -m build
22-
# Generate hashes used for provenance.
20+
- run: uv build
2321
- name: generate hash
2422
id: hash
2523
run: cd dist && echo "hash=$(sha256sum * | base64 -w0)" >> $GITHUB_OUTPUT
@@ -37,14 +35,12 @@ jobs:
3735
with:
3836
base64-subjects: ${{ needs.build.outputs.hash }}
3937
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.
4238
needs: [provenance]
4339
runs-on: ubuntu-latest
4440
permissions:
4541
contents: write
4642
steps:
47-
- uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.2.1
43+
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
4844
- name: create release
4945
run: >
5046
gh release create --draft --repo ${{ github.repository }}
@@ -54,16 +50,14 @@ jobs:
5450
GH_TOKEN: ${{ github.token }}
5551
publish-pypi:
5652
needs: [provenance]
57-
# Wait for approval before attempting to upload to PyPI. This allows reviewing the
58-
# files in the draft release.
5953
environment:
6054
name: publish
6155
url: https://pypi.org/project/Flask/${{ github.ref_name }}
6256
runs-on: ubuntu-latest
6357
permissions:
6458
id-token: write
6559
steps:
66-
- uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.2.1
60+
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
6761
- uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4
6862
with:
6963
packages-dir: artifact/

.github/workflows/tests.yaml

Lines changed: 21 additions & 20 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 }}
@@ -14,38 +14,39 @@ jobs:
1414
matrix:
1515
include:
1616
- {python: '3.13'}
17+
- {name: Windows, python: '3.13', os: windows-latest}
18+
- {name: Mac, python: '3.13', os: macos-latest}
1719
- {python: '3.12'}
18-
- {name: Windows, python: '3.12', os: windows-latest}
19-
- {name: Mac, python: '3.12', os: macos-latest}
2020
- {python: '3.11'}
2121
- {python: '3.10'}
2222
- {python: '3.9'}
23-
- {name: PyPy, python: 'pypy-3.10', tox: pypy310}
24-
- {name: Minimum Versions, python: '3.12', tox: py-min}
25-
- {name: Development Versions, python: '3.9', tox: py-dev}
23+
- {name: PyPy, python: 'pypy-3.11', tox: pypy3.11}
24+
- {name: Minimum Versions, python: '3.13', tox: tests-min}
25+
- {name: Development Versions, python: '3.10', tox: tests-dev}
2626
steps:
2727
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
28-
- uses: actions/setup-python@8d9ed9ac5c53483de85588cdf95a591a75ab9f55 # v5.5.0
28+
- uses: astral-sh/setup-uv@6b9c6063abd6010835644d4c2e1bef4cf5cd0fca # v6.0.1
29+
with:
30+
enable-cache: true
31+
prune-cache: false
32+
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
2933
with:
3034
python-version: ${{ matrix.python }}
31-
allow-prereleases: true
32-
cache: pip
33-
cache-dependency-path: requirements*/*.txt
34-
- run: pip install tox
35-
- run: tox run -e ${{ matrix.tox || format('py{0}', matrix.python) }}
35+
- run: uv run --locked tox run -e ${{ matrix.tox || format('py{0}', matrix.python) }}
3636
typing:
3737
runs-on: ubuntu-latest
3838
steps:
3939
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
40-
- uses: actions/setup-python@8d9ed9ac5c53483de85588cdf95a591a75ab9f55 # v5.5.0
40+
- uses: astral-sh/setup-uv@6b9c6063abd6010835644d4c2e1bef4cf5cd0fca # v6.0.1
41+
with:
42+
enable-cache: true
43+
prune-cache: false
44+
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
4145
with:
42-
python-version: '3.x'
43-
cache: pip
44-
cache-dependency-path: requirements*/*.txt
46+
python-version-file: pyproject.toml
4547
- name: cache mypy
4648
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
4749
with:
4850
path: ./.mypy_cache
4951
key: mypy|${{ hashFiles('pyproject.toml') }}
50-
- run: pip install tox
51-
- run: tox run -e typing
52+
- run: uv run --locked tox run -e typing

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
.idea/
22
.vscode/
3-
.venv*/
4-
venv*/
53
__pycache__/
64
dist/
75
.coverage*

.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.11.2
3+
rev: 24e02b24b8ab2b7c76225602d13fa60e12d114e6 # frozen: v0.11.9
44
hooks:
55
- id: ruff
66
- id: ruff-format
7+
- repo: https://github.com/astral-sh/uv-pre-commit
8+
rev: 14ac15b122e538e407d036ff45e3895b7cf4a2bf # frozen: 0.7.3
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: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
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-
configuration: docs/conf.py
13-
builder: dirhtml
14-
fail_on_warning: true
5+
python: '3.13'
6+
commands:
7+
- asdf plugin add uv
8+
- asdf install uv latest
9+
- asdf global uv latest
10+
- uv run --group docs sphinx-build -W -b dirhtml docs $READTHEDOCS_OUTPUT/html

0 commit comments

Comments
 (0)