-
-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathnoxfile.py
More file actions
64 lines (46 loc) · 1.74 KB
/
noxfile.py
File metadata and controls
64 lines (46 loc) · 1.74 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
import nox
import glob
nox.options.reuse_existing_virtualenvs = True
nox.options.sessions = ["lint"]
# -----------------------------------------------------------------------------
# Development Commands
# -----------------------------------------------------------------------------
@nox.session()
def lint(session):
session.install("pre-commit")
# only need pre-commit hook for local development
session.run("pre-commit", "install", "--hook-type", "pre-commit")
session.run("pre-commit", "run", "--all-files")
@nox.session(name="test-hook")
def test_hook(session):
session.install("-e", ".")
session.install("pre-commit")
session.run("pre-commit", "try-repo", ".")
@nox.session()
def build(session):
session.run("python3", "-m", "pip", "wheel", "--no-deps", "-w", "dist", ".")
@nox.session(name="install", requires=["build"])
def install_wheel(session):
session.run("python3", "-m", "pip", "wheel", "--no-deps", "-w", "dist", ".")
whl_file = glob.glob("dist/*.whl")
session.install(str(whl_file[0]))
@nox.session(name="commit-check")
def commit_check(session):
session.install(".")
session.run("commit-check", "--message", "--branch", "--author-email")
@nox.session()
def coverage(session):
session.install(".[test]")
session.run("coverage", "run", "--source", "commit_check", "-m", "pytest")
session.run("coverage", "report")
session.run("coverage", "xml")
@nox.session()
def docs(session):
session.install(".[docs]")
session.run("sphinx-build", "-E", "-b", "html", "docs", "_build/html")
@nox.session(name="docs-live")
def docs_live(session):
session.install(".[docs]")
session.run(
"sphinx-autobuild", "-b", "html", "docs", "_build/html", "--watch", "docs/"
)