Skip to content

Commit 5402eb2

Browse files
committed
fix: remove faulty command kwargs from noxfile.py
1 parent 6976ef3 commit 5402eb2

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

{{cookiecutter.project_name}}/noxfile.py

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,18 @@
2323
PACKAGE_NAME: str = "{{cookiecutter.package_name}}"
2424

2525

26+
@nox.session(python=DEFAULT_PYTHON_VERSION, name="pre-commit")
27+
def pre_commit(session: Session) -> None:
28+
"""Run pre-commit checks."""
29+
session.log("Installing pre-commit dependencies...")
30+
session.run("uv", "sync", "--locked", "--group", "dev", "pre-commit", external=True)
31+
32+
2633
@nox.session(python=DEFAULT_PYTHON_VERSION, name="format-python")
2734
def format_python(session: Session) -> None:
2835
"""Run Python code formatter (Ruff format)."""
2936
session.log("Installing formatting dependencies...")
30-
session.run("uv", "sync", "--locked", "--clean", "--groups", "dev", "lint", external=True)
37+
session.run("uv", "sync", "--locked", "--group", "dev", "lint", external=True)
3138

3239
session.log(f"Running Ruff formatter check with py{session.python}.")
3340
# Use --check, not fix. Fixing is done by pre-commit or manual run.
@@ -38,7 +45,7 @@ def format_python(session: Session) -> None:
3845
def lint_python(session: Session) -> None:
3946
"""Run Python code linters (Ruff check, Pydocstyle rules)."""
4047
session.log("Installing linting dependencies...")
41-
session.run("uv", "sync", "--locked", "--clean", "--groups", "dev", "lint", external=True)
48+
session.run("uv", "sync", "--locked", "--group", "dev", "lint", external=True)
4249

4350
session.log(f"Running Ruff check with py{session.python}.")
4451
session.run("uv", "run", "ruff", "check", "--verbose", external=True)
@@ -48,7 +55,7 @@ def lint_python(session: Session) -> None:
4855
def typecheck(session: Session) -> None:
4956
"""Run static type checking (Pyright) on Python code."""
5057
session.log("Installing type checking dependencies...")
51-
session.run("uv", "sync", "--locked", "--clean", "--groups", "dev", "typecheck", external=True)
58+
session.run("uv", "sync", "--locked", "--group", "dev", "typecheck", external=True)
5259

5360
session.log(f"Running Pyright check with py{session.python}.")
5461
session.run("uv", "run", "pyright", external=True)
@@ -58,7 +65,7 @@ def typecheck(session: Session) -> None:
5865
def security_python(session: Session) -> None:
5966
"""Run code security checks (Bandit) on Python code."""
6067
session.log("Installing security dependencies...")
61-
session.run("uv", "sync", "--locked", "--clean", "--groups", "dev", "security", external=True)
68+
session.run("uv", "sync", "--locked", "--group", "dev", "security", external=True)
6269

6370
session.log(f"Running Bandit static security analysis with py{session.python}.")
6471
session.run("uv", "run", "bandit", "-r", PACKAGE_NAME, "-c", ".bandit", "-ll", "-s", external=True)
@@ -71,7 +78,7 @@ def security_python(session: Session) -> None:
7178
def tests_python(session: Session) -> None:
7279
"""Run the Python test suite (pytest with coverage)."""
7380
session.log("Installing test dependencies...")
74-
session.run("uv", "sync", "--locked", "--clean", "--groups", "dev", "test", external=True)
81+
session.run("uv", "sync", "--locked", "--group", "dev", "test", external=True)
7582

7683
session.log(f"Running test suite with py{session.python}.")
7784
test_results_dir = Path("test-results")
@@ -101,7 +108,7 @@ def tests_rust(session: Session) -> None:
101108
def docs_build(session: Session) -> None:
102109
"""Build the project documentation (Sphinx)."""
103110
session.log("Installing documentation dependencies...")
104-
session.run("uv", "sync", "--locked", "--clean", "--groups", "dev", "docs", external=True)
111+
session.run("uv", "sync", "--locked", "--group", "dev", "docs", external=True)
105112

106113
session.log(f"Building documentation with py{session.python}.")
107114
docs_build_dir = Path("docs") / "_build" / "html"
@@ -118,7 +125,7 @@ def build_python(session: Session) -> None:
118125
"""Build sdist and wheel packages (uv build)."""
119126
session.log("Installing build dependencies...")
120127
# Sync core & dev deps are needed for accessing project source code.
121-
session.run("uv", "sync", "--locked", "--clean", "--groups", "dev", external=True)
128+
session.run("uv", "sync", "--locked", "--group", "dev", external=True)
122129

123130
session.log(f"Building sdist and wheel packages with py{session.python}.")
124131
{% if cookiecutter.add_rust_extension == 'y' -%}
@@ -154,7 +161,7 @@ def build_container(session: Session) -> None:
154161

155162
current_dir = Path(".")
156163
session.log(f"Ensuring core dependencies are synced in {current_dir.resolve()} for build context...")
157-
session.run("uv", "sync", "--locked", "--clean", external=True)
164+
session.run("uv", "sync", "--locked", external=True)
158165

159166
session.log(f"Building Docker image using {container_cli}.")
160167
project_image_name = PACKAGE_NAME.replace("_", "-").lower()
@@ -300,7 +307,7 @@ def coverage(session: Session) -> None:
300307
session.log("Note: Ensure 'nox -s test-python' was run across all desired Python versions first to generate coverage data.")
301308

302309
session.log("Installing dependencies for coverage report session...")
303-
session.run("uv", "sync", "--locked", "--clean", "--groups", "dev", "test", external=True)
310+
session.run("uv", "sync", "--locked", "--group", "dev", "test", external=True)
304311

305312
coverage_combined_file = Path(".") / ".coverage"
306313

0 commit comments

Comments
 (0)