From 4395e6dbfdffdecd601b9a11baa3c67281534ff2 Mon Sep 17 00:00:00 2001 From: Arya Massarat <23412689+aryarm@users.noreply.github.com> Date: Fri, 15 Mar 2024 16:39:43 -0700 Subject: [PATCH] add black to the ci --- noxfile.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/noxfile.py b/noxfile.py index 073e0ca..3c6b6ac 100644 --- a/noxfile.py +++ b/noxfile.py @@ -1,5 +1,6 @@ """Nox sessions.""" import os +import shutil from pathlib import Path import nox @@ -9,9 +10,12 @@ package = "core" python_versions = ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] +locked_python_version = "3.8" nox.needs_version = ">= 2022.11.21" nox.options.sessions = ( + "docs", "tests", + "lint", ) @@ -21,6 +25,28 @@ ] + +@session(python=locked_python_version) +def docs(session: Session) -> None: + """Build the documentation.""" + args = session.posargs or ["docs", "docs/_build"] + if not session.posargs and "FORCE_COLOR" in os.environ: + args.insert(0, "--color") + + build_dir = Path("docs", "_build") + if build_dir.exists(): + shutil.rmtree(build_dir) + + session.run("sphinx-build", *args) + + +@session(python=locked_python_version) +def lint(session: Session) -> None: + """Lint our code.""" + session.install("black") + session.run("black", "--verbose", "--check", ".") + + def install_handle_python(session): """ handle incompatibilities between python and other packages