3939TEST : str = "test"
4040COVERAGE : str = "coverage"
4141SECURITY : str = "security"
42- PERF : str = "perf"
4342DOCS : str = "docs"
4443BUILD : str = "build"
4544RELEASE : str = "release"
4645QUALITY : str = "quality"
47- PYTHON : str = "python"
48- RUST : str = "rust"
4946
5047
5148@nox .session (python = False , name = "setup-git" , tags = [ENV ])
@@ -88,43 +85,43 @@ def precommit(session: Session) -> None:
8885 activate_virtualenv_in_precommit_hooks (session )
8986
9087
91- @nox .session (python = False , name = "format-python" , tags = [FORMAT , PYTHON , QUALITY ])
88+ @nox .session (python = False , name = "format-python" , tags = [FORMAT , QUALITY ])
9289def format_python (session : Session ) -> None :
9390 """Run Python code formatter (Ruff format)."""
9491 session .log (f"Running Ruff formatter check with py{ session .python } ." )
9592 session .run ("uvx" , "ruff" , "format" , * session .posargs )
9693
9794
9895{% if cookiecutter .add_rust_extension - % }
99- @nox .session (python = False , name = "format-rust" , tags = [FORMAT , RUST ])
96+ @nox .session (python = False , name = "format-rust" , tags = [FORMAT ])
10097def format_rust (session : Session ) -> None :
10198 """Run Rust code formatter (cargo fmt)."""
102- session .log ("Installing formatting dependencies ..." )
103- session .run ("cargo " , "install " , "cargo-fmt " , external = True )
104- session .run ( "cargo" , "fmt" , "--all" , "--" , "--check" , external = True )
105- session .run ("cargo" , "fmt" , "--all" , "--" , "--write" , external = True )
99+ session .log ("Ensuring rustfmt component is available ..." )
100+ session .run ("rustup " , "component " , "add" , "rustfmt " , external = True )
101+ session .log ( "Formatting Rust code..." )
102+ session .run ("cargo" , "fmt" , "--all" , external = True )
106103
107104
108105{% endif - % }
109- @nox .session (python = False , name = "lint-python" , tags = [LINT , PYTHON , QUALITY ])
106+ @nox .session (python = False , name = "lint-python" , tags = [LINT , QUALITY ])
110107def lint_python (session : Session ) -> None :
111108 """Run Python code linters (Ruff check, Pydocstyle rules)."""
112109 session .log (f"Running Ruff check with py{ session .python } ." )
113110 session .run ("uvx" , "ruff" , "check" , "--fix" , "--verbose" )
114111
115112
116113{% if cookiecutter .add_rust_extension - % }
117- @nox .session (python = False , name = "lint-rust" , tags = [LINT , RUST ])
114+ @nox .session (python = False , name = "lint-rust" , tags = [LINT , QUALITY ])
118115def lint_rust (session : Session ) -> None :
119116 """Run Rust code linters (cargo clippy)."""
120- session .log ("Installing linting dependencies ..." )
121- session .run ("cargo " , "install " , "cargo- clippy" , external = True )
122- session .run ( "cargo" , " clippy" , "--all-features" , "--" , "--check" , external = True )
123- session .run ("cargo" , "clippy" , "--all-features" , "--" , "--write " , external = True )
117+ session .log ("Ensuring clippy component is available ..." )
118+ session .run ("rustup " , "component " , "add" , " clippy" , external = True )
119+ session .log ( "Running clippy lints..." )
120+ session .run ("cargo" , "clippy" , "--all-features" , "--" , "-D" , "warnings " , external = True )
124121
125122
126123{% endif - % }
127- @nox .session (python = PYTHON_VERSIONS , name = "typecheck" , tags = [ TYPE , PYTHON ] )
124+ @nox .session (python = PYTHON_VERSIONS , name = "typecheck" )
128125def typecheck (session : Session ) -> None :
129126 """Run static type checking (Pyright) on Python code."""
130127 session .log ("Installing type checking dependencies..." )
@@ -134,7 +131,7 @@ def typecheck(session: Session) -> None:
134131 session .run ("pyright" , "--pythonversion" , session .python )
135132
136133
137- @nox .session (python = False , name = "security-python" , tags = [SECURITY , PYTHON ])
134+ @nox .session (python = False , name = "security-python" , tags = [SECURITY ])
138135def security_python (session : Session ) -> None :
139136 """Run code security checks (Bandit) on Python code."""
140137 session .log (f"Running Bandit static security analysis with py{ session .python } ." )
@@ -145,16 +142,16 @@ def security_python(session: Session) -> None:
145142
146143
147144{% if cookiecutter .add_rust_extension - % }
148- @nox .session (python = False , name = "security-rust" , tags = [SECURITY , RUST ])
145+ @nox .session (python = False , name = "security-rust" , tags = [SECURITY ])
149146def security_rust (session : Session ) -> None :
150147 """Run code security checks (cargo audit)."""
151- session .log ("Installing security dependencies ..." )
152- session .run ("cargo" , "install" , "cargo-audit" , external = True )
148+ session .log ("Ensuring cargo-audit is available ..." )
149+ session .run ("cargo" , "install" , "cargo-audit" , "--locked" , external = True )
153150 session .run ("cargo" , "audit" , "--all" , external = True )
154151
155152
156153{% endif - % }
157- @nox .session (python = PYTHON_VERSIONS , name = "tests-python" , tags = [TEST , PYTHON ])
154+ @nox .session (python = PYTHON_VERSIONS , name = "tests-python" , tags = [TEST ])
158155def tests_python (session : Session ) -> None :
159156 """Run the Python test suite (pytest with coverage)."""
160157 session .log ("Installing test dependencies..." )
@@ -177,7 +174,7 @@ def tests_python(session: Session) -> None:
177174
178175
179176{% if cookiecutter .add_rust_extension - % }
180- @nox .session (python = False , name = "tests-rust" , tags = [TEST , RUST , CI ])
177+ @nox .session (python = False , name = "tests-rust" , tags = [TEST ])
181178def tests_rust (session : Session ) -> None :
182179 """Test the project's rust crates."""
183180 crates : list [Path ] = [cargo_toml .parent for cargo_toml in CRATES_FOLDER .glob ("*/Cargo.toml" )]
@@ -203,7 +200,7 @@ def docs_build(session: Session) -> None:
203200 session .run ("sphinx-build" , "-b" , "html" , "docs" , str (docs_build_dir ), "-W" )
204201
205202
206- @nox .session (python = False , name = "build-python" , tags = [BUILD , PYTHON ])
203+ @nox .session (python = False , name = "build-python" , tags = [BUILD ])
207204def build_python (session : Session ) -> None :
208205 """Build sdist and wheel packages (uv build)."""
209206 session .log (f"Building sdist and wheel packages with py{ session .python } ." )
@@ -218,6 +215,15 @@ def build_python(session: Session) -> None:
218215 session .log (f"- { path .name } " )
219216
220217
218+ {% if cookiecutter .add_rust_extension - % }
219+ @nox .session (python = False , name = "build-rust" , tags = [BUILD ])
220+ def build_rust (session : Session ) -> None :
221+ """Build standalone Rust crates for potential independent publishing."""
222+ session .log ("Building Rust crates..." )
223+ session .run ("cargo" , "build" , "--release" , "--manifest-path" , "rust/Cargo.toml" , external = True )
224+
225+
226+ {% endif - % }
221227@nox .session (python = False , name = "build-container" , tags = [BUILD ])
222228def build_container (session : Session ) -> None :
223229 """Build the Docker container image.
0 commit comments