Mapytex/noxfile.py

36 lines
876 B
Python

#!/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)