1414
1515
1616nox .needs_version = ">=2024.3.2"
17- nox .options .default_venv_backend = "uv|virtualenv "
17+ nox .options .default_venv_backend = "uv"
1818
19+ nox .options .sessions = ["lint" , "tests" , "minimums" ]
1920
2021PYTHON_ALL_VERSIONS = ["3.9" , "3.10" , "3.11" , "3.12" , "3.13" ]
2122
22- BUILD_REQUIREMENTS = [
23- "setuptools>=66.1" ,
24- "setuptools_scm>=8.1" ,
25- "wheel>=0.40" ,
26- ]
27-
2823if os .environ .get ("CI" , None ):
2924 nox .options .error_on_missing_interpreters = True
3025
@@ -43,20 +38,22 @@ def _run_tests(
4338 * ,
4439 install_args : Sequence [str ] = (),
4540 run_args : Sequence [str ] = (),
46- extras : Sequence [str ] = (),
4741) -> None :
48- posargs = list (session .posargs )
49- env = {"PIP_DISABLE_PIP_VERSION_CHECK" : "1" }
50-
51- extras_ = ["test" , * extras ]
52- if "--cov" in posargs :
53- extras_ .append ("coverage" )
54- posargs .append ("--cov-config=pyproject.toml" )
55-
56- session .install (* BUILD_REQUIREMENTS , * install_args , env = env )
57- install_arg = f"-ve.[{ ',' .join (extras_ )} ]"
58- session .install ("--no-build-isolation" , install_arg , * install_args , env = env )
59- session .run ("pytest" , * run_args , * posargs , env = env )
42+ env = {"UV_PROJECT_ENVIRONMENT" : session .virtualenv .location }
43+
44+ session .run (
45+ "uv" ,
46+ "run" ,
47+ "--no-dev" ,
48+ "--group" ,
49+ "test" ,
50+ * install_args ,
51+ "pytest" ,
52+ * run_args ,
53+ * session .posargs ,
54+ "--cov-config=pyproject.toml" ,
55+ env = env ,
56+ )
6057
6158
6259@nox .session (reuse_venv = True , python = PYTHON_ALL_VERSIONS )
@@ -73,7 +70,9 @@ def minimums(session: nox.Session) -> None:
7370 install_args = ["--resolution=lowest-direct" ],
7471 run_args = ["-Wdefault" ],
7572 )
76- session .run ("uv" , "pip" , "list" )
73+ env = {"UV_PROJECT_ENVIRONMENT" : session .virtualenv .location }
74+ session .run ("uv" , "tree" , "--frozen" , env = env )
75+ session .run ("uv" , "lock" , "--refresh" , env = env )
7776
7877
7978@nox .session (reuse_venv = True )
@@ -84,25 +83,27 @@ def docs(session: nox.Session) -> None:
8483 args , posargs = parser .parse_known_args (session .posargs )
8584
8685 serve = args .builder == "html" and session .interactive
87- extra_installs = ["sphinx-autobuild" ] if serve else []
88- session .install (* BUILD_REQUIREMENTS , * extra_installs )
89- session .install ("--no-build-isolation" , "-ve.[docs]" )
90- session .chdir ("docs" )
91-
92- if args .builder == "linkcheck" :
93- session .run ("sphinx-build" , "-b" , "linkcheck" , "." , "_build/linkcheck" , * posargs )
94- return
86+ if serve :
87+ session .install ("sphinx-autobuild" )
9588
96- shared_args = (
89+ env = {"UV_PROJECT_ENVIRONMENT" : session .virtualenv .location }
90+ shared_args = [
9791 "-n" , # nitpicky mode
9892 "-T" , # full tracebacks
9993 f"-b={ args .builder } " ,
100- ". " ,
101- f"_build/{ args .builder } " ,
94+ "docs " ,
95+ f"docs/ _build/{ args .builder } " ,
10296 * posargs ,
97+ ]
98+
99+ session .run (
100+ "uv" ,
101+ "run" ,
102+ "--no-dev" ,
103+ "--group" ,
104+ "docs" ,
105+ "--frozen" ,
106+ "sphinx-autobuild" if serve else "sphinx-build" ,
107+ * shared_args ,
108+ env = env ,
103109 )
104-
105- if serve :
106- session .run ("sphinx-autobuild" , "--ignore" , "**jupyter**" , * shared_args )
107- else :
108- session .run ("sphinx-build" , "--keep-going" , * shared_args )
0 commit comments