-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnoxfile.py
More file actions
56 lines (40 loc) · 1.42 KB
/
noxfile.py
File metadata and controls
56 lines (40 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# type: ignore # noqa: PGH003
# pyright: basic, reportMissingImports=false
from __future__ import annotations
import nox
nox.options.default_venv_backend = "uv"
ALL_PYTHON = ["3.14", "3.13", "3.12", "3.11", "3.10"]
def install_deps(s: nox.Session, groups: list[str]) -> None:
s.env["UV_PROJECT_ENVIRONMENT"] = s.virtualenv.location
cmd = ["uv", "sync", "--frozen"]
cmd.append("--no-dev")
for g in groups:
cmd.extend(("--group", g))
_ = s.run_install(*cmd)
@nox.session(reuse_venv=True, default=False)
def check(s: nox.Session) -> None:
install_deps(s, ["test", "typing", "lint"])
_ = s.run("ruff", "format")
_ = s.run("ruff", "check", "--fix")
_ = s.run("ruff", "format")
_ = s.run("pytest", "--lf", "-x", "-n", "2")
_ = s.run("mypy")
_ = s.run("basedpyright", "--venvpath", s.virtualenv.location)
@nox.session(python=ALL_PYTHON)
def test(s: nox.Session) -> None:
install_deps(s, ["test"])
_ = s.run("pytest")
@nox.session()
def type_check(s: nox.Session) -> None:
install_deps(s, ["typing", "examples"])
_ = s.run("mypy", ".")
_ = s.run("basedpyright", "--venvpath", s.virtualenv.location, ".")
@nox.session
def lint(s: nox.Session) -> None:
install_deps(s, ["lint"])
_ = s.run("ruff", "check")
_ = s.run("ruff", "format", "--check")
@nox.session
def docs(s: nox.Session) -> None:
install_deps(s, ["docs"])
_ = s.run("zensical", "build")