From 7cb1639f27c4b14a1e6bbcf8772aa57f3a94a9ac Mon Sep 17 00:00:00 2001 From: Saransh Chopra Date: Tue, 5 Mar 2024 15:28:01 +0100 Subject: [PATCH] feat: add a lite nox session + add numba as optional dependency --- noxfile.py | 21 +++++++++++++-------- pyproject.toml | 3 +++ 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/noxfile.py b/noxfile.py index cb268151..0248fcbe 100644 --- a/noxfile.py +++ b/noxfile.py @@ -4,9 +4,7 @@ import nox -ALL_PYTHONS = ["3.8", "3.9", "3.10", "3.11", "3.12"] - -nox.options.sessions = ["lint", "tests", "doctests"] +nox.options.sessions = ["lint", "lite", "tests", "doctests"] DIR = Path(__file__).parent.resolve() @@ -27,10 +25,17 @@ def pylint(session: nox.Session) -> None: session.run("pylint", "src/vector/", *session.posargs) -@nox.session(python=ALL_PYTHONS, reuse_venv=True) +@nox.session +def lite(session: nox.Session) -> None: + """Run the linter.""" + session.install("-e", ".[test]") + session.run("pytest", "--ignore", "tests/test_notebooks.py", *session.posargs) + + +@nox.session(reuse_venv=True) def tests(session: nox.Session) -> None: """Run the unit and regular tests.""" - session.install("-e", ".[awkward,test,test-extras]") + session.install("-e", ".[awkward,numba,test,test-extras]") session.run("pytest", "--ignore", "tests/test_notebooks.py", *session.posargs) @@ -44,14 +49,14 @@ def coverage(session: nox.Session) -> None: @nox.session(reuse_venv=True) def doctests(session: nox.Session) -> None: """Run the doctests.""" - session.install("-e", ".[awkward,test,test-extras]") + session.install("-e", ".[awkward,numba,test,test-extras]") session.run("pytest", "--doctest-plus", "src/vector/", *session.posargs) -@nox.session(python=ALL_PYTHONS, reuse_venv=True) +@nox.session(reuse_venv=True) def notebooks(session: nox.Session) -> None: """Run the notebook tests""" - session.install("-e", ".[awkward,test,test-extras]", "numba") + session.install("-e", ".[awkward,numba,test,test-extras]", "numba") session.install("jupyter", "papermill") session.run("pytest", "tests/test_notebooks.py", *session.posargs) diff --git a/pyproject.toml b/pyproject.toml index 7e8c8c5d..1c00dc8d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -64,6 +64,9 @@ docs = [ "sphinx_book_theme>=0.0.42", "sphinx_copybutton", ] +numba = [ + 'numba>=0.57; python_version < "3.12"', +] test = [ "nox", "papermill>=2.4",