Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Polish nox setup #185

Merged
merged 2 commits into from
Mar 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 18 additions & 14 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,57 +5,61 @@
package = "biip"
locations = ["src", "tests", "noxfile.py", "docs/conf.py"]

supported_pythons = ["3.7", "3.8", "3.9", "3.10", "3.11"]
coverage_python = "3.11"
docs_python = "3.11"

@nox.session(python=["3.7", "3.8", "3.9", "3.10", "3.11"])
def tests(session):

@nox.session(python=supported_pythons)
def tests(session: nox.Session) -> None:
"""Run the test suite."""
args = session.posargs or ["--cov"]
session.run("poetry", "install", "--all-extras", "--only=main,tests", external=True)
session.run("pytest", *args)


@nox.session(python="3.11")
def coverage(session):
@nox.session(python=coverage_python)
def coverage(session: nox.Session) -> None:
"""Upload test coverage data."""
session.run("poetry", "install", "--no-root", "--only=tests", external=True)
session.run("coverage", "xml", "--fail-under=0")
session.run("codecov", *session.posargs)


@nox.session(python=["3.7", "3.8", "3.9", "3.10", "3.11"])
def black(session):
@nox.session(python=supported_pythons)
def black(session: nox.Session) -> None:
"""Check formatting using Black."""
args = session.posargs or locations
session.run("poetry", "install", "--no-root", "--only=black", external=True)
session.run("black", *args)


@nox.session(python=["3.7", "3.8", "3.9", "3.10", "3.11"])
def ruff(session):
@nox.session(python=supported_pythons)
def ruff(session: nox.Session) -> None:
"""Lint using ruff."""
args = session.posargs or locations
session.run("poetry", "install", "--no-root", "--only=ruff", external=True)
session.run("ruff", *args)


@nox.session(python=["3.7", "3.8", "3.9", "3.10", "3.11"])
def darglint(session):
@nox.session(python=supported_pythons)
def darglint(session: nox.Session) -> None:
"""Check docstrings using darglint."""
args = session.posargs or ["src"]
session.run("poetry", "install", "--no-root", "--only=darglint", external=True)
session.run("darglint", *args)


@nox.session(python=["3.7", "3.8", "3.9", "3.10", "3.11"])
def mypy(session):
@nox.session(python=supported_pythons)
def mypy(session: nox.Session) -> None:
"""Type-check using mypy."""
args = session.posargs or locations
session.run("poetry", "install", "--only=mypy", external=True)
session.run("mypy", *args)


@nox.session(python="3.11")
def docs(session):
@nox.session(python=docs_python)
def docs(session: nox.Session) -> None:
"""Build the documentation."""
session.run("poetry", "install", "--all-extras", "--only=main,docs", external=True)
session.run("sphinx-build", "docs", "docs/_build")
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ target-version = "py37"

[tool.ruff.per-file-ignores]
"docs/*" = ["INP001"]
"noxfile.py" = ["ANN"]
"scripts/*" = ["INP001", "T20"]
"tests/*" = ["D"]

Expand Down