forked from cs-cordero/py-ts-interfaces
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnoxfile.py
38 lines (26 loc) · 1.07 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
from functools import wraps
from typing import TypeVar, Callable, Any, cast
from nox_poetry import session as nox_session
from nox_poetry import Session
SUPPORTED_PYTHON_VERSIONS = ["3.7", "3.8", "3.9", "3.10"]
F = TypeVar("F", bound=Callable[..., Any])
def install_poetry_deps(fn: F) -> F:
@wraps(fn)
def wrapper(session: Session, *args, **kwargs):
session.install("-r", str(session.poetry.export_requirements()))
return fn(session, *args, **kwargs)
return cast(F, wrapper)
@nox_session(python=SUPPORTED_PYTHON_VERSIONS)
@install_poetry_deps
def code_quality(session: Session) -> None:
session.run("black", "--check", "py_ts_interfaces")
session.run("flake8", "--count", "py_ts_interfaces")
session.run("isort", "-c", "py_ts_interfaces")
@nox_session(python=SUPPORTED_PYTHON_VERSIONS)
@install_poetry_deps
def type_check(session: Session) -> None:
session.run("mypy", "py_ts_interfaces")
@nox_session(python=SUPPORTED_PYTHON_VERSIONS)
@install_poetry_deps
def pytests(session: Session) -> None:
session.run("python", "-m", "pytest")