Modernized build tooling
This commit is contained in:
+60
@@ -0,0 +1,60 @@
|
||||
import nox
|
||||
|
||||
PY_VERSIONS = ["3.13"]
|
||||
DEFAULT_PYTHON = "3.13"
|
||||
|
||||
|
||||
@nox.session(python=PY_VERSIONS)
|
||||
def behave(session):
|
||||
"""Run all behaviour scenarios."""
|
||||
session.install("-e", ".[dev]")
|
||||
session.run("behave", "-q", *session.posargs)
|
||||
|
||||
|
||||
@nox.session(python=DEFAULT_PYTHON)
|
||||
def lint(session):
|
||||
"""Run linting with ruff."""
|
||||
session.install("ruff")
|
||||
session.run("ruff", "format", "--check", ".")
|
||||
session.run("ruff", "check", ".")
|
||||
|
||||
|
||||
@nox.session(python=DEFAULT_PYTHON)
|
||||
def format(session):
|
||||
"""Format code with ruff."""
|
||||
session.install("ruff")
|
||||
session.run("ruff", "format", ".")
|
||||
session.run("ruff", "check", "--fix", ".")
|
||||
|
||||
|
||||
@nox.session(python=DEFAULT_PYTHON)
|
||||
def typecheck(session):
|
||||
"""Run type checking with pyright."""
|
||||
session.install("-e", ".[dev]")
|
||||
session.install("pyright")
|
||||
session.run("pyright")
|
||||
|
||||
|
||||
@nox.session(python=DEFAULT_PYTHON)
|
||||
def docs(session):
|
||||
"""Build documentation."""
|
||||
session.install("-e", ".[dev]")
|
||||
session.run("mkdocs", "build")
|
||||
|
||||
|
||||
@nox.session(python=DEFAULT_PYTHON)
|
||||
def serve_docs(session):
|
||||
"""Serve documentation locally."""
|
||||
session.install("-e", ".[dev]")
|
||||
session.run("mkdocs", "serve")
|
||||
|
||||
|
||||
# Don't run serve_docs by default
|
||||
nox.options.sessions = ["behave", "lint", "format", "typecheck", "docs", "build"]
|
||||
|
||||
|
||||
@nox.session(python=DEFAULT_PYTHON)
|
||||
def build(session):
|
||||
"""Build distribution packages."""
|
||||
session.install("build")
|
||||
session.run("python", "-m", "build", "--wheel")
|
||||
Reference in New Issue
Block a user