-
Notifications
You must be signed in to change notification settings - Fork 13
/
noxfile.py
61 lines (47 loc) · 1.57 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
from pprint import pformat
import nox
cleaned = [
"etrago/cluster/disaggregation.py",
"etrago/tools/calc_results.py",
"etrago/tools/network.py",
"etrago/tools/utilities.py",
"noxfile.py",
"setup.py",
]
def setdefaults(session):
session.env["PYTHONUNBUFFERED"] = "yes"
@nox.session(python="3")
def check(session):
"""Run custom checks."""
setdefaults(session)
assert cleaned == sorted(set(cleaned)), (
"The list of cleaned files contains duplicates and/or isn't sorted"
" alphabetically."
f"\nExpected:\n{pformat(sorted(set(cleaned)))}"
f"\nGot:\n{pformat(cleaned)}"
)
@nox.session(python="3")
def black(session):
"""Check for happy little style accidents with `black`."""
setdefaults(session)
session.install("black")
session.run("black", "--check", "--diff", *cleaned)
@nox.session(python="3")
def isort(session):
"""Check import ordering with `isort`."""
setdefaults(session)
session.install("isort >= 5")
session.run("isort", "--check-only", "--diff", *cleaned)
@nox.session(python="3")
def flake8(session):
"""Check for happy little style accidents with `flake8`."""
setdefaults(session)
session.install("Flake8-pyproject", "flake8")
session.run("flake8", *cleaned)
@nox.session(python=["3", "3.8", "3.9", "3.10", "3.11"])
def build(session):
"""Build the package and check for packaging errors."""
setdefaults(session)
session.install("twine")
session.run("python", "setup.py", "bdist", "bdist_wheel")
session.run("twine", "check", "dist/eTraGo*")