Skip to content

Commit 2fedc26

Browse files
committed
🔧 📝 Switch to dependency groups
* Update README * Update readthedocs config * Update GitHub workflow
1 parent 3c6bbad commit 2fedc26

File tree

8 files changed

+38
-38
lines changed

8 files changed

+38
-38
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
run: |
3737
uv venv
3838
echo "$PWD/.venv/bin" >> $GITHUB_PATH
39-
uv pip install -e ".[docs]"
39+
uv pip install --group=docs
4040
- name: Build HTML and check links
4141
run: |
4242
make html

.readthedocs.yaml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ build:
1313
- plantuml
1414
tools:
1515
python: "3.12"
16+
jobs:
17+
install:
18+
- python -m pip install --upgrade pip
19+
- python -m pip install --group=docs
1620

1721
# Build documentation in the docs/ directory with Sphinx
1822
sphinx:
@@ -22,11 +26,3 @@ sphinx:
2226
formats:
2327
- epub
2428
- pdf
25-
26-
# Optionally declare the Python requirements required to build your docs
27-
python:
28-
install:
29-
- method: pip
30-
path: .
31-
extra_requirements:
32-
- docs

README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ Installation
4949
$ python3 -m venv .venv
5050
$ . .venv/bin/activate
5151
$ python -m pip install --upgrade pip
52-
$ python -m pip install -e ".[dev]"
52+
$ python -m pip install --group dev
5353
5454
… on Windows:
5555

@@ -58,7 +58,7 @@ Installation
5858
C:> py -m venv .venv
5959
C:> .\.venv\Scripts\activate.bat
6060
C:> python -m pip install --upgrade pip
61-
C:> python -m pip install -e ".[dev]"
61+
C:> python -m pip install --group dev
6262
6363
#. Create HTML documentation:
6464

