@@ -105,7 +105,9 @@ def tests(session: nox.Session) -> None:
105105 """
106106 Run the unit and regular tests.
107107 """
108- session.install(".[test]")
108+ pyproject = nox.project.load_toml()
109+ deps = nox.project.dependency_groups(pyproject, "test")
110+ session.install("-e.", *deps)
109111 session.run("pytest", *session.posargs)
110112` ` `
111113
@@ -129,15 +131,6 @@ You can see all defined sessions (along with the docstrings) using:
129131$ nox -l
130132` ` `
131133
132- It is a good idea to list the sessions you want by default by setting
133- `nox.options.sessions` near the top of your file :
134-
135- ` ` ` python
136- nox.options.sessions = ["lint", "tests"]
137- ` ` `
138-
139- This will keep you from running extra things like `docs` by default.
140-
141134# ## Parametrizing
142135
143136You can parametrize sessions. either on Python or on any other item.
@@ -212,7 +205,8 @@ def tests(session: nox.Session) -> None:
212205 """
213206 Run the unit and regular tests.
214207 """
215- session.install("-e.[test]")
208+ test_deps = nox.project.dependency_groups(PROJECT, "test")
209+ session.install("-e.", *test_deps)
216210 session.run("pytest", *session.posargs)
217211` ` `
218212<!-- prettier-ignore-end -->
@@ -226,12 +220,13 @@ with code_fence("python"):
226220]]] -->
227221<!-- prettier-ignore-start -->
228222` ` ` python
229- @nox.session(reuse_venv=True)
223+ @nox.session(reuse_venv=True, default=False )
230224def docs(session: nox.Session) -> None:
231225 """
232226 Build the docs. Pass --non-interactive to avoid serving. First positional argument is the target directory.
233227 """
234228
229+ doc_deps = nox.project.dependency_groups(PROJECT, "docs")
235230 parser = argparse.ArgumentParser()
236231 parser.add_argument(
237232 "-b", dest="builder", default="html", help="Build target (default: html)"
@@ -240,7 +235,7 @@ def docs(session: nox.Session) -> None:
240235 args, posargs = parser.parse_known_args(session.posargs)
241236 serve = args.builder == "html" and session.interactive
242237
243- session.install("-e.[docs]" , "sphinx-autobuild")
238+ session.install("-e.", *doc_deps , "sphinx-autobuild")
244239
245240 shared_args = (
246241 "-n", # nitpicky mode
@@ -287,7 +282,7 @@ from pathlib import Path
287282DIR = Path(__file__).parent.resolve()
288283
289284
290- @nox.session
285+ @nox.session(default=False)
291286def build(session: nox.Session) -> None:
292287 """
293288 Build an SDist and wheel.
0 commit comments