From af39d7d35ea08f16d02a7a779b90049c514e8c86 Mon Sep 17 00:00:00 2001 From: Gustaf Rydholm Date: Tue, 25 Jan 2022 18:52:50 +0100 Subject: feat: python version as global variable in noxfile --- noxfile.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/noxfile.py b/noxfile.py index d2279eb..0b00aa5 100644 --- a/noxfile.py +++ b/noxfile.py @@ -6,6 +6,7 @@ import nox from nox.sessions import Session package = "text-recognizer" +versions = ["3.9"] nox.options.sessions = "lint", "mypy", "safety", "tests" locations = ( "text_recognizer", @@ -44,7 +45,7 @@ def install_with_constraints(session: Session, *args: str, **kwargs: Any) -> Non session.install(f"--constraint={requirements.name}", *args, **kwargs) -@nox.session(python="3.9") +@nox.session(python=versions) def black(session: Session) -> None: """Run black code formatter.""" args = session.posargs or locations @@ -52,7 +53,7 @@ def black(session: Session) -> None: session.run("black", *args) -@nox.session(python=["3.9"]) +@nox.session(python=versions) def lint(session: Session) -> None: """Lint using flake8.""" args = session.posargs or locations @@ -70,7 +71,7 @@ def lint(session: Session) -> None: session.run("flake8", *args) -@nox.session(python="3.9") +@nox.session(python=versions) def safety(session: Session) -> None: """Scan dependencies for insecure packages.""" with tempfile.NamedTemporaryFile() as requirements: @@ -87,7 +88,7 @@ def safety(session: Session) -> None: session.run("safety", "check", f"--file={requirements.name}", "--full-report") -@nox.session(python=["3.9"]) +@nox.session(python=versions) def mypy(session: Session) -> None: """Type-check using mypy.""" args = session.posargs or locations @@ -95,7 +96,7 @@ def mypy(session: Session) -> None: session.run("mypy", *args) -@nox.session(python=["3.9"]) +@nox.session(python=versions) def tests(session: Session) -> None: """Run the test suite.""" args = session.posargs or ["--cov", "-m", "not e2e"] @@ -106,7 +107,7 @@ def tests(session: Session) -> None: session.run("pytest", *args) -@nox.session(python=["3.9"]) +@nox.session(python=versions) def typeguard(session: Session) -> None: """Runtime type checking using Typeguard.""" args = session.posargs or ["-m", "not e2e"] -- cgit v1.2.3-70-g09d2