-
Notifications
You must be signed in to change notification settings - Fork 14
/
noxfile.py
47 lines (35 loc) · 1.33 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
import nox
@nox.session(python=["3.8", "3.9", "3.10", "3.11", "3.12", "pypy3.8"])
def tests(session):
session.install(".[test]")
session.run(
"coverage", "run", "-m", "pytest", "--timeout=300", "-v", *session.posargs
)
@nox.session
def flake8(session):
session.install("flake8")
session.run("flake8", "pytest_subprocess", "tests", *session.posargs)
@nox.session
def mypy(session):
session.install("mypy")
session.run("mypy", "--version")
session.run("mypy", "pytest_subprocess", "--config-file=setup.cfg")
session.run("mypy", "tests/test_typing.py", "--config-file=setup.cfg")
# Note sphinx-napoleon uses deprecated renames removed in 3.10
@nox.session(python="3.9")
def docs(session):
session.install(".[docs]")
session.run("sphinx-build", "-b", "html", "docs", "docs/_build", "-v", "-W")
@nox.session
def create_dist(session):
session.install("twine", "build")
session.run("python", "-m", "build")
session.run("twine", "check", "dist/*")
@nox.session
def publish(session):
"""Publish to pypi. Run `nox publish -- prod` to publish to the official repo."""
create_dist(session)
twine_command = ["twine", "upload", "dist/*"]
if "prod" not in session.posargs:
twine_command.extend(["--repository-url", "https://test.pypi.org/legacy/"])
session.run(*twine_command)