Feat: start using nox

This commit is contained in:
Bertrand Benjamin 2019-10-13 21:04:52 +02:00
parent d6bb61dc48
commit 1a4e8ffb19
2 changed files with 37 additions and 0 deletions

2
.gitignore vendored
View File

@ -4,5 +4,7 @@ dist/
build/ build/
*.egg-info/ *.egg-info/
documentation/build/ documentation/build/
documentation/source/_build/
cache/ cache/
venv/ venv/
.nox

35
noxfile.py Normal file
View File

@ -0,0 +1,35 @@
#!/usr/bin/env python
import nox
@nox.session
def lint(session):
session.install("black")
session.run("black", "mapytex", "noxfile.py", "setup.py")
@nox.session
def test(session):
session.install("-r", "requirements.txt")
session.install("pytest")
session.run("pytest", "mapytex")
@nox.session
def docs(session):
"""Build the documentation."""
session.run("rm", "-rf", "documentation/_build", external=True)
session.install("sphinx", "sphinx-autobuild", "sphinx_rtd_theme")
session.install(".")
session.cd("documentation/source")
sphinx_args = ["-b", "html", "-W", "-d", "_build/doctrees", ".", "_build/html"]
if not session.interactive:
sphinx_cmd = "sphinx-build"
else:
sphinx_cmd = "sphinx-autobuild"
sphinx_args.insert(0, "--open-browser")
session.run(sphinx_cmd, *sphinx_args)