From 4c44d6b500cb697ecccd624e197e1b0e02bbb2df Mon Sep 17 00:00:00 2001 From: Tal Ben-Nun Date: Fri, 1 Nov 2024 08:15:22 -0700 Subject: [PATCH 1/4] Make jinja2 an optional dependency --- dace/cli/dacelab.py | 5 ----- dace/cli/sdfg_diff.py | 6 +++++- dace/cli/sdfv.py | 6 +++++- setup.py | 2 +- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/dace/cli/dacelab.py b/dace/cli/dacelab.py index 27a3215e09..647ec31a3d 100644 --- a/dace/cli/dacelab.py +++ b/dace/cli/dacelab.py @@ -2,11 +2,6 @@ # Copyright 2019-2021 ETH Zurich and the DaCe authors. All rights reserved. import argparse -import numpy -import pickle -import json - -import dace from dace.frontend.octave import parse from dace.sdfg.nodes import AccessNode diff --git a/dace/cli/sdfg_diff.py b/dace/cli/sdfg_diff.py index 9c40e59f10..2ec0a3adf4 100644 --- a/dace/cli/sdfg_diff.py +++ b/dace/cli/sdfg_diff.py @@ -9,7 +9,6 @@ import tempfile from typing import Dict, Literal, Set, Tuple, Union -import jinja2 import dace from dace import memlet as mlt from dace.sdfg import nodes as nd @@ -179,6 +178,11 @@ def main(): diff_sets = _sdfg_diff(sdfg_A, sdfg_B, eq_strategy) if args.graphical: + try: + import jinja2 + except (ImportError, ModuleNotFoundError): + raise ImportError('Graphical SDFG diff requires jinja2, please install by running `pip install jinja2`') + basepath = os.path.join(os.path.dirname(os.path.realpath(dace.__file__)), 'viewer') template_loader = jinja2.FileSystemLoader(searchpath=os.path.join(basepath, 'templates')) template_env = jinja2.Environment(loader=template_loader) diff --git a/dace/cli/sdfv.py b/dace/cli/sdfv.py index 49255a1e7e..2012debe82 100644 --- a/dace/cli/sdfv.py +++ b/dace/cli/sdfv.py @@ -13,7 +13,6 @@ import dace import tempfile -import jinja2 def partialclass(cls, *args, **kwds): @@ -48,6 +47,11 @@ def view(sdfg: dace.SDFG, filename: Optional[Union[str, int]] = None, verbose: b os.close(fd) return + try: + import jinja2 + except (ImportError, ModuleNotFoundError): + raise ImportError('SDFG.view() requires jinja2, please install by running `pip install jinja2`') + if type(sdfg) is dace.SDFG: sdfg = dace.serialize.dumps(sdfg.to_json()) diff --git a/setup.py b/setup.py index 6e8635bdf6..c228ae4558 100644 --- a/setup.py +++ b/setup.py @@ -73,7 +73,7 @@ }, include_package_data=True, install_requires=[ - 'numpy < 2.0', 'networkx >= 2.5', 'astunparse', 'sympy >= 1.9', 'pyyaml', 'ply', 'websockets', 'jinja2', + 'numpy < 2.0', 'networkx >= 2.5', 'astunparse', 'sympy >= 1.9', 'pyyaml', 'ply', 'fparser >= 0.1.3', 'aenum >= 3.1', 'dataclasses; python_version < "3.7"', 'dill', 'pyreadline;platform_system=="Windows"', 'typing-compat; python_version < "3.8"', 'packaging' ] + cmake_requires, From b5c1790a1bb4aca1e0721fe27d20b477d2476a69 Mon Sep 17 00:00:00 2001 From: Tal Ben-Nun Date: Fri, 1 Nov 2024 10:01:22 -0700 Subject: [PATCH 2/4] Update requirements.txt --- requirements.txt | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/requirements.txt b/requirements.txt index 3cc37cc468..b902968b73 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,21 +1,12 @@ -aenum==3.1.12 +aenum==3.1.15 astunparse==1.6.3 -certifi==2024.7.4 -charset-normalizer==3.1.0 -click==8.1.3 -dill==0.3.6 -fparser==0.1.3 -idna==3.7 -importlib-metadata==6.6.0 -Jinja2==3.1.4 -MarkupSafe==2.1.3 +dill==0.3.9 +fparser==0.1.4 mpmath==1.3.0 -networkx==3.1 -numpy==1.26.1 +networkx==3.4.2 +numpy==1.26.4 +packaging==24.1 ply==3.11 -PyYAML==6.0.1 +PyYAML==6.0.2 six==1.16.0 -sympy==1.9 -urllib3==2.2.2 -websockets==11.0.3 -zipp==3.15.0 +sympy==1.13.3 From 6ebc24e56085e68f36b08cfb49c770b257ba1ce2 Mon Sep 17 00:00:00 2001 From: Tal Ben-Nun Date: Wed, 30 Oct 2024 23:38:28 -0700 Subject: [PATCH 3/4] Update version.py --- dace/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dace/version.py b/dace/version.py index 9513287c94..195ef069da 100644 --- a/dace/version.py +++ b/dace/version.py @@ -1 +1 @@ -__version__ = '0.16.1' +__version__ = '1.0.0rc1' From 71c42b72ecca6352189f7c73296e856dc796662f Mon Sep 17 00:00:00 2001 From: Tal Ben-Nun Date: Fri, 1 Nov 2024 18:04:42 +0100 Subject: [PATCH 4/4] Update version.py --- dace/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dace/version.py b/dace/version.py index 195ef069da..1f356cc57b 100644 --- a/dace/version.py +++ b/dace/version.py @@ -1 +1 @@ -__version__ = '1.0.0rc1' +__version__ = '1.0.0'