-
Notifications
You must be signed in to change notification settings - Fork 22
/
noxfile.py
71 lines (58 loc) · 1.8 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
"""Nox automation file."""
import platform
import shutil
from pathlib import Path
from nox import Session, session
python_versions = ["3.11", "3.10", "3.9", "3.8"]
@session(python=python_versions)
def tests(session: Session) -> None:
"""Run the test suite."""
if platform.system() == "Windows":
session.install(
"jax[cpu]==0.4.11",
"-f",
"https://whls.blob.core.windows.net/unstable/index.html",
"--use-deprecated",
"legacy-resolver",
)
session.install("ml-dtypes==0.2.0")
session.install(".")
session.install(
"dask",
"pytest",
"pytest-benchmark",
"pytest-datadir",
"pytest-cov",
"xdoctest",
)
session.run("pytest", "--runslow")
@session(python=python_versions[0])
def docs(session: Session) -> None:
"""Build and serve the documentation with live reloading on file changes."""
args = session.posargs or [
"-a",
"-E",
"--open-browser",
"docs",
"docs/_build",
"--watch",
"src",
]
session.install("-e", ".")
session.install("-r", "docs/requirements.txt")
session.install("sphinx", "sphinx-autobuild")
build_dir = Path("docs", "_build")
if build_dir.exists():
shutil.rmtree(build_dir)
session.run("sphinx-autobuild", *args)
@session(name="docs-build", python=python_versions[0])
def docs_build(session: Session) -> None:
"""Build the documentation."""
args = session.posargs or ["docs", "docs/_build"]
session.install(".")
session.install("-r", "docs/requirements.txt")
session.install("sphinx", "sphinx-autobuild")
build_dir = Path("docs", "_build")
if build_dir.exists():
shutil.rmtree(build_dir)
session.run("sphinx-build", *args)