1- from nox import Session , options , param , parametrize , session
1+ from nox import Session , options , param , parametrize
2+ from nox_uv import session
23
34options .error_on_external_run = True
45options .default_venv_backend = "uv"
56options .sessions = ["lint" , "type_check" , "test" , "docs" ]
67
78
8- @session (python = ["3.9" , "3.10" , "3.11" , "3.12" , "3.13" ])
9+ @session (
10+ python = ["3.9" , "3.10" , "3.11" , "3.12" , "3.13" ],
11+ uv_groups = ["test" ],
12+ )
913def test (s : Session ) -> None :
10- s .run_install (
11- "uv" ,
12- "sync" ,
13- "--locked" ,
14- "--no-default-groups" ,
15- "--group=test" ,
16- f"--python={ s .virtualenv .location } " ,
17- env = {"UV_PROJECT_ENVIRONMENT" : s .virtualenv .location },
18- )
1914 s .run (
2015 "pytest" ,
2116 "--cov=fact" ,
@@ -27,8 +22,9 @@ def test(s: Session) -> None:
2722 )
2823
2924
30- # For some sessions, set venv_backend="none" to simply execute scripts within the existing
31- # uv-generated virtual environment, rather than have nox create a new one for each session.
25+ # For some sessions, set venv_backend="none" to simply execute scripts within the existing outer
26+ # uv-generated virtual environment, rather than have nox create a new one for each session. This
27+ # makes commonly repeated sessions execute faster.
3228@session (venv_backend = "none" )
3329@parametrize (
3430 "command" ,
@@ -107,17 +103,7 @@ def docs_github_pages(s: Session) -> None:
107103 s .run ("mkdocs" , "gh-deploy" , "--force" , env = doc_env )
108104
109105
110- @session
106+ # Install only main dependencies for the license report.
107+ @session (uv_groups = ["licenses" ])
111108def licenses (s : Session ) -> None :
112- # Install only main dependencies for license report.
113- s .run_install (
114- "uv" ,
115- "sync" ,
116- "--locked" ,
117- "--no-default-groups" ,
118- "--no-install-project" ,
119- "--group=licenses" ,
120- f"--python={ s .virtualenv .location } " ,
121- env = {"UV_PROJECT_ENVIRONMENT" : s .virtualenv .location },
122- )
123109 s .run ("pip-licenses" , * s .posargs )
0 commit comments