-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathnoxfile.py
More file actions
26 lines (24 loc) · 895 Bytes
/
Copy pathnoxfile.py
File metadata and controls
26 lines (24 loc) · 895 Bytes
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
import nox
import nox.project
import sys
@nox.session(reuse_venv=True)
def lint(session: nox.Session) -> None:
requirements = nox.project.load_toml("pyproject.toml")["project"][
"optional-dependencies"
]["DEV"]
if not isinstance(requirements, list):
raise RuntimeError("expected requirements to be a list")
if sys.version_info < (3, 12, 0):
requirements.remove("pyproject")
session.install(*requirements)
session.install("-e", ".")
session.run("ruff", "check")
session.run("python", "-m", "unittest", "discover")
if sys.version_info >= (3, 12, 0):
session.run("pyproject", "check")
else:
session.log(
"The `pyproject` linter didn't run, because the minimal python version for this linter is 3.12. The current interpreter version is {}".format(
sys.version_info
)
)