diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4e4b514..ad3a4ce 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -55,7 +55,7 @@ repos: - id: trailing-whitespace - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.4.8 + rev: v0.4.9 hooks: - id: ruff args: [--fix, --show-fixes] @@ -70,7 +70,7 @@ repos: additional_dependencies: - dace==0.16 - jax[cpu]==0.4.29 - - numpy==1.26.4 + - numpy==2.0.0 - pytest==8.2.2 - typing-extensions==4.12.2 - repo: https://github.com/codespell-project/codespell diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1b060b1..555d9d5 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -9,7 +9,7 @@ The fastest way to start with development is to use nox. If you don't have nox, To use, run `nox`. This will lint and test using every installed version of Python on your system, skipping ones that are not installed. You can also run specific jobs: ```console -$ nox -s venv-3.10 # (or venv-3.11, or venv-3.12) Setup a fully working development envinroment +$ nox -s venv-3.10 # (or venv-3.11, or venv-3.12) Setup a fully working development environment $ nox -s lint # Lint only $ nox -s tests # Python tests $ nox -s docs -- --serve # Build and serve the docs diff --git a/noxfile.py b/noxfile.py index 27f9404..b6aec1b 100644 --- a/noxfile.py +++ b/noxfile.py @@ -37,7 +37,7 @@ def load_from_frozen_requirements(filename: str) -> dict[str, str]: REQUIREMENTS = load_from_frozen_requirements(ROOT_DIR / "requirements" / "dev.txt") -@nox.session +@nox.session(python="3.10") def lint(session: nox.Session) -> None: """Run the linter (pre-commit).""" session.install("pre-commit") @@ -54,7 +54,12 @@ def tests(session: nox.Session) -> None: @nox.session(python=["3.10", "3.11", "3.12"]) def venv(session: nox.Session) -> None: """ - Sets up a Python development environment. Use as: `nox -s venv -- [dest_path] [req_preset] + Sets up a Python development environment. Use as: `nox -s venv-3.xx -- [req_preset] [dest_path] + + req_preset: The requirements file to use as 'requirements/{req_preset}.txt'. + Default: 'dev' + dest_path (optional): The path to the virtualenv to create. + Default: '.venv-{3.xx}-{req_preset}' This session will: - Create a python virtualenv for the session @@ -63,20 +68,25 @@ def venv(session: nox.Session) -> None: - Invoke the python interpreter from the created project environment to install the project and all it's development dependencies. """ # noqa: W505 [doc-line-too-long] - venv_path = f"{DEFAULT_DEV_VENV_PATH}-{session.python}" req_preset = "dev" + venv_path = None virtualenv_args = [] if session.posargs: - venv_path, *more_pos_args = session.posargs + req_preset, *more_pos_args = session.posargs if more_pos_args: - req_preset, _ = more_pos_args + venv_path, *_ = more_pos_args + if not venv_path: + venv_path = f"{DEFAULT_DEV_VENV_PATH}-{session.python}-{req_preset}" venv_path = pathlib.Path(venv_path).resolve() if not venv_path.exists(): print(f"Creating virtualenv at '{venv_path}' (options: {virtualenv_args})...") session.install("virtualenv") session.run("virtualenv", venv_path, silent=True) - else: + elif venv_path.exists(): + assert ( + venv_path.is_dir() and (venv_path / "bin" / f"python{session.python}").exists + ), f"'{venv_path}' path already exists but is not a virtualenv with python{session.python}." print(f"'{venv_path}' path already exists. Skipping virtualenv creation...") python_path = venv_path / "bin" / "python" @@ -97,7 +107,7 @@ def venv(session: nox.Session) -> None: ) -@nox.session +@nox.session(reuse_venv=True) def requirements(session: nox.Session) -> None: """Freeze requirements files from project specification and synchronize versions across tools.""" # noqa: W505 [doc-line-too-long] requirements_path = ROOT_DIR / "requirements" diff --git a/requirements/base.in b/requirements/base.in index c077dae..9fee484 100644 --- a/requirements/base.in +++ b/requirements/base.in @@ -1,3 +1,3 @@ -dace>=0.15 +dace>=0.16 jax[cpu]>=0.4.24 numpy>=1.26.0 diff --git a/requirements/base.txt b/requirements/base.txt index 70bc827..fb784ca 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -1,4 +1,4 @@ -# SHA1:190b0703818fae41383e79f02d34ca019cedca4d +# SHA1:50585cb1d4e4cc2297a939939d360c886c4ee3e4 # # This file is autogenerated by pip-compile-multi # To update, run: @@ -31,7 +31,7 @@ mpmath==1.3.0 # via sympy networkx==3.3 # via dace -numpy==1.26.4 +numpy==2.0.0 # via # -r requirements/base.in # dace diff --git a/requirements/dev.txt b/requirements/dev.txt index 4b45b5e..b73bf83 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -78,7 +78,7 @@ pytest-cov==5.0.0 # via -r requirements/dev.in requests==2.32.3 # via sphinx -ruff==0.4.8 +ruff==0.4.9 # via -r requirements/dev.in sniffio==1.3.1 # via anyio