diff options
author | Gustaf Rydholm <gustaf.rydholm@gmail.com> | 2022-01-25 18:52:50 +0100 |
---|---|---|
committer | Gustaf Rydholm <gustaf.rydholm@gmail.com> | 2022-01-25 18:52:50 +0100 |
commit | af39d7d35ea08f16d02a7a779b90049c514e8c86 (patch) | |
tree | c65d52e56c0ca188f47b00420a9ec5ac4f41991d /noxfile.py | |
parent | 7127ba99e2f7bb108ea3bc0b92097ac02fd02c74 (diff) |
feat: python version as global variable in noxfile
Diffstat (limited to 'noxfile.py')
-rw-r--r-- | noxfile.py | 13 |
1 files changed, 7 insertions, 6 deletions
@@ -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"] |