-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
noxfile.py
97 lines (80 loc) · 2.46 KB
/
noxfile.py
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
"""Nox sessions."""
import nox
locations = ["src", "tests", "noxfile.py", "docs/conf.py", "scripts"]
supported_pythons = ["3.9", "3.10", "3.11", "3.12", "3.13"]
docs_python = "3.13"
@nox.session(python=supported_pythons)
def tests(session: nox.Session) -> None:
"""Run the test suite."""
args = session.posargs or ["--cov", "--cov-report=xml"]
session.run(
"poetry",
"install",
"--quiet",
"--all-extras",
"--only=main,tests",
external=True,
)
session.run("pytest", *args)
@nox.session(python=supported_pythons)
def ruff_format(session: nox.Session) -> None:
"""Check formatting using Ruff."""
args = session.posargs or locations
session.run(
"poetry", "install", "--quiet", "--no-root", "--only=ruff", external=True
)
session.run("ruff", "format", "--check", *args)
@nox.session(python=supported_pythons)
def ruff_check(session: nox.Session) -> None:
"""Lint using Ruff."""
args = session.posargs or locations
session.run(
"poetry", "install", "--quiet", "--no-root", "--only=ruff", external=True
)
session.run("ruff", "check", *args)
@nox.session(python=supported_pythons)
def darglint(session: nox.Session) -> None:
"""Check docstrings using darglint."""
args = session.posargs or ["src"]
session.run(
"poetry", "install", "--quiet", "--no-root", "--only=darglint", external=True
)
session.run("darglint", *args)
@nox.session(python=supported_pythons)
def mypy(session: nox.Session) -> None:
"""Type-check using mypy."""
args = session.posargs or locations
session.run(
"poetry",
"install",
"--quiet",
"--all-extras",
"--only=main,dev,docs,tests,mypy",
external=True,
)
session.run("mypy", *args)
@nox.session(python=supported_pythons)
def pyright(session: nox.Session) -> None:
"""Type-check using pyright."""
args = session.posargs or locations
session.run(
"poetry",
"install",
"--quiet",
"--all-extras",
"--only=main,dev,docs,tests,pyright",
external=True,
)
session.run("pyright", *args)
@nox.session(python=docs_python)
def docs(session: nox.Session) -> None:
"""Build the documentation."""
session.run(
"poetry",
"install",
"--quiet",
"--all-extras",
"--only=main,docs",
external=True,
)
session.run("sphinx-build", "docs", "docs/_build")