-
Notifications
You must be signed in to change notification settings - Fork 311
/
Copy pathnoxfile.py
167 lines (149 loc) · 3.99 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
import os
import nox
nox.options.default_venv_backend = "uv"
nox.options.reuse_existing_virtualenvs = True
nox.options.error_on_external_run = True
@nox.session
def lint(session):
session.run_install(
"uv",
"sync",
"--only-group",
"ruff",
env={"UV_PROJECT_ENVIRONMENT": session.virtualenv.location},
)
session.run("ruff", "check", ".", *session.posargs)
@nox.session
def format(session):
session.run_install(
"uv",
"sync",
"--only-group",
"ruff",
env={"UV_PROJECT_ENVIRONMENT": session.virtualenv.location},
)
session.run("ruff", "format", ".", *session.posargs)
@nox.session
def mypy(session):
session.run_install(
"uv",
"sync",
"--no-install-workspace",
"--no-default-groups",
"--group",
"mypy",
"--extra",
"webdriver",
"--group",
"test",
env={"UV_PROJECT_ENVIRONMENT": session.virtualenv.location},
)
session.run("mypy", ".", *session.posargs)
@nox.session
def docs(session: nox.Session):
session.run_install(
"uv",
"sync",
"--no-default-groups",
"--group",
"docs",
"--no-install-workspace",
env={"UV_PROJECT_ENVIRONMENT": session.virtualenv.location},
)
session.run(
"sphinx-build",
"docs",
"dist/docs",
"-E",
"-j",
"auto",
"-T",
"-W",
"--keep-going",
*session.posargs,
env={
"PYTHONPATH": os.path.join(os.path.dirname(__file__), "python"),
},
)
@nox.session
def test(session: nox.Session):
session.run_install(
"uv",
"sync",
"--no-default-groups",
"--group",
"test",
"--extra",
"webdriver",
"--no-editable",
env={"UV_PROJECT_ENVIRONMENT": session.virtualenv.location},
)
session.chdir("python/tests")
session.run("pytest", "-vv", "-s", *session.posargs)
@nox.session
def test_xvfb(session: nox.Session):
session.run_install(
"uv",
"sync",
"--no-default-groups",
"--group",
"test",
"--extra",
"webdriver",
"--no-editable",
env={"UV_PROJECT_ENVIRONMENT": session.virtualenv.location},
)
session.chdir("python/tests")
session.run(
"xvfb-run",
"-e",
"/dev/stderr",
"--auto-servernum",
"--server-args",
"-screen 0 1024x768x24",
"pytest",
"-vv",
"-s",
*session.posargs,
external=True,
env={"PATH": os.environ["PATH"]},
include_outer_env=False,
)
@nox.session
def test_editable(session: nox.Session):
session.run_install(
"uv",
"sync",
"--no-default-groups",
"--group",
"test",
"--extra",
"webdriver",
env={"UV_PROJECT_ENVIRONMENT": session.virtualenv.location},
)
session.chdir("python/tests")
session.run("pytest", "-vv", "-s", "--skip-browser-tests", *session.posargs)
@nox.session(python=False)
def cibuildwheel(session: nox.Session):
session.run(
"uv",
"run",
"--only-group",
"cibuildwheel",
"cibuildwheel",
"--output-dir",
"dist",
*session.posargs,
env={
"CIBW_BUILD_FRONTEND": "build[uv]",
"CIBW_ARCHS_MACOS": "x86_64 arm64",
"CIBW_SKIP": "pp* *_i686 *-win32 *-musllinux*",
"CIBW_TEST_GROUPS": "test",
"CIBW_TEST_COMMAND": "python -m pytest {project}/python/tests -vv -s --skip-browser-tests",
"CIBW_MANYLINUX_X86_64_IMAGE": "manylinux2014",
# Assume the client bundle was already built. The github actions workflow builds
# the client with specific defines to include the build stamp, and that would be
# lost if setup.py rebuilds the client.
"CIBW_ENVIRONMENT": "NEUROGLANCER_PREBUILT_CLIENT=1",
},
)