-
Notifications
You must be signed in to change notification settings - Fork 16
/
noxfile.py
51 lines (37 loc) · 1.14 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
from __future__ import annotations
from pathlib import Path
import nox
nox.needs_version = ">=2024.4.15"
nox.options.default_venv_backend = "uv|virtualenv"
ALL_PYTHONS = [
c.split()[-1]
for c in nox.project.load_toml("pyproject.toml")["project"]["classifiers"]
if c.startswith("Programming Language :: Python :: 3.")
]
@nox.session
def lint(session):
session.install("pre-commit")
session.run("pre-commit", "run", "--all-files", *session.posargs)
@nox.session
def pylint(session: nox.Session) -> None:
"""
Run pylint.
"""
session.install("pylint")
session.install("-e.[dev]")
session.run("pylint", "src", *session.posargs)
@nox.session(python=ALL_PYTHONS)
def tests(session):
session.install("-y.[test]")
session.run("pytest", *session.posargs)
@nox.session(default=False)
def build(session):
"""
Build an SDist and wheel.
"""
session.install("build", "twine", "check-wheel-contents")
session.run("python", "-m", "build")
session.run("twine", "check", "--strict", "dist/*")
session.run(
"check-wheel-contents", str(*Path("dist").glob("*.whl")), "--ignore=W002"
)