-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathnoxfile.py
More file actions
72 lines (50 loc) · 2.04 KB
/
noxfile.py
File metadata and controls
72 lines (50 loc) · 2.04 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
"""Nox configuration for multi-version Python testing.
This configuration uses nox-uv for fast, reproducible environment management
with uv's lockfile. Run `nox` to test against all supported Python versions,
or use `nox -s tests-3.12` to test a specific version.
"""
from __future__ import annotations
import nox
from nox_uv import session
# Use uv as the default venv backend for speed
nox.options.default_venv_backend = "uv"
# Reuse virtual environments by default for faster local iteration
nox.options.reuse_venv = "yes"
# All Python versions supported by the SDK (must match CI matrix)
PYTHON_VERSIONS = ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
# Default sessions to run
nox.options.sessions = ["tests"]
@session(python=PYTHON_VERSIONS, uv_groups=["test"])
def tests(s: nox.Session) -> None:
"""Run the test suite against all supported Python versions."""
args = s.posargs or []
s.run("pytest", *args)
@session(python=PYTHON_VERSIONS, uv_groups=["test"])
def coverage(s: nox.Session) -> None:
"""Run tests with coverage reporting."""
s.run("pytest", "--cov=workos", "--cov-report=term-missing", *s.posargs)
@session(uv_only_groups=["lint"])
def lint(s: nox.Session) -> None:
"""Run linting with ruff."""
s.run("ruff", "check", ".")
@session(uv_only_groups=["lint"])
def format(s: nox.Session) -> None:
"""Check code formatting with ruff."""
s.run("ruff", "format", "--check", ".")
@session(uv_only_groups=["lint"])
def format_fix(s: nox.Session) -> None:
"""Apply code formatting with ruff."""
s.run("ruff", "format", ".")
@session(uv_groups=["type_check"])
def typecheck(s: nox.Session) -> None:
"""Run type checking with mypy."""
s.run("mypy")
@session(uv_groups=["test", "lint", "type_check"])
def ci(s: nox.Session) -> None:
"""Run all CI checks (format, lint, typecheck, tests) for a single Python version.
This is useful for quick local validation before pushing.
"""
s.run("ruff", "format", "--check", ".")
s.run("ruff", "check", ".")
s.run("mypy")
s.run("pytest")