Skip to content

Commit 4dc26ca

Browse files
authored
Merge pull request #22 from pallets-eco/uv
use uv
2 parents 0b182c5 + 0a3d328 commit 4dc26ca

File tree

20 files changed

+1896
-550
lines changed

20 files changed

+1896
-550
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: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,24 @@ name: pre-commit
22
on:
33
pull_request:
44
push:
5-
branches: [main, '*.x']
5+
branches: [main, stable]
66
jobs:
77
main:
88
runs-on: ubuntu-latest
99
steps:
10-
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
11-
- uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
12-
with:
13-
python-version: 3.x
14-
- uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1
15-
- uses: pre-commit-ci/lite-action@9d882e7a565f7008d4faf128f27d1cb6503d4ebf # v1.0.2
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: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,27 @@
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@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
12+
- uses: astral-sh/setup-uv@f0ec1fc3b38f5e7cd731bb6ce540c5af426746bb # v6.1.0
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
26-
- uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
24+
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
2725
with:
2826
path: ./dist
2927
provenance:
@@ -33,18 +31,16 @@ jobs:
3331
id-token: write
3432
contents: write
3533
# Can't pin with hash due to how this workflow works.
36-
uses: slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@5a775b367a56d5bd118a224a811bba288150a563 # v2.0.0
34+
uses: slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v2.1.0
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@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
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-SQLAlchemy-Lite/${{ github.ref_name }}
6256
runs-on: ubuntu-latest
6357
permissions:
6458
id-token: write
6559
steps:
66-
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
67-
- uses: pypa/gh-action-pypi-publish@15c56dba361d8335944d31a2ecd17d700fc7bcbc # v1.12.2
60+
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
61+
- uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4
6862
with:
6963
packages-dir: artifact/

.github/workflows/tests.yaml

Lines changed: 18 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,10 @@
11
name: Tests
22
on:
3-
push:
4-
branches:
5-
- main
6-
- '*.x'
7-
paths-ignore:
8-
- 'docs/**'
9-
- '*.md'
10-
- '*.rst'
113
pull_request:
12-
paths-ignore:
13-
- 'docs/**'
14-
- '*.md'
15-
- '*.rst'
4+
paths-ignore: ['docs/**', 'README.md']
5+
push:
6+
branches: [main, stable]
7+
paths-ignore: ['docs/**', 'README.md']
168
jobs:
179
tests:
1810
name: ${{ matrix.name || matrix.python }}
@@ -28,27 +20,28 @@ jobs:
2820
- {python: '3.9'}
2921
steps:
3022
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
31-
- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
23+
- uses: astral-sh/setup-uv@f0ec1fc3b38f5e7cd731bb6ce540c5af426746bb # v6.1.0
24+
with:
25+
enable-cache: true
26+
prune-cache: false
27+
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
3228
with:
3329
python-version: ${{ matrix.python }}
34-
allow-prereleases: true
35-
cache: pip
36-
cache-dependency-path: requirements*/*.txt
37-
- run: pip install tox
38-
- run: tox run -e ${{ matrix.tox || format('py{0}', matrix.python) }}
30+
- run: uv run --locked tox run -e ${{ matrix.tox || format('py{0}', matrix.python) }}
3931
typing:
4032
runs-on: ubuntu-latest
4133
steps:
4234
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
43-
- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
35+
- uses: astral-sh/setup-uv@f0ec1fc3b38f5e7cd731bb6ce540c5af426746bb # v6.1.0
36+
with:
37+
enable-cache: true
38+
prune-cache: false
39+
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
4440
with:
45-
python-version: '3.x'
46-
cache: pip
47-
cache-dependency-path: requirements*/*.txt
41+
python-version-file: pyproject.toml
4842
- name: cache mypy
49-
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
43+
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
5044
with:
5145
path: ./.mypy_cache
5246
key: mypy|${{ hashFiles('pyproject.toml') }}
53-
- run: pip install tox
54-
- run: tox run -e typing
47+
- 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 & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1-
ci:
2-
autoupdate_schedule: monthly
31
repos:
42
- repo: https://github.com/astral-sh/ruff-pre-commit
5-
rev: v0.7.3
3+
rev: d19233b89771be2d89273f163f5edc5a39bbc34a # frozen: v0.11.12
64
hooks:
75
- id: ruff
86
- id: ruff-format
7+
- repo: https://github.com/astral-sh/uv-pre-commit
8+
rev: 5763f5f580fa24d9d32c85bc3bae8cca4a8f8945 # frozen: 0.7.9
9+
hooks:
10+
- id: uv-lock
911
- repo: https://github.com/pre-commit/pre-commit-hooks
10-
rev: v5.0.0
12+
rev: cef0300fd0fc4d2a87a85fa2093c6b283ea36f4b # frozen: v5.0.0
1113
hooks:
1214
- id: check-merge-conflict
1315
- id: debug-statements

.readthedocs.yaml

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +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-
builder: dirhtml
13-
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)