Skip to content

Commit

Permalink
Merge remote-tracking branch 'github/main' into initial_implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
philip-paul-mueller committed Jun 17, 2024
2 parents 1700885 + ca03fbd commit 90a25a6
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 14 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
24 changes: 17 additions & 7 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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
Expand All @@ -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"
Expand All @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion requirements/base.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
dace>=0.15
dace>=0.16
jax[cpu]>=0.4.24
numpy>=1.26.0
4 changes: 2 additions & 2 deletions requirements/base.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SHA1:190b0703818fae41383e79f02d34ca019cedca4d
# SHA1:50585cb1d4e4cc2297a939939d360c886c4ee3e4
#
# This file is autogenerated by pip-compile-multi
# To update, run:
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 90a25a6

Please sign in to comment.