-
Notifications
You must be signed in to change notification settings - Fork 0
/
noxfile.py
57 lines (45 loc) · 1.55 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
# nox is installed outside of poetry. VS Code is using Poetry Python interpreter,
# which does not know nox. Hence, use the terminal to run nox.
# TODO: apply some of this: https://github.com/cjolowicz/hypermodern-python/blob/master/noxfile.py#L14
# especially look at roughly line 51, flake/lint
import nox
nox.options.sessions = ["black", "ruff"]
# TODO: Is this an option: https://nox-poetry.readthedocs.io/en/stable/
# TODO: or a better option: https://github.com/pdm-project/pdm (instead of Poetry)
@nox.session
def flake(session):
session.install(
"flake8",
"flake8-docstrings",
"flake8-copyright",
"flake8-annotations",
"flake8-bandit",
"flake8-black",
"flake8-bugbear",
"flake8-import-order",
"darglint",
)
session.run("flake8", "./quke/")
@nox.session
def black(session):
session.install("black")
session.run("black", "./quke/")
@nox.session
def ruff(session):
session.install("ruff")
session.run("ruff", "check", "./quke/", "./tests/", "pyproject.toml")
@nox.session
def test(session):
# Not certain this is a good approach. But it currently works.
session.run("pytest", "--cov=quke", "tests/")
# TODO: test_files = session.posargs if session.posargs else []
# TODO: session.run("pytest", "--cov=quke", *test_files)
@nox.session
def mypy(session):
session.install("mypy")
session.run(
"mypy",
"./quke",
"--python-executable",
"/home/vscode/.cache/pypoetry/virtualenvs/quke-61FoJWY3-py3.11/bin/python",
)