Skip to content

Commit

Permalink
Add nox sessions for building package & running mypy
Browse files Browse the repository at this point in the history
  • Loading branch information
namurphy committed Jul 3, 2024
1 parent f264714 commit 5799223
Showing 1 changed file with 28 additions and 3 deletions.
31 changes: 28 additions & 3 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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)

0 comments on commit 5799223

Please sign in to comment.