Skip to content

Commit ebd60ea

Browse files
committed
Migrate to uv and dependency groups
1 parent 01fccd9 commit ebd60ea

9 files changed

Lines changed: 1833 additions & 49 deletions

File tree

.github/dependabot.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
version: 2
22
updates:
3-
- package-ecosystem: pip
3+
- package-ecosystem: uv
44
directory: "/"
55
schedule:
6-
interval: daily
7-
open-pull-requests-limit: 10
6+
interval: monthly
7+
groups:
8+
all-dependencies:
9+
patterns: ["*"]
810
- package-ecosystem: "github-actions"
911
directory: "/"
1012
schedule:
1113
interval: "monthly"
14+
groups:
15+
all-actions:
16+
patterns: ["*"]

.github/workflows/build-release.yml

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,27 +20,22 @@ jobs:
2020
- { name: "mypy-madev", python: "3.13", tox: mypy-marshmallowdev }
2121
steps:
2222
- uses: actions/checkout@v6
23-
- uses: actions/setup-python@v6
23+
- uses: astral-sh/setup-uv@v7
2424
with:
2525
python-version: ${{ matrix.python }}
26-
- run: python -m pip install tox
27-
- run: python -m tox -e${{ matrix.tox }}
26+
enable-cache: true
27+
- run: uv run tox -e${{ matrix.tox }}
2828
build:
2929
name: Build package
3030
runs-on: ubuntu-latest
3131
steps:
3232
- uses: actions/checkout@v6
33-
- uses: actions/setup-python@v6
33+
- uses: astral-sh/setup-uv@v7
3434
with:
3535
python-version: "3.13"
36-
- name: Install pypa/build
37-
run: python -m pip install build
38-
- name: Build a binary wheel and a source tarball
39-
run: python -m build
40-
- name: Install twine
41-
run: python -m pip install twine
42-
- name: Check build
43-
run: python -m twine check --strict dist/*
36+
enable-cache: true
37+
- run: uv build
38+
- run: uvx twine check --strict dist/*
4439
- name: Store the distribution packages
4540
uses: actions/upload-artifact@v7
4641
with:
@@ -53,11 +48,11 @@ jobs:
5348
runs-on: ubuntu-latest
5449
steps:
5550
- uses: actions/checkout@v6
56-
- uses: actions/setup-python@v6
51+
- uses: astral-sh/setup-uv@v7
5752
with:
5853
python-version: "3.13"
59-
- run: python -m pip install tox
60-
- run: python -m tox -e lint
54+
enable-cache: true
55+
- run: uv run tox -e lint
6156
publish-to-pypi:
6257
name: PyPI release
6358
if: startsWith(github.ref, 'refs/tags/')

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ nosetests.xml
3535
.project
3636
.pydevproject
3737

38+
# Virtualenvs
39+
.venv
40+
3841
# Complexity
3942
output/*.html
4043
output/*/index.html

.pre-commit-config.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,7 @@ repos:
1616
hooks:
1717
- id: blacken-docs
1818
additional_dependencies: [black==25.1.0]
19+
- repo: https://github.com/astral-sh/uv-pre-commit
20+
rev: 0.10.9
21+
hooks:
22+
- id: uv-lock

.readthedocs.yml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
1+
# https://docs.readthedocs.com/platform/stable/build-customization.html#install-dependencies-with-uv
12
version: 2
23
sphinx:
34
configuration: docs/conf.py
45
formats:
56
- pdf
67
build:
7-
os: ubuntu-22.04
8+
os: ubuntu-24.04
89
tools:
910
python: "3.13"
10-
python:
11-
install:
12-
- method: pip
13-
path: .
14-
extra_requirements:
15-
- docs
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: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,19 @@ Setting up for local development
1818
$ git clone https://github.com/marshmallow-code/marshmallow-sqlalchemy.git
1919
$ cd marshmallow-sqlalchemy
2020
21-
2. Install development requirements. **It is highly recommended that you use a virtualenv.**
22-
Use the following command to install an editable version of
23-
marshmallow-sqlalchemy along with its development requirements.
21+
2. Install `uv <https://docs.astral.sh/uv/getting-started/installation/>`_.
22+
23+
3. Install development requirements.
2424

