Skip to content

Commit 81fec56

Browse files
committed
Switch to uv for dependency management and loc inactive discussions
1 parent b5593ca commit 81fec56

19 files changed

Lines changed: 1709 additions & 507 deletions

.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@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: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,19 @@ jobs:
1010
hash: ${{ steps.hash.outputs.hash }}
1111
steps:
1212
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
13-
- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
13+
- uses: astral-sh/setup-uv@6b9c6063abd6010835644d4c2e1bef4cf5cd0fca # v6.0.1
1414
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.
15+
enable-cache: true
16+
prune-cache: false
17+
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
18+
with:
19+
python-version-file: pyproject.toml
2020
- run: echo "SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)" >> $GITHUB_ENV
21-
- run: python -m build
22-
# Generate hashes used for provenance.
21+
- run: uv build
2322
- name: generate hash
2423
id: hash
2524
run: cd dist && echo "hash=$(sha256sum * | base64 -w0)" >> $GITHUB_OUTPUT
26-
- uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
25+
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
2726
with:
2827
path: ./dist
2928
provenance:

.github/workflows/tests.yaml

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -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@6b9c6063abd6010835644d4c2e1bef4cf5cd0fca # v6.0.1
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@6b9c6063abd6010835644d4c2e1bef4cf5cd0fca # v6.0.1
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 & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@ dist/
77
.coverage*
88
htmlcov/
99
.tox/
10+
.hypothesis/
1011
docs/reference/source
1112
docs/_build/

pyproject.toml

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,52 @@ dotenv = ["python-dotenv"]
4646
[project.scripts]
4747
quart = "quart.cli:main"
4848

49+
[dependency-groups]
50+
dev = [
51+
"ruff",
52+
"tox",
53+
"tox-uv",
54+
]
55+
docs = [
56+
"myst-parser",
57+
"pydata-sphinx-theme",
58+
"sphinx",
59+
]
60+
gha-update = [
61+
"gha-update ; python_full_version >= '3.12'",
62+
]
63+
pre-commit = [
64+
"pre-commit",
65+
"pre-commit-uv",
66+
]
67+
tests = [
68+
"hypothesis",
69+
"pytest",
70+
"pytest-asyncio",
71+
"pytest-cov",
72+
"pytest-sugar",
73+
"python-dotenv",
74+
]
75+
typing = [
76+
"mypy",
77+
"hypothesis",
78+
"pyright",
79+
"pytest",
80+
"pytest-asyncio",
81+
"types-aiofiles",
82+
"python-dotenv",
83+
]
84+
4985
[build-system]
5086
requires = ["flit-core<4"]
5187
build-backend = "flit_core.buildapi"
5288

5389
[tool.flit.module]
5490
name = "quart"
5591

92+
[tool.uv]
93+
default-groups = ["dev", "pre-commit", "tests", "typing"]
94+
5695
[tool.pytest.ini_options]
5796
addopts = "--no-cov-on-fail --showlocals --strict-markers"
5897
asyncio_default_fixture_loop_scope = "session"
@@ -107,3 +146,64 @@ select = [
107146
[tool.ruff.lint.isort]
108147
force-single-line = true
109148
order-by-type = false
149+
150+
[tool.tox]
151+
env_list = [
152+
"py3.13", "py3.12", "py3.11", "py3.10", "py3.9",
153+
"style",
154+
"typing",
155+
"docs",
156+
]
157+
158+
[tool.tox.env_run_base]
159+
description = "pytest on latest dependency versions"
160+
runner = "uv-venv-lock-runner"
161+
package = "wheel"
162+
wheel_build_env = ".pkg"
163+
constrain_package_deps = true
164+
use_frozen_constraints = true
165+
dependency_groups = ["tests"]
166+
commands = [[
167+
"pytest", "-v", "--tb=short", "--basetemp={env_tmp_dir}", "--cov=quart",
168+
{replace = "posargs", default = [], extend = true},
169+
]]
170+
171+
[tool.tox.env.style]
172+
description = "run all pre-commit hooks on all files"
173+
dependency_groups = ["pre-commit"]
174+
skip_install = true
175+
commands = [["pre-commit", "run", "--all-files"]]
176+
177+
[tool.tox.env.typing]
178+
description = "run static type checkers"
179+
dependency_groups = ["typing"]
180+
commands = [
181+
["mypy"],
182+
]
183+
184+
[tool.tox.env.docs]
185+
description = "build docs"
186+
dependency_groups = ["docs"]
187+
commands = [["sphinx-build", "-E", "-b", "html", "docs", "docs/_build/html"]]
188+
189+
[tool.tox.env.update-actions]
190+
description = "update GitHub Actions pins"
191+
labels = ["update"]
192+
dependency_groups = ["gha-update"]
193+
skip_install = true
194+
commands = [["gha-update"]]
195+
196+
[tool.tox.env.update-pre_commit]
197+
description = "update pre-commit pins"
198+
labels = ["update"]
199+
dependency_groups = ["pre-commit"]
200+
skip_install = true
201+
commands = [["pre-commit", "autoupdate", "-j4"]]
202+
203+
[tool.tox.env.update-requirements]
204+
description = "update uv lock"
205+
labels = ["update"]
206+
dependency_groups = []
207+
no_default_groups = true
208+
skip_install = true
209+
commands = [["uv", "lock", {replace = "posargs", default = ["-U"], extend = true}]]

requirements/build.in

Lines changed: 0 additions & 1 deletion
This file was deleted.

requirements/build.txt

Lines changed: 0 additions & 8 deletions
This file was deleted.

requirements/dev.in

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)