-
Notifications
You must be signed in to change notification settings - Fork 0
/
noxfile.py
68 lines (49 loc) · 2.03 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
import nox
from nox.sessions import Session
python = "3.10"
@nox.session(python=python, venv_backend="conda")
def lint(session: Session) -> None:
"""Lint code using various plugins.
flake8 - a Python library that wraps PyFlakes, pycodestyle and McCabe script.
flake8-import-order - checks the ordering of your imports.
flake8-annotations -is a plugin for Flake8 that detects the absence of PEP 3107-style
function annotations and PEP 484-style type comments.
flake8-black - "The Uncompromising Code Formatter", https://pypi.org/project/flake8-black/
"""
args = session.posargs or ["src"]
# TODO - Add in flake8-docstrings (extension for flake8 which uses pydocstyle to check docstrings.)
session.install(
"flake8", "flake8-annotations", "flake8-import-order", "flake8-black"
)
session.run("flake8", *args)
@nox.session(python=python, venv_backend="conda")
def black(session):
args = session.posargs or ["src"]
session.install("black")
session.run("black", *args)
@nox.session(python=python, venv_backend="conda")
def tests(session: Session) -> None:
"""Run the test suite and coverage report."""
session.install("pytest", "pytest-xdist", "pytest-cov")
session.install("-e", ".")
args = session.posargs or ["tests"]
session.run("pytest", "--cov=onemod", "--cov-report=term", *args)
@nox.session(python=python, venv_backend="conda")
def typecheck(session: Session) -> None:
"""Type check code."""
args = session.posargs or ["src"]
session.install("mypy", "types-PyYAML", "pandas-stubs")
session.install("-e", ".")
session.run("mypy", "--explicit-package-bases", *args)
@nox.session(python=python, venv_backend="conda")
def docs(session: Session) -> None:
session.conda_install("graphviz", "mysqlclient")
session.install(
"sphinx",
"sphinx-autodoc-typehints",
"sphinx_rtd_theme",
"sphinx_autoapi",
)
session.install(".")
output_dir = "out/_html"
session.run("sphinx-build", "docs", output_dir)