forked from pypa/cibuildwheel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnoxfile.py
93 lines (71 loc) · 2.01 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
import shutil
import sys
from pathlib import Path
import nox
nox.options.sessions = ["lint", "tests"]
PYTHON_ALL_VERSIONS = ["3.6", "3.7", "3.8", "3.9"]
DIR = Path(__file__).parent.resolve()
@nox.session
def tests(session):
"""
Run the unit and regular tests.
"""
unit_test_args = ["--run-docker"] if sys.platform.startswith("linux") else []
session.install("-e", ".[test]")
session.run("pytest", "unit_test", *unit_test_args)
session.run("pytest", "test", "-x", "--durations", "0", "--timeout=2400", "test")
@nox.session
def lint(session):
"""
Run the linter.
"""
session.install("pre-commit")
session.run("pre-commit", "run", "--all-files")
@nox.session(python=PYTHON_ALL_VERSIONS)
def update_constraints(session):
"""
Update the dependencies inplace.
"""
session.install("requests", "pip-tools")
session.run("python", "bin/update_dependencies.py")
@nox.session
def update_pins(session):
"""
Update the python and docker pins version inplace.
"""
session.install("-e", ".[dev]")
session.run("python", "bin/update_pythons.py", "--force")
session.run("python", "bin/update_docker.py")
@nox.session
def update_proj(session):
"""
Update the README inplace.
"""
session.install("-e", ".[dev]")
session.run("./bin/projects.py", "docs/data/projects.yml", "--readme=README.md")
@nox.session
def docs(session):
"""
Build the docs.
"""
session.install("-e", ".[docs]")
if session.posargs:
if "serve" in session.posargs:
session.run("mkdocs", "serve")
else:
print("Unrecognized args, use 'serve'")
else:
session.run("mkdocs", "build")
@nox.session
def build(session):
"""
Build an SDist and wheel.
"""
build_p = DIR.joinpath("build")
if build_p.exists():
shutil.rmtree(build_p)
dist_p = DIR.joinpath("dist")
if dist_p.exists():
shutil.rmtree(dist_p)
session.install("build")
session.run("python", "-m", "build")