Skip to content

Commit 40e3147

Browse files
authored
Migrate development extras to dependency groups (#1152)
This introduces the following changes: * The `dev` extra is moved to a dependency group. * The `tests` extra is moved to a dependency group. * The `docs` extra is moved to a dependency group. * `tox.ini` has been updated to use the dependency groups. * `main.yml` has been updated to install the `dev` dependency group. * The Read the Docs config is updated to install the `docs` dependency group. This follows the how-to documentation published by Read the Docs. https://docs.readthedocs.com/platform/latest/build-customization.html#install-dependencies-from-dependency-groups In addition, when tox was run, the `lint` environment failed because pyupgrade doesn't support Python 3.9. Therefore, one additional change was made: * The `lint` tox environment's `basepython` is updated to Python 3.10.
1 parent a4e1a3d commit 40e3147

File tree

5 files changed

+38
-32
lines changed

5 files changed

+38
-32
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ jobs:
125125
run: "python -c 'import jwt; print(jwt.__version__)'"
126126

127127
- name: "Install in dev mode"
128-
run: "python -m pip install -e .[dev]"
128+
run: "python -m pip install -e . --group dev"
129129

130130
- name: "Import package in dev mode"
131131
run: "python -c 'import jwt; print(jwt.__version__)'"

.readthedocs.yaml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,10 @@ build:
66
os: "ubuntu-lts-latest"
77
tools:
88
python: "3.11"
9-
10-
python:
11-
install:
12-
- method: "pip"
13-
path: "."
14-
extra_requirements:
15-
- "docs"
16-
- "crypto"
9+
jobs:
10+
install:
11+
- "pip install --upgrade pip"
12+
- "pip install .[crypto] --group 'docs'"
1713

1814
sphinx:
1915
configuration: "docs/conf.py"

CHANGELOG.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ This project adheres to `Semantic Versioning <https://semver.org/>`__.
77
`Unreleased <https://github.com/jpadilla/pyjwt/compare/2.12.1...HEAD>`__
88
------------------------------------------------------------------------
99

10+
Changed
11+
~~~~~~~
12+
13+
- Migrate the ``dev``, ``docs``, and ``tests`` package extras to dependency groups by @kurtmckee in `#1152 <https://github.com/jpadilla/pyjwt/pull/1152>`__
14+
1015
`v2.12.1 <https://github.com/jpadilla/pyjwt/compare/2.12.0...2.12.1>`__
1116
------------------------------------------------------------------------
1217

pyproject.toml

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,26 @@ requires = [
44
"setuptools>=77.0.3",
55
]
66

7+
[dependency-groups]
8+
dev = [
9+
"coverage[toml]==7.10.7",
10+
"cryptography>=3.4.0",
11+
"pre-commit",
12+
"pytest>=8.4.2,<9.0.0",
13+
"sphinx",
14+
"sphinx-rtd-theme",
15+
"zope.interface",
16+
]
17+
docs = [
18+
"sphinx",
19+
"sphinx-rtd-theme",
20+
"zope.interface",
21+
]
22+
tests = [
23+
"coverage[toml]==7.10.7",
24+
"pytest>=8.4.2,<9.0.0",
25+
]
26+
727
[project]
828
authors = [
929
{ email = "hello@jpadilla.com", name = "Jose Padilla" },
@@ -46,24 +66,6 @@ requires-python = ">=3.9"
4666
crypto = [
4767
"cryptography>=3.4.0",
4868
]
49-
dev = [
50-
"coverage[toml]==7.10.7",
51-
"cryptography>=3.4.0",
52-
"pre-commit",
53-
"pytest>=8.4.2,<9.0.0",
54-
"sphinx",
55-
"sphinx-rtd-theme",
56-
"zope.interface",
57-
]
58-
docs = [
59-
"sphinx",
60-
"sphinx-rtd-theme",
61-
"zope.interface",
62-
]
63-
tests = [
64-
"coverage[toml]==7.10.7",
65-
"pytest>=8.4.2,<9.0.0",
66-
]
6769

6870
[project.readme]
6971
content-type = "text/x-rst"

tox.ini

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,19 @@ wheel_build_env = build_wheel
3939
# https://github.com/pypa/setuptools/issues/1042 from breaking our builds.
4040
setenv =
4141
VIRTUALENV_NO_DOWNLOAD=1
42-
extras =
42+
dependency_groups =
4343
tests
44+
extras =
4445
crypto: crypto
4546
commands = {envpython} -b -m coverage run -m pytest {posargs}
4647

4748

4849
[testenv:docs]
4950
# The tox config must match the ReadTheDocs config.
5051
basepython = python3.11
51-
extras =
52+
dependency_groups =
5253
docs
54+
extras =
5355
crypto
5456
commands =
5557
sphinx-build -n -T -W -b html -d {envtmpdir}/doctrees docs docs/_build/html
@@ -58,8 +60,9 @@ commands =
5860

5961

6062
[testenv:py{39,310,311,312,313,314}{,-crypto}-mypy]
61-
extras =
63+
dependency_groups =
6264
tests
65+
extras =
6366
crypto: crypto
6467
deps =
6568
mypy
@@ -69,8 +72,8 @@ commands =
6972
mypy
7073

7174
[testenv:lint]
72-
basepython = python3.9
73-
extras = dev
75+
basepython = python3.10
76+
dependency_groups = dev
7477
passenv = HOMEPATH # needed on Windows
7578
commands = pre-commit run --all-files
7679

0 commit comments

Comments
 (0)