Skip to content

Commit 357bfed

Browse files
committed
Update pyproject.toml for uv and RTD
For uv we should use dependency-groups. This patch updates our scripts to use the appropriate dependency-groups when running. It also adds back project.optional-dependencies, which is only used for ReadTheDocs due to its lack of native support for uv at the time. Development directions are updated as we do not actually need to manually build a uv virtual environment, now that the appropriate commands are using dependency-groups.
1 parent 0bbcdcb commit 357bfed

File tree

6 files changed

+26
-17
lines changed

6 files changed

+26
-17
lines changed

.readthedocs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ python:
2323
- method: pip
2424
path: .
2525
extra_requirements:
26-
- dev
26+
- docs

bin/lint.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ dir=$(dirname "$0")
44
cd "$dir/.."
55

66
exitCode=0
7-
uv run ruff check --fix
7+
uv run --group dev ruff check --fix
88
code=$?; test $code -eq 0 || exitCode=$code
9-
uv run ruff format
9+
uv run --group dev ruff format
1010
code=$?; test $code -eq 0 || exitCode=$code
11-
uv run validate-pyproject pyproject.toml
11+
uv run --group dev validate-pyproject pyproject.toml
1212
code=$?; test $code -eq 0 || exitCode=$code
1313
exit $exitCode

bin/test.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ do
4747
echo "-------------------------------------"
4848
if [ $# -gt 0 ]
4949
then
50-
uv run python -m pytest -p no:faulthandler $flag --java $java $@
50+
uv run --group dev python -m pytest -p no:faulthandler $flag --java $java $@
5151
else
52-
uv run python -m pytest -p no:faulthandler $flag --java $java tests
52+
uv run --group dev python -m pytest -p no:faulthandler $flag --java $java tests
5353
fi
5454
code=$?
5555
if [ $code -eq 0 ]

doc/Development.md

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,7 @@ If you are testing a project that *uses* `pyimagej` and need to see how changes
2929

3030
PyImageJ documentation is built as a [Sphinx](https://www.sphinx-doc.org/en/master/)-built [ReadTheDocs](https://about.readthedocs.com/) site.
3131

32-
To build the documentation, **you must create a `uv` virtual environment** with the additional development dependencies:
33-
34-
```bash
35-
uv pip install -e ".[dev]"
36-
```
37-
38-
Then, you can either use the documentation's own `Makefile` in the `/docs` directory:
32+
You can either use the documentation's own `Makefile` in the `/docs` directory:
3933

4034
```bash
4135
make html

doc/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# You can set these variables from the command line, and also
55
# from the environment for the first two.
66
SPHINXOPTS ?=
7-
SPHINXBUILD ?= uv run sphinx-build
7+
SPHINXBUILD ?= uv run --group docs sphinx-build
88
SOURCEDIR = .
99
BUILDDIR = _build
1010

pyproject.toml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,19 +43,23 @@ dependencies = [
4343
"xarray",
4444
]
4545

46-
[project.optional-dependencies]
46+
[dependency-groups]
4747
# Development tools
4848
dev = [
4949
"build",
50-
"myst-nb",
5150
"pre-commit",
5251
"pytest",
5352
"ruff",
53+
"validate-pyproject[all]",
54+
]
55+
# Local ReadTheDocs building
56+
# NOTE: duplicated in project.optional-dependencies
57+
docs = [
58+
"myst-nb",
5459
"sphinx",
5560
"sphinx-copybutton",
5661
"sphinx_rtd_theme",
5762
"readthedocs-sphinx-search",
58-
"validate-pyproject[all]",
5963
]
6064
# Matplotlib display backend
6165
matplotlib = [
@@ -70,6 +74,17 @@ notebooks = [
7074
"scikit-image",
7175
]
7276

77+
# Remote ReadTheDocs building
78+
# NOTE: duplicated in dependency-groups
79+
[project.optional-dependencies]
80+
docs = [
81+
"myst-nb",
82+
"sphinx",
83+
"sphinx-copybutton",
84+
"sphinx_rtd_theme",
85+
"readthedocs-sphinx-search",
86+
]
87+
7388
[project.scripts]
7489
imagej = "imagej:imagej_main"
7590

0 commit comments

Comments
 (0)