Skip to content

Commit 1423248

Browse files
committed
Migrate to uv and use dependency groups
1 parent 20b85b4 commit 1423248

9 files changed

Lines changed: 1332 additions & 69 deletions

File tree

.github/workflows/build-release.yml

Lines changed: 16 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: build
22
on:
33
push:
4-
branches: ["main", "*.x-line"]
4+
branches: ["dev", "*.x-line"]
55
tags: ["*"]
66
pull_request:
77

@@ -16,20 +16,16 @@ jobs:
1616
fail-fast: false
1717
matrix:
1818
include:
19-
- { name: '3.10', python: '3.10', tox: py310 }
20-
- { name: '3.14', python: '3.14', tox: py314 }
19+
- { name: "3.10", tox: py310 }
20+
- { name: "3.14", tox: py314 }
2121
steps:
2222
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
2323
with:
2424
persist-credentials: false
25-
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
26-
with:
27-
python-version: ${{ matrix.python }}
28-
allow-prereleases: true
29-
- name: Run test
30-
run: |
31-
python -m pip install tox
32-
python -m tox -e ${{ matrix.tox }}
25+
- uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
26+
with: # zizmor: ignore[cache-poisoning] cache key is lockfile-derived
27+
enable-cache: true
28+
- run: uv run tox -e ${{ matrix.tox }}
3329
- name: Upload coverage
3430
uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6
3531
build:
@@ -39,17 +35,11 @@ jobs:
3935
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
4036
with:
4137
persist-credentials: false
42-
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
43-
with:
44-
python-version: "3.14"
45-
- name: Install pypa/build
46-
run: python -m pip install build
47-
- name: Build a binary wheel and a source tarball
48-
run: python -m build
49-
- name: Install twine
50-
run: python -m pip install twine
51-
- name: Check build
52-
run: python -m twine check --strict dist/*
38+
- uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
39+
with: # zizmor: ignore[cache-poisoning] cache key is lockfile-derived
40+
enable-cache: true
41+
- run: uv build
42+
- run: uvx twine check --strict dist/*
5343
- name: Store the distribution packages
5444
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
5545
with:
@@ -64,11 +54,10 @@ jobs:
6454
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
6555
with:
6656
persist-credentials: false
67-
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
68-
with:
69-
python-version: "3.14"
70-
- run: python -m pip install tox
71-
- run: python -m tox -e lint
57+
- uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
58+
with: # zizmor: ignore[cache-poisoning] cache key is lockfile-derived
59+
enable-cache: true
60+
- run: uv run tox -e lint
7261
publish-to-pypi:
7362
name: PyPI release
7463
if: startsWith(github.ref, 'refs/tags/')

.pre-commit-config.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,7 @@ repos:
2121
hooks:
2222
- id: blacken-docs
2323
additional_dependencies: [black==23.12.1]
24+
- repo: https://github.com/astral-sh/uv-pre-commit
25+
rev: 0.10.9
26+
hooks:
27+
- id: uv-lock

.readthedocs.yaml

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

.readthedocs.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# https://docs.readthedocs.com/platform/stable/build-customization.html#install-dependencies-with-uv
2+
version: 2
3+
sphinx:
4+
configuration: docs/conf.py
5+
formats:
6+
- pdf
7+
build:
8+
os: ubuntu-24.04
9+
tools:
10+
python: "3.13"
11+
jobs:
12+
pre_create_environment:
13+
- asdf plugin add uv
14+
- asdf install uv latest
15+
- asdf global uv latest
16+
create_environment:
17+
- uv venv "${READTHEDOCS_VIRTUALENV_PATH}"
18+
install:
19+
- UV_PROJECT_ENVIRONMENT="${READTHEDOCS_VIRTUALENV_PATH}" uv sync --frozen --group docs

CONTRIBUTING.rst

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,20 @@ Setting Up for Local Development
1414
$ git clone https://github.com/marshmallow-code/flask-smorest.git
1515
$ cd flask-smorest
1616

17-
2. Install development requirements.
18-
**It is highly recommended that you use a virtualenv.**
19-
Use the following command to install an editable version of
20-
flask-smorest along with its development requirements.
17+
2. Install `uv <https://docs.astral.sh/uv/getting-started/installation/>`_.
18+
19+
3. Install development requirements.
2120

2221
::
2322

24-
# After activating your virtualenv
25-
$ pip install -e '.[dev]'
23+
$ uv sync
2624

27-
3. Install the pre-commit hooks, which will format and lint your git staged files.
25+
4. (Optional but recommended) Install the pre-commit hooks, which will format and lint your git staged files.
2826

2927
::
3028

31-
# The pre-commit CLI was installed above
32-
$ pre-commit install
29+
$ uv run pre-commit install --allow-missing-config
30+
3331

3432
Git Branch Structure
3533
++++++++++++++++++++
@@ -71,7 +69,7 @@ Running tests
7169

7270
To run all tests: ::
7371

74-
$ pytest
72+
$ uv run pytest
7573

7674
To run formatting and syntax checks: ::
7775

docs/requirements.txt

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

pyproject.toml

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -37,30 +37,34 @@ Issues = "https://github.com/marshmallow-code/flask-smorest/issues"
3737
Source = "https://github.com/marshmallow-code/flask-smorest"
3838
Tidelift = "https://tidelift.com/subscription/pkg/pypi-marshmallow?utm_source=pypi-marshmallow&utm_medium=pypi"
3939

40-
[project.optional-dependencies]
40+
[dependency-groups]
4141
docs = [
42-
"sphinx==9.1.0",
43-
"sphinx-issues==6.0.0",
44-
"alabaster==1.0.0",
42+
"sphinx",
43+
"sphinx-issues",
44+
"alabaster",
4545
]
4646
tests = [
47-
"packaging>=24.2",
48-
"pytest==9.0.3",
49-
"pytest-cov==7.1.0",
50-
"coverage==7.13.5",
51-
"werkzeug==3.1.8",
52-
"flask[async]==3.1.3",
47+
"packaging",
48+
"pytest",
49+
"pytest-cov",
50+
"coverage",
51+
"werkzeug",
52+
"flask[async]",
5353
"marshmallow",
54-
"webargs==8.7.1",
55-
"apispec==6.10.0",
56-
"PyYAML==6.0.3",
54+
"webargs",
55+
"apispec",
56+
"PyYAML",
5757
]
5858
dev = [
59-
"flask-smorest[tests]",
59+
{ include-group = "tests" },
6060
"tox",
61+
"tox-uv",
6162
"pre-commit>=3.6,<5.0",
6263
]
6364

65+
[tool.uv]
66+
default-groups = ["dev"]
67+
6468
[build-system]
6569
requires = ["flit_core<4"]
6670
build-backend = "flit_core.buildapi"

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ envlist =
55
skip_missing_interpreters = True
66

77
[testenv]
8-
extras = tests
8+
dependency_groups = tests
99
commands =
1010
pytest --cov=flask_smorest --cov-branch --cov-report=term-missing --cov-report=xml
1111

0 commit comments

Comments
 (0)