This repository was archived by the owner on Jun 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathnoxfile.py
More file actions
44 lines (28 loc) · 1.29 KB
/
noxfile.py
File metadata and controls
44 lines (28 loc) · 1.29 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
import typing
import nox
MAIN_PKG: typing.Final[str] = "multibar"
TESTS_PKG: typing.Final[str] = "tests"
EXAMPLES_PKG: typing.Final[str] = "examples"
NOX_PKGS: typing.Final[tuple[str, ...]] = (MAIN_PKG, TESTS_PKG, EXAMPLES_PKG)
RUN_BLACK_ON_PKGS: typing.Final[tuple[str, ...]] = (MAIN_PKG, EXAMPLES_PKG)
BASE_REQUIREMENTS: typing.Final[tuple[str, ...]] = ("-r", "requirements.txt")
DEV_REQUIREMENTS: typing.Final[tuple[str, ...]] = ("-r", "dev-requirements.txt")
@nox.session(python=["3.9", "3.10"])
def pytest(session: nox.Session) -> None:
"""Runs all tests in `tests` package."""
session.install(*DEV_REQUIREMENTS)
session.install(*BASE_REQUIREMENTS)
session.run("pytest")
@nox.session
def reformat_code(session: nox.Session) -> None:
"""Formats code according to `black` and `isort` standards."""
session.install(*DEV_REQUIREMENTS)
session.install(*BASE_REQUIREMENTS)
session.run("black", "--config=pyproject.toml", *RUN_BLACK_ON_PKGS)
session.run("isort", "--profile=black", *NOX_PKGS)
@nox.session(reuse_venv=True)
def mypy(session: nox.Session) -> None:
"""Checks `multibar` package for type-hint errors."""
session.install(*DEV_REQUIREMENTS)
session.install(*BASE_REQUIREMENTS)
session.run("mypy", "-p", "multibar", "--config", "pyproject.toml")