From 1a4e8ffb19bcc0a623d6b79a77698801edd17a57 Mon Sep 17 00:00:00 2001 From: Bertrand Benjamin Date: Sun, 13 Oct 2019 21:04:52 +0200 Subject: [PATCH] Feat: start using nox --- .gitignore | 2 ++ noxfile.py | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 noxfile.py diff --git a/.gitignore b/.gitignore index 712b895..74ab0a6 100644 --- a/.gitignore +++ b/.gitignore @@ -4,5 +4,7 @@ dist/ build/ *.egg-info/ documentation/build/ +documentation/source/_build/ cache/ venv/ +.nox diff --git a/noxfile.py b/noxfile.py new file mode 100644 index 0000000..835719e --- /dev/null +++ b/noxfile.py @@ -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)