docs/document/sphinx/test.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,13 @@ whether the documentation is being built and the links are valid. In
101101
[testenv:docs]
102102
# Keep base_python in sync with ci.yml and .readthedocs.yaml.
103103
base_python = py312
104-
extras = docs
104+
dependency_groups = docs
105105
commands =
106106
sphinx-build -n -T -W -b html -d {envtmpdir}/doctrees docs docs/_build/html
107107
108108
[testenv:docs-linkcheck]
109109
base_python = {[testenv:docs]base_python}
110-
extras = {[testenv:docs]extras}
110+
dependency_groups = docs
111111
commands = sphinx-build -W -b linkcheck -d {envtmpdir}/doctrees docs docs/_build/html
112112
113113
You can then define the following jobs for GitHub, for example:
@@ -300,7 +300,7 @@ example:
300300
:caption: pyproject.toml
301301
:emphasize-lines: 4, 8-
302302
303-
[project.optional-dependencies]
303+
[dependency-groups]
304304
tests = [
305305
"coverage[toml]",
306306
"interrogate",

docs/packs/dataprep/pyproject.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ dependencies = [
2121
"pandas",
2222
]
2323

24-
[project.optional-dependencies]
24+
[dependency-groups]
2525
tests = [
2626
"coverage[toml]",
2727
"pytest>=6.0",
@@ -33,8 +33,9 @@ docs = [
3333
"sphinx_inline_tabs"
3434
]
3535
dev = [
36-
"dataprep[tests, docs]",
37-
"pre-commit"
36+
{include-group = "tests"},
37+
{include-group = "docs"},
38+
"pre-commit",
3839
]
3940

4041
[project.urls]

docs/packs/distribution.rst

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -253,28 +253,28 @@ as:
253253
<https://packaging.python.org/en/latest/specifications/pyproject-toml/#declaring-project-metadata-the-project-table>`_
254254
* :pep:`345`
255255

256-
Optional dependencies
257-
~~~~~~~~~~~~~~~~~~~~~
256+
Dependency groups
257+
~~~~~~~~~~~~~~~~~
258258

259-
``project.optional-dependencies``
260-
allows you to specify optional dependencies for your package. You can also
259+
``dependency-groups``
260+
allows you to specify dependency groups for your package. You can also
261261
distinguish between different sets:
262262

263263
.. literalinclude:: dataprep/pyproject.toml
264264
:language: toml
265265
:lines: 24-34
266266
:lineno-start: 34
267267

268-
Recursive optional dependencies are also possible with pip ≥ 21.2. For example,
269-
for ``dev`` you can take over all dependencies from ``docs`` and ``test`` in
270-
addition to ``pre-commit``:
268+
Recursive dependency groups are also possible. For example, for ``dev`` you can
269+
take over all dependencies from ``docs`` and ``test`` in addition to
270+
``pre-commit``:
271271

272272
.. literalinclude:: dataprep/pyproject.toml
273273
:language: toml
274274
:lines: 35-39
275275
:lineno-start: 35
276276

277-
You can install these optional dependencies, for example with:
277+
You can install these dependency groups, for example with:
278278

279279
.. tab:: Linux/macOS
280280

@@ -284,7 +284,7 @@ You can install these optional dependencies, for example with:
284284
$ python3 -m venv .venv
285285
$ . .venv/bin/activate
286286
$ python -m pip install --upgrade pip
287-
$ python -m pip install -e ".[dev]"
287+
$ python -m pip install --group dev
288288
289289
.. tab:: Windows
290290

@@ -294,7 +294,12 @@ You can install these optional dependencies, for example with:
294294
> python3 -m venv .venv
295295
> .venv\Scripts\activate.bat
296296
> python -m pip install --upgrade pip
297-
> python -m pip install -e ".[dev]"
297+
> python -m pip install --group dev
298+
299+
.. seealso::
300+
* :pep:`735`
301+
* `Dependency Groups
302+
<https://packaging.python.org/en/latest/specifications/dependency-groups/>`_
298303

299304
:file:`src` package
300305
-------------------

docs/test/tox.rst

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,13 @@ Before you can run tox, you must ensure that you have installed tox-uv:
9999

100100
.. code-block:: console
101101
102-
$ uv sync --extra dev
102+
$ uv sync --group dev
103103
104104
.. tab:: Windows
105105

106106
.. code-block:: ps1con
107107
108-
C:> uv sync --extra dev
108+
C:> uv sync --group dev
109109
110110
To run tox, simply start tox:
111111

@@ -348,8 +348,7 @@ We can also call individual tests with tox by making another change so that
348348
skip_missing_interpreters = True
349349
350350
[testenv]
351-
extras =
352-
tests: tests
351+
dependency_groups = tests
353352
deps =
354353
tests: coverage[toml]
355354
allowlist_externals = coverage
@@ -564,17 +563,16 @@ You can install ``tox`` and ``tox-uv`` with:
564563

565564
If you want to use ``uv sync`` with a ``uv.lock`` file for a Tox environment,
566565
you must change the runner for this Tox environment to ``uv-venv-lock-runner``.
567-
You should also use the extras configuration in such environments to instruct
568-
``uv`` to install the specified extras, for example:
566+
You should also use the dependency_groups configuration in such environments
567+
to instruct ``uv`` to install the specified dependency group, for example:
569568

570569
.. code-block:: ini
571570
:caption: tox.ini
572571
573572
[testenv]
574573
runner = uv-venv-lock-runner
575-
extras =
576-
dev
574+
dependency_groups = dev
577575
commands = pytest
578576
579577
``dev`` uses the ``uv-venv-lock-runner`` and uses ``uv sync`` to install
580-
dependencies in the environment with the ``dev`` extras.
578+
dependencies in the environment with the ``dev`` dependency group.

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ classifiers = [
1414
]
1515
dependencies = []
1616

17-
[project.optional-dependencies]
17+
[dependency-groups]
1818
docs = [
1919
"furo",
2020
"ipython",
@@ -31,7 +31,7 @@ docs = [
3131
]
3232

3333
dev = [
34-
"python-basics-tutorial[docs]",
34+
{ include-group = "docs" },
3535
"pre-commit",
3636
"codespell",
3737
"vale"

0 commit comments

Comments
 (0)