-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnoxfile.py
More file actions
88 lines (72 loc) · 1.9 KB
/
Copy pathnoxfile.py
File metadata and controls
88 lines (72 loc) · 1.9 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
"""This module implements our CI function calls."""
from pathlib import Path
import nox
SRC_DIR = Path(__file__).parent / "src"
@nox.session(name="test")
def run_test(session):
"""Run pytest.
Args:
session (nox.Session): The nox session.
"""
session.install("pandas")
session.install("numpy")
session.install("pytest")
session.env["PYTHONPATH"] = str(SRC_DIR)
session.run("pytest")
@nox.session(name="lint")
def lint(session):
"""Check code conventions.
Args:
session (nox.Session): The nox session.
"""
session.install(
"flake8",
"flake8-black",
"flake8-docstrings",
"flake8-bugbear",
"flake8-broken-line",
"pep8-naming",
"pydocstyle",
"darglint",
)
session.run(
"flake8",
"--max-line-length=88",
"--extend-ignore=E203,W503",
"src",
"tests",
"noxfile.py",
)
@nox.session(name="typing")
def mypy(session):
"""Check type hints.
Args:
session (nox.Session): The nox session.
"""
session.install("mypy")
session.install("PyYAML")
session.run(
"mypy",
"--install-types",
"--non-interactive",
"--ignore-missing-imports",
"--no-strict-optional",
"--no-warn-return-any",
"--implicit-reexport",
"--allow-untyped-calls",
"src",
)
@nox.session(name="format")
def format(session):
"""Fix common convention problems automatically.
Args:
session (nox.Session): The nox session.
"""
session.install("black")
session.install("isort")
session.run("isort", "src", "noxfile.py")
session.run("black", "src", "noxfile.py")
session.run("isort", "scripts", "noxfile.py")
session.run("black", "scripts", "noxfile.py")
session.run("isort", "tests", "noxfile.py")
session.run("black", "tests", "noxfile.py")