-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathnoxfile.py
65 lines (48 loc) · 1.68 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
from pathlib import Path
import nox
nox.options.reuse_existing_virtualenvs = True
def _find_packages(path: Path):
for pkg in path.iterdir():
if pkg.is_dir() and len(list(pkg.glob("**/*.py"))) >= 1:
yield pkg
@nox.session(python="3.10")
def lint(session):
session.run("poetry", "install", external=True)
session.run("flake8", "--extend-exclude=.nox", ".")
@nox.session(python="3.10")
def format(session):
session.run("poetry", "install", external=True)
if "--fix" in session.posargs:
session.run("black", ".")
elif "--diff" in session.posargs:
session.run("black", ".", "--diff")
else:
session.run("black", ".", "--check")
@nox.session(python="3.10")
def typecheck(session):
session.run("poetry", "install", external=True)
repo = Path(".")
tc = repo / "tamr_client"
session.run("mypy", "--package", str(tc))
tc_examples = [str(x) for x in (repo / "examples").glob("**/*.py")]
session.run("mypy", *tc_examples)
tc_tests = [str(x) for x in (repo / "tests" / "tamr_client").glob("**/*.py")]
session.run("mypy", *tc_tests)
@nox.session(python=["3.7", "3.8", "3.9", "3.10"])
def test(session):
session.run("poetry", "install", external=True)
session.run("pytest", *session.posargs, env={"TAMR_CLIENT_BETA": "1"})
@nox.session(python="3.7")
def docs(session):
# RTD uses pip for managing dependencies, so we mirror that approach
session.install(".")
session.install("-r", "docs/requirements.txt")
session.run(
"sphinx-build",
"-b",
"html",
"docs",
"docs/_build",
"-W",
env={"TAMR_CLIENT_BETA": "1", "TAMR_CLIENT_DOCS": "1"},
)