This repository has been archived by the owner on Nov 30, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathnoxfile.py
117 lines (94 loc) · 3.14 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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
import nox
from nox.sessions import Session
nox.options.sessions = "lint", "mypy", "tests"
locations = "hmrb", "docs/conf.py"
@nox.session(python=["3.8"])
def requirements(session: Session) -> None:
args = session.posargs or ["-o", "requirements.txt", "requirements.in"]
session.install("pip-tools")
session.run("pip-compile", *args)
@nox.session(python=["3.8"])
def black(session: Session) -> None:
args = session.posargs or locations
session.install("black")
session.run("black", *args)
@nox.session(python=["3.8"])
def lint(session: Session) -> None:
args = session.posargs or locations
session.install(
"flake8",
"flake8-bandit",
"flake8-black",
"flake8-bugbear",
"flake8-import-order",
)
session.run("flake8", *args)
@nox.session(python=["3.8"])
def types(session: Session) -> None:
args = session.posargs or locations
session.install("mypy")
session.run("mypy", *args)
@nox.session(python=["3.8"])
def safety(session: Session) -> None:
session.install("safety")
session.run("safety", "check", "--file=requirements.txt", "--full-report")
@nox.session(python=["3.6", "3.7", "3.8", "3.9"])
def tests(session: Session) -> None:
session.install("pytest", "pytest-cov")
session.install("-r", "requirements.txt")
session.install("-e", ".")
session.run(
"pytest",
"tests",
"--cov-config",
".coveragerc",
"--cov",
".",
env={"PYTHONHASHSEED": "42"},
)
session.run("coverage", "xml")
@nox.session(python=["3.8"])
def test_spacy2(session: Session) -> None:
session.install("pytest")
session.install("spacy<3.0.0")
session.run("spacy", "download", "en_core_web_sm")
session.install("-r", "requirements.txt")
session.install("-e", ".")
session.run(
"pytest",
"tests/test_spacy.py",
)
@nox.session(python=["3.8"])
def test_spacy3(session: Session) -> None:
session.install("pytest")
session.install("spacy>=3.0.0")
session.run("spacy", "download", "en_core_web_sm")
session.install("-r", "requirements.txt")
session.install("-e", ".")
session.run(
"pytest",
"tests/test_spacy.py",
)
@nox.session(python=["3.8"])
def changelog(session: Session) -> None:
args = session.posargs or ["--unreleased"]
session.install("auto-changelog")
session.run("auto-changelog", *args)
@nox.session(python=["3.8"])
def docs(session: Session) -> None:
args = session.posargs or locations
session.install("-r", "doc_requirements.txt")
session.install("-r", "requirements.txt")
session.install("-e", ".")
session.install("sphinx-autobuild")
session.install(".")
session.run(*args)
@nox.session(python=["3.8"])
def publish(session: Session) -> None:
args = session.posargs or ["-r","testpypi"]
args += ["dist/*"]
session.install("twine", "wheel", "setuptools")
session.run("rm", "-rf", "dist", "build", external=True)
session.run("python", "setup.py", "--quiet", "sdist", "bdist_wheel")
session.run("twine", "check", "--strict", "dist/*")
session.run("twine","upload", *args)