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,39 +85,39 @@ 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
98- @nox .session (python = False , name = "format-rust" , tags = [FORMAT , RUST ])
95+ @nox .session (python = False , name = "format-rust" , tags = [FORMAT ])
9996def format_rust (session : Session ) -> None :
10097 """Run Rust code formatter (cargo fmt)."""
101- session .log ("Installing formatting dependencies ..." )
102- session .run ("cargo " , "install " , "cargo-fmt " , external = True )
103- session .run ( "cargo" , "fmt" , "--all" , "--" , "--check" , external = True )
104- session .run ("cargo" , "fmt" , "--all" , "--" , "--write" , external = True )
98+ session .log ("Ensuring rustfmt component is available ..." )
99+ session .run ("rustup " , "component " , "add" , "rustfmt " , external = True )
100+ session .log ( "Formatting Rust code..." )
101+ session .run ("cargo" , "fmt" , "--all" , external = True )
105102
106103
107- @nox .session (python = False , name = "lint-python" , tags = [LINT , PYTHON , QUALITY ])
104+ @nox .session (python = False , name = "lint-python" , tags = [LINT , QUALITY ])
108105def lint_python (session : Session ) -> None :
109106 """Run Python code linters (Ruff check, Pydocstyle rules)."""
110107 session .log (f"Running Ruff check with py{ session .python } ." )
111108 session .run ("uvx" , "ruff" , "check" , "--fix" , "--verbose" )
112109
113110
114- @nox .session (python = False , name = "lint-rust" , tags = [LINT , RUST ])
111+ @nox .session (python = False , name = "lint-rust" , tags = [LINT , QUALITY ])
115112def lint_rust (session : Session ) -> None :
116113 """Run Rust code linters (cargo clippy)."""
117- session .log ("Installing linting dependencies ..." )
118- session .run ("cargo " , "install " , "cargo- clippy" , external = True )
119- session .run ( "cargo" , " clippy" , "--all-features" , "--" , "--check" , external = True )
120- session .run ("cargo" , "clippy" , "--all-features" , "--" , "--write " , external = True )
114+ session .log ("Ensuring clippy component is available ..." )
115+ session .run ("rustup " , "component " , "add" , " clippy" , external = True )
116+ session .log ( "Running clippy lints..." )
117+ session .run ("cargo" , "clippy" , "--all-features" , "--" , "-D" , "warnings " , external = True )
121118
122119
123- @nox .session (python = PYTHON_VERSIONS , name = "typecheck" , tags = [ TYPE , PYTHON ] )
120+ @nox .session (python = PYTHON_VERSIONS , name = "typecheck" )
124121def typecheck (session : Session ) -> None :
125122 """Run static type checking (Pyright) on Python code."""
126123 session .log ("Installing type checking dependencies..." )
@@ -130,7 +127,7 @@ def typecheck(session: Session) -> None:
130127 session .run ("pyright" , "--pythonversion" , session .python )
131128
132129
133- @nox .session (python = False , name = "security-python" , tags = [SECURITY , PYTHON ])
130+ @nox .session (python = False , name = "security-python" , tags = [SECURITY ])
134131def security_python (session : Session ) -> None :
135132 """Run code security checks (Bandit) on Python code."""
136133 session .log (f"Running Bandit static security analysis with py{ session .python } ." )
@@ -140,15 +137,15 @@ def security_python(session: Session) -> None:
140137 session .run ("uvx" , "pip-audit" )
141138
142139
143- @nox .session (python = False , name = "security-rust" , tags = [SECURITY , RUST ])
140+ @nox .session (python = False , name = "security-rust" , tags = [SECURITY ])
144141def security_rust (session : Session ) -> None :
145142 """Run code security checks (cargo audit)."""
146- session .log ("Installing security dependencies ..." )
147- session .run ("cargo" , "install" , "cargo-audit" , external = True )
143+ session .log ("Ensuring cargo-audit is available ..." )
144+ session .run ("cargo" , "install" , "cargo-audit" , "--locked" , external = True )
148145 session .run ("cargo" , "audit" , "--all" , external = True )
149146
150147
151- @nox .session (python = PYTHON_VERSIONS , name = "tests-python" , tags = [TEST , PYTHON ])
148+ @nox .session (python = PYTHON_VERSIONS , name = "tests-python" , tags = [TEST ])
152149def tests_python (session : Session ) -> None :
153150 """Run the Python test suite (pytest with coverage)."""
154151 session .log ("Installing test dependencies..." )
@@ -170,7 +167,7 @@ def tests_python(session: Session) -> None:
170167 )
171168
172169
173- @nox .session (python = False , name = "tests-rust" , tags = [TEST , RUST , CI ])
170+ @nox .session (python = False , name = "tests-rust" , tags = [TEST ])
174171def tests_rust (session : Session ) -> None :
175172 """Test the project's rust crates."""
176173 crates : list [Path ] = [cargo_toml .parent for cargo_toml in CRATES_FOLDER .glob ("*/Cargo.toml" )]
@@ -195,7 +192,7 @@ def docs_build(session: Session) -> None:
195192 session .run ("sphinx-build" , "-b" , "html" , "docs" , str (docs_build_dir ), "-W" )
196193
197194
198- @nox .session (python = False , name = "build-python" , tags = [BUILD , PYTHON ])
195+ @nox .session (python = False , name = "build-python" , tags = [BUILD ])
199196def build_python (session : Session ) -> None :
200197 """Build sdist and wheel packages (uv build)."""
201198 session .log (f"Building sdist and wheel packages with py{ session .python } ." )
@@ -205,6 +202,13 @@ def build_python(session: Session) -> None:
205202 session .log (f"- { path .name } " )
206203
207204
205+ @nox .session (python = False , name = "build-rust" , tags = [BUILD ])
206+ def build_rust (session : Session ) -> None :
207+ """Build standalone Rust crates for potential independent publishing."""
208+ session .log ("Building Rust crates..." )
209+ session .run ("cargo" , "build" , "--release" , "--manifest-path" , "rust/Cargo.toml" , external = True )
210+
211+
208212@nox .session (python = False , name = "build-container" , tags = [BUILD ])
209213def build_container (session : Session ) -> None :
210214 """Build the Docker container image.
0 commit comments