diff --git a/noxfile.py b/noxfile.py index 847bf1c..fbbeb9a 100644 --- a/noxfile.py +++ b/noxfile.py @@ -5,14 +5,14 @@ @nox.session -def tests(session): +def tests(session: nox.Session) -> None: """Run tests with pytest.""" session.install(".") - session.run("pytest") + session.run("pytest", *session.posargs) @nox.session -def docs(session): +def docs(session: nox.Session) -> None: """Build documentation with Sphinx.""" session.install(".") session.run( @@ -21,4 +21,29 @@ def docs(session): "docs/build/html", "--builder", "html", + *session.posargs, ) + + +@nox.session +def build(session: nox.Session) -> None: + """Build & verify the source distribution and wheel.""" + session.install("twine", "build") + build_command = ("python", "-m", "build") + session.run(*build_command, "--sdist") + session.run(*build_command, "--wheel") + session.run("twine", "check", "dist/*") + + +@nox.session +def mypy(session: nox.Session) -> None: + """Perform static type checking with mypy.""" + MYPY_COMMAND: tuple[str, ...] = ( + "mypy", + ".", + "--show-error-context", + "--show-error-code-links", + "--pretty", + ) + session.install(".") + session.run(*MYPY_COMMAND, *session.posargs)