This repository has been archived by the owner on Sep 27, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
noxfile.py
92 lines (72 loc) · 2.51 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
import nox # type: ignore
from pathlib import Path
nox.options.sessions = ["tests", "lint", "build"]
python = ["3.6", "3.7", "3.8"]
lint_dependencies = [
"-e",
".",
"black",
"flake8",
"flake8-bugbear",
"mypy",
]
@nox.session(python=python)
def tests(session):
session.install("-e", ".", "pytest", "pytest-cov", "IPython")
tests = session.posargs or ["tests"]
session.run(
"pytest",
"--cov=observable_jupyter",
"--cov-config",
".coveragerc",
"--cov-report=",
*tests
)
session.notify("cover")
@nox.session()
def js_tests(session):
session.run("yarn", "--cwd", "js")
session.run("yarn", "--cwd", "js", "test", external=True)
@nox.session(python="3.7")
def edit_example(session):
"""Open the example Jupyter notebook with a dev install of this module"""
session.install("-e", ".", "Jupyter")
session.run("Jupyter", "notebook", "Observable_Embed_Example.ipynb")
@nox.session(python="3.7")
def jupyter_notebook_test(session):
"""Open the example Jupyter notebook with a dev install of this module"""
session.install("-e", ".", "jupyter")
session.run("jupyter", "notebook", "test_notebook.ipynb")
@nox.session(python="3.7")
def jupyter_lab_test(session):
"""Open the example Jupyter notebook with a dev install of this module"""
session.install("-e", ".", "jupyterlab")
session.run("jupyter", "lab", "test_notebook.ipynb")
@nox.session
def cover(session):
"""Coverage analysis"""
session.install("coverage")
session.run("coverage", "report", "--show-missing", "--fail-under=0")
session.run("coverage", "erase")
@nox.session(python="3.7")
def lint(session):
session.install(*lint_dependencies)
files = ["tests"] + [str(p) for p in Path(".").glob("*.py")]
session.run("black", "--check", *files)
session.run("flake8", *files)
session.run("mypy", *files)
session.run("python", "setup.py", "check", "--metadata", "--strict")
@nox.session(python="3.7")
def build(session):
session.install("setuptools")
session.install("wheel")
session.install("twine")
session.run("rm", "-rf", "dist", "build", external=True)
session.run("yarn", "--cwd", "js")
session.run("yarn", "--cwd", "js", "build", external=True)
session.run("python", "setup.py", "--quiet", "sdist", "bdist_wheel")
@nox.session(python="3.7")
def publish(session):
build(session)
print("REMINDER: Has the changelog been updated?")
session.run("python", "-m", "twine", "upload", "dist/*")