|
9 | 9 | DOCS = ROOT / "docs"
|
10 | 10 | REFERENCING = ROOT / "referencing"
|
11 | 11 |
|
| 12 | +REQUIREMENTS = dict( |
| 13 | + docs=DOCS / "requirements.txt", |
| 14 | + tests=ROOT / "test-requirements.txt", |
| 15 | +) |
| 16 | +REQUIREMENTS_IN = [ # this is actually ordered, as files depend on each other |
| 17 | + path.parent / f"{path.stem}.in" for path in REQUIREMENTS.values() |
| 18 | +] |
| 19 | + |
| 20 | +SUPPORTED = ["3.8", "3.9", "3.10", "3.11", "3.12", "pypy3.10"] |
| 21 | +LATEST = "3.12" |
12 | 22 |
|
13 | 23 | nox.options.sessions = []
|
14 | 24 |
|
15 | 25 |
|
16 |
| -def session(default=True, **kwargs): # noqa: D103 |
| 26 | +def session(default=True, python=LATEST, **kwargs): # noqa: D103 |
17 | 27 | def _session(fn):
|
18 | 28 | if default:
|
19 | 29 | nox.options.sessions.append(kwargs.get("name", fn.__name__))
|
20 |
| - return nox.session(**kwargs)(fn) |
| 30 | + return nox.session(python=python, **kwargs)(fn) |
21 | 31 |
|
22 | 32 | return _session
|
23 | 33 |
|
24 | 34 |
|
25 |
| -@session(python=["3.8", "3.9", "3.10", "3.11", "3.12", "pypy3"]) |
| 35 | +@session(python=SUPPORTED) |
26 | 36 | def tests(session):
|
27 | 37 | """
|
28 | 38 | Run the test suite with a corresponding Python version.
|
29 | 39 | """
|
30 |
| - session.install("-r", ROOT / "test-requirements.txt") |
| 40 | + session.install("-r", REQUIREMENTS["tests"]) |
31 | 41 |
|
32 | 42 | if session.posargs and session.posargs[0] == "coverage":
|
33 | 43 | if len(session.posargs) > 1 and session.posargs[1] == "github":
|
@@ -109,7 +119,7 @@ def docs(session, builder):
|
109 | 119 | """
|
110 | 120 | Build the documentation using a specific Sphinx builder.
|
111 | 121 | """
|
112 |
| - session.install("-r", DOCS / "requirements.txt") |
| 122 | + session.install("-r", REQUIREMENTS["docs"]) |
113 | 123 | with TemporaryDirectory() as tmpdir_str:
|
114 | 124 | tmpdir = Path(tmpdir_str)
|
115 | 125 | argv = ["-n", "-T", "-W"]
|
@@ -147,7 +157,7 @@ def requirements(session):
|
147 | 157 | Update the project's pinned requirements. Commit the result.
|
148 | 158 | """
|
149 | 159 | session.install("pip-tools")
|
150 |
| - for each in [DOCS / "requirements.in", ROOT / "test-requirements.in"]: |
| 160 | + for each in REQUIREMENTS_IN: |
151 | 161 | session.run(
|
152 | 162 | "pip-compile",
|
153 | 163 | "--resolver",
|
|
0 commit comments