2525
.. code-block:: shell-session
2626
27-
# After activating your virtualenv
28-
$ pip install -e '.[dev]'
27+
$ uv sync
2928
30-
3. Install the pre-commit hooks, which will format and lint your git staged files.
29+
4. (Optional but recommended) Install the pre-commit hooks, which will format and lint your git staged files.
3130

3231
.. code-block:: shell-session
3332
34-
# The pre-commit CLI was installed above
35-
$ pre-commit install
33+
$ uv run pre-commit install --allow-missing-config
3634
3735
Pull requests
3836
--------------
@@ -70,19 +68,19 @@ To run all tests:
7068

7169
.. code-block:: shell-session
7270
73-
$ pytest
71+
$ uv run pytest
7472
7573
To run formatting and syntax checks:
7674

7775
.. code-block:: shell-session
7876
79-
$ tox -e lint
77+
$ uv run tox -e lint
8078
8179
(Optional) To run tests in all supported Python versions in their own virtual environments (must have each interpreter installed):
8280

8381
.. code-block:: shell-session
8482
85-
$ tox
83+
$ uv run tox
8684
8785
Documentation
8886
-------------
@@ -93,7 +91,7 @@ To build and serve the docs in "watch" mode:
9391

9492
.. code-block:: shell-session
9593
96-
$ tox -e docs-serve
94+
$ uv run tox -e docs-serve
9795
9896
Changes to documentation will automatically trigger a rebuild.
9997

pyproject.toml

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,25 @@ Funding = "https://opencollective.com/marshmallow"
2828
Issues = "https://github.com/marshmallow-code/marshmallow-sqlalchemy/issues"
2929
Source = "https://github.com/marshmallow-code/marshmallow-sqlalchemy"
3030

31-
[project.optional-dependencies]
31+
[dependency-groups]
3232
docs = [
33-
"furo==2025.12.19",
34-
"sphinx-copybutton==0.5.2",
35-
"sphinx-design==0.6.1",
36-
"sphinx-issues==5.0.1",
37-
"sphinx==8.2.3; python_version >= '3.11'",
38-
"sphinxext-opengraph==0.13.0",
33+
"furo",
34+
"sphinx-copybutton",
35+
"sphinx-design",
36+
"sphinx-issues",
37+
"sphinx>=8.1; python_version >= '3.11'",
38+
"sphinxext-opengraph",
3939
]
40-
tests = ["pytest<10", "pytest-lazy-fixtures"]
41-
dev = ["marshmallow-sqlalchemy[tests]", "tox", "pre-commit>=3.5,<5.0"]
40+
tests = ["pytest", "pytest-lazy-fixtures"]
41+
dev = [
42+
{ include-group = "tests" },
43+
"tox",
44+
"tox-uv",
45+
"pre-commit>=3.5,<5.0",
46+
]
47+
48+
[tool.uv]
49+
default-groups = ["dev"]
4250

4351
[build-system]
4452
requires = ["flit_core<4"]

tox.ini

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ envlist=
88
docs
99

1010
[testenv]
11-
extras = tests
11+
dependency_groups = tests
1212
deps =
1313
marshmallow3: marshmallow>=3.18.0,<4.0.0
1414
marshmallowdev: https://github.com/marshmallow-code/marshmallow/archive/dev.tar.gz
@@ -29,14 +29,14 @@ skip_install = true
2929
commands = pre-commit run --all-files
3030

3131
[testenv:docs]
32-
extras = docs
32+
dependency_groups = docs
3333
commands = sphinx-build docs/ docs/_build {posargs}
3434

3535
; Below tasks are for development only (not run in CI)
3636

3737
[testenv:docs-serve]
3838
deps = sphinx-autobuild
39-
extras = docs
39+
dependency_groups = docs
4040
commands = sphinx-autobuild --port=0 --open-browser --delay=2 docs/ docs/_build {posargs} --watch src --watch CONTRIBUTING.rst --watch README.rst
4141

4242
[testenv:readme-serve]

0 commit comments

Comments
 (0)