-
Notifications
You must be signed in to change notification settings - Fork 33
/
Copy pathnoxfile.py
54 lines (43 loc) · 1.29 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
# Copyright (c) Jupyter Accessibility Teamam.
# Distributed under the terms of the Modified BSD License.
from contextlib import suppress
from pathlib import Path
TOC = Path("docs", "_toc.yml")
CONFIG = Path("docs", "_config.yml")
CONF = Path("conf.py")
DOIT_CONFIG = dict(verbosity=2)
def task_docs():
def config():
cmd = CmdAction(
f"jb config sphinx --toc {TOC.absolute()} --config {CONFIG.absolute()} .".split(),
shell=False,
)
with suppress(SystemExit):
cmd.execute()
from doit.action import CmdAction
yield dict(
name="configure",
file_dep=[TOC, CONFIG],
actions=[config, f"mv {TOC.parent / CONF} {CONF}"],
targets=[CONF],
clean=True,
)
yield dict(
name="build",
actions=["sphinx-build . _build/html"],
targets=["_build/html/index.html"],
uptodate=[False],
)
try:
import nox
except ModuleNotFoundError:
pass
else:
@nox.session(venv_backend="conda")
def build(session):
session.install("doit")
session.run("doit", *session.posargs)
@nox.session(reuse_venv=True)
def docs(session):
session.install("doit", "-rdocs/requirements.txt")
session.run("doit", "-f", "noxfile.py", *session.posargs),