-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnoxfile.py
More file actions
67 lines (48 loc) · 1.78 KB
/
noxfile.py
File metadata and controls
67 lines (48 loc) · 1.78 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
57
58
59
60
61
62
63
64
65
66
67
"""Nox sessions for spine-lite.
Each session is the canonical entry point for a verification gate. CI invokes
these directly. Contributors run `nox -s lint typecheck test` before any
commit and the full set before any push.
"""
from __future__ import annotations
import nox
nox.options.default_venv_backend = "uv"
nox.options.reuse_existing_virtualenvs = True
nox.options.sessions = ["lint", "typecheck", "test"]
PYTHON_VERSIONS = ["3.11", "3.12", "3.13"]
@nox.session(python=PYTHON_VERSIONS)
def test(session: nox.Session) -> None:
session.install("-e", ".", "pytest", "pytest-cov", "hypothesis")
session.run("pytest", *session.posargs)
@nox.session
def lint(session: nox.Session) -> None:
session.install("ruff")
session.run("ruff", "check", ".")
session.run("ruff", "format", "--check", ".")
@nox.session(name="format")
def format_(session: nox.Session) -> None:
session.install("ruff")
session.run("ruff", "check", "--fix", ".")
session.run("ruff", "format", ".")
@nox.session
def typecheck(session: nox.Session) -> None:
session.install("-e", ".", "mypy", "pytest", "hypothesis", "pydantic", "typer")
session.run("mypy", "src", "tests")
@nox.session
def coverage(session: nox.Session) -> None:
session.install("-e", ".", "pytest", "pytest-cov", "hypothesis")
session.run(
"pytest",
"--cov=spine_lite",
"--cov-report=term-missing",
"--cov-report=xml",
"--cov-fail-under=95",
*session.posargs,
)
@nox.session
def docs(session: nox.Session) -> None:
session.install("-e", ".[docs]")
session.run("mkdocs", "build", "--strict")
@nox.session(name="docs-serve")
def docs_serve(session: nox.Session) -> None:
session.install("-e", ".[docs]")
session.run("mkdocs", "serve", *session.posargs)