-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnoxfile.py
More file actions
executable file
·84 lines (66 loc) · 1.85 KB
/
noxfile.py
File metadata and controls
executable file
·84 lines (66 loc) · 1.85 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/usr/bin/env -S uv run --script
# /// script
# dependencies = ["nox"]
# ///
"""Nox configuration."""
from __future__ import annotations
import nox
PYPROJECT = nox.project.load_toml("pyproject.toml")
PYTHON_VERSIONS = nox.project.python_versions(PYPROJECT)
nox.needs_version = ">=2025.2.9"
nox.options.sessions = ("tests", "mypy", "ty")
nox.options.default_venv_backend = "uv"
UV_SYNC_COMMAND = (
"uv",
"sync",
"--locked",
"--no-dev",
)
@nox.session(python=PYTHON_VERSIONS)
def tests(session: nox.Session) -> None:
"""Execute pytest tests."""
env = {
"UV_PROJECT_ENVIRONMENT": session.virtualenv.location,
}
if isinstance(session.python, str):
env["UV_PYTHON"] = session.python
session.run_install(
*UV_SYNC_COMMAND,
"--group=ci",
"--group=testing",
env=env,
)
session.run("pytest", *session.posargs)
@nox.session(tags=["typing"])
def mypy(session: nox.Session) -> None:
"""Check types with mypy."""
env = {
"UV_PROJECT_ENVIRONMENT": session.virtualenv.location,
}
if isinstance(session.python, str):
env["UV_PYTHON"] = session.python
session.run_install(
*UV_SYNC_COMMAND,
"--group=testing",
"--group=typing",
env=env,
)
args = session.posargs or ("tap_socketdev", "tests")
session.run("mypy", *args)
@nox.session(tags=["typing"])
def ty(session: nox.Session) -> None:
"""Check types with ty."""
env = {
"UV_PROJECT_ENVIRONMENT": session.virtualenv.location,
}
if isinstance(session.python, str):
env["UV_PYTHON"] = session.python
session.run_install(
*UV_SYNC_COMMAND,
"--group=typing",
env=env,
)
args = session.posargs or ("tap_socketdev", "tests")
session.run("ty", "check", *args)
if __name__ == "__main__":
nox.main()