-
Notifications
You must be signed in to change notification settings - Fork 2
/
noxfile.py
52 lines (42 loc) · 1.59 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
import nox
def confirm(message:str, validators:list = ["y", "yes"]):
"""Used to confirm you have done what is being asked"""
valid_input = False
while not valid_input:
response = input(message + str(validators).replace(","," or").replace("[","(").replace("]",")").replace("'",""))
if response in validators:
valid_input = True
else:
raise ValueError(f"Failed to confirm; {message}")
@nox.session
def build(session):
"""Builds a distribution for PyPi"""
# Create source distribution
session.run("python", "setup.py", "sdist")
# Create wheelfile
session.install("wheel")
session.run("python", "setup.py", "bdist_wheel", "--universal")
@nox.session
def release(session):
"""Runs build and then releases distribution to PyPi"""
build(session)
# Confirm all the essential release stuff has been done
confirm("Have you run the tests?")
confirm("Have you updated inline docs?")
confirm("Have you updated the docs folder documentation?")
confirm("Have you created the release page?")
confirm("Have you updated the readme docs?")
session.install('twine')
session.run("twine", "upload", "dist/*")
@nox.session(python=["3.5", "3.6", "3.7", "3.8"])
def test(session):
"""Runs tests defined in tests folder against all installed versions
of python from 3.5-3.8"""
session.install('.')
session.install('pytest')
session.run('pytest')
@nox.session
def docs(session):
# Serve documentation to verify it's how you want
session.install("mkdocs")
session.run("mkdocs", "serve")