From b19532545f4fb23e8e107974b0e870007627e821 Mon Sep 17 00:00:00 2001 From: Finjineersdev Date: Sat, 28 Nov 2026 03:13:43 +0500 Subject: [PATCH] feat(rules): offer nox's .nox environments in Python projects nox keeps its session virtualenvs in ./.nox by default ("By default Nox stores virtualenvs in ./.nox", https://nox.thea.codes/en/stable/usage.html). Like .tox, the next nox run recreates them, so .nox is Safe. It is only a candidate in a folder the Python rule already detects, and the guard still checks it like every other folder. New fixture python/match/noxfile; the rules-check snapshot counts 32 artifacts. Co-Authored-By: Claude Opus 5.5 --- README.md | 2 +- .../crates/opensweep-cli/tests/snapshots/rules-check.json | 2 +- .../rules/fixtures/python/match/noxfile/.nox/tests/.keep | 0 .../rules/fixtures/python/match/noxfile/.venv/pyvenv.cfg | 0 engine/rules/fixtures/python/match/noxfile/expected.txt | 2 ++ engine/rules/fixtures/python/match/noxfile/noxfile.py | 0 engine/rules/fixtures/python/match/noxfile/pyproject.toml | 0 engine/rules/python.toml | 8 ++++++++ 8 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 engine/rules/fixtures/python/match/noxfile/.nox/tests/.keep create mode 100644 engine/rules/fixtures/python/match/noxfile/.venv/pyvenv.cfg create mode 100644 engine/rules/fixtures/python/match/noxfile/expected.txt create mode 100644 engine/rules/fixtures/python/match/noxfile/noxfile.py create mode 100644 engine/rules/fixtures/python/match/noxfile/pyproject.toml diff --git a/README.md b/README.md index 8e47f77..94fa666 100644 --- a/README.md +++ b/README.md @@ -183,7 +183,7 @@ project runs again, so they are never ticked for you. | Ecosystem | Safe | Caution | | --- | --- | --- | | Node.js | `.next` `.nuxt` `.svelte-kit` `.turbo` `.parcel-cache` `.angular/cache` `dist` `build` | `node_modules` | -| Python | `__pycache__` `.pytest_cache` `.mypy_cache` `.ruff_cache` `.tox` | `.venv` `venv` | +| Python | `__pycache__` `.pytest_cache` `.mypy_cache` `.ruff_cache` `.tox` `.nox` | `.venv` `venv` | | Go | | `vendor` | | Rust | `target` | | | Java and Kotlin | `target` `build` | `.gradle` | diff --git a/engine/crates/opensweep-cli/tests/snapshots/rules-check.json b/engine/crates/opensweep-cli/tests/snapshots/rules-check.json index 6d8238d..1fa6d40 100644 --- a/engine/crates/opensweep-cli/tests/snapshots/rules-check.json +++ b/engine/crates/opensweep-cli/tests/snapshots/rules-check.json @@ -1,6 +1,6 @@ [ { - "artifacts": 31, + "artifacts": 32, "command": "rules-check", "rule_files": 11, "schema_version": 1 diff --git a/engine/rules/fixtures/python/match/noxfile/.nox/tests/.keep b/engine/rules/fixtures/python/match/noxfile/.nox/tests/.keep new file mode 100644 index 0000000..e69de29 diff --git a/engine/rules/fixtures/python/match/noxfile/.venv/pyvenv.cfg b/engine/rules/fixtures/python/match/noxfile/.venv/pyvenv.cfg new file mode 100644 index 0000000..e69de29 diff --git a/engine/rules/fixtures/python/match/noxfile/expected.txt b/engine/rules/fixtures/python/match/noxfile/expected.txt new file mode 100644 index 0000000..42f5bca --- /dev/null +++ b/engine/rules/fixtures/python/match/noxfile/expected.txt @@ -0,0 +1,2 @@ +.venv +.nox diff --git a/engine/rules/fixtures/python/match/noxfile/noxfile.py b/engine/rules/fixtures/python/match/noxfile/noxfile.py new file mode 100644 index 0000000..e69de29 diff --git a/engine/rules/fixtures/python/match/noxfile/pyproject.toml b/engine/rules/fixtures/python/match/noxfile/pyproject.toml new file mode 100644 index 0000000..e69de29 diff --git a/engine/rules/python.toml b/engine/rules/python.toml index d837d37..19475f9 100644 --- a/engine/rules/python.toml +++ b/engine/rules/python.toml @@ -48,3 +48,11 @@ path = ".tox" class = "safe" reason = "tox test environments. Recreated on the next tox run." restore = "tox" + +# https://nox.thea.codes/en/stable/usage.html: "By default Nox stores +# virtualenvs in ./.nox". +[[artifact]] +path = ".nox" +class = "safe" +reason = "nox session environments. Recreated on the next nox run." +restore = "nox"