Skip to content
Merged
18 changes: 4 additions & 14 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,11 @@ def lint(s: nox.Session, /) -> None:

@session(uv_groups=["lint"], reuse_venv=True)
def precommit(s: nox.Session, /) -> None:
"""Run pre-commit."""
# no-commit-to-branch guards a human's local `git commit`/`git push`,
# not a manual "run every hook over all files" invocation like this
# one -- which CI also runs on every push to `main`, where it would
# otherwise always fail. Skipped here (locally or in CI); the
# installed git hook still catches the real case. Add it to any SKIP
# a caller already set, rather than clobbering it.
"""Run the pre-commit hooks (via prek)."""
# Not a real commit -- no-commit-to-branch would always fail here.
# Merge into any SKIP already set, rather than clobber it.
skip = ",".join(filter(None, [os.environ.get("SKIP"), "no-commit-to-branch"]))
s.run(
"pre-commit",
"run",
"--all-files",
*s.posargs,
env={"SKIP": skip},
)
s.run("prek", "run", "--all-files", *s.posargs, env={"SKIP": skip})


@session(uv_groups=["lint"], reuse_venv=True)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ dev = [
{ "include-group" = "nox" },
{ "include-group" = "test" },
]
lint = ["mypy>=1.19.0", "pre-commit>=4.5.0", "pylint>=4.0.4"]
lint = ["mypy>=1.19.0", "prek>=0.5.3", "pylint>=4.0.4"]
nox = ["nox>=2024.10.9", "nox-uv>=0.6.3"]
test = ["pytest>=9.1.0", "pytest-codspeed>=5.0.0", "sybil[pytest]>=9.2.0"]
test_cov = [{ "include-group" = "test" }, "pytest-cov>=4.0.0", "attrs>=25.4.0"]
Expand Down
57 changes: 15 additions & 42 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.