From 0f1cd582523f90d8ba85e8a595995e4b709a329d Mon Sep 17 00:00:00 2001 From: Martin Durant Date: Thu, 19 Sep 2024 13:48:38 -0400 Subject: [PATCH 1/5] try From 9d8fb3eb7a67db18cbb1e0cad05fafb17f5aac2f Mon Sep 17 00:00:00 2001 From: Martin Durant Date: Thu, 19 Sep 2024 13:49:45 -0400 Subject: [PATCH 2/5] kick --- afile | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 afile diff --git a/afile b/afile new file mode 100644 index 0000000..e69de29 From e7dd906b8c263bc39183f02d56a9ca81f774119c Mon Sep 17 00:00:00 2001 From: Martin Durant Date: Thu, 19 Sep 2024 14:10:25 -0400 Subject: [PATCH 3/5] Import dak if it's in the system --- src/dask_histogram/core.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/dask_histogram/core.py b/src/dask_histogram/core.py index 4f3cec7..64d5f19 100644 --- a/src/dask_histogram/core.py +++ b/src/dask_histogram/core.py @@ -524,7 +524,9 @@ def _get_optimization_function(): # running this optimization even in cases where it's unncessary # because if no AwkwardInputLayers from dask-awkward are # detected then the original graph is returned unchanged. - if dask.config.get("awkward", default=False): + import importlib.metadata + + if importlib.metadata.distribution("dask_awkward"): from dask_awkward.lib.optimize import all_optimizations return all_optimizations From f2caba648a8a89fda0500d12155041e67214f5be Mon Sep 17 00:00:00 2001 From: Martin Durant Date: Thu, 19 Sep 2024 14:13:27 -0400 Subject: [PATCH 4/5] Simpler way (since we're going to import it anyway) --- src/dask_histogram/core.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/dask_histogram/core.py b/src/dask_histogram/core.py index 64d5f19..739c8ce 100644 --- a/src/dask_histogram/core.py +++ b/src/dask_histogram/core.py @@ -526,10 +526,12 @@ def _get_optimization_function(): # detected then the original graph is returned unchanged. import importlib.metadata - if importlib.metadata.distribution("dask_awkward"): + try: from dask_awkward.lib.optimize import all_optimizations return all_optimizations + except (ImportError, ModuleNotFoundError): + pass return optimize From 6f1b27782f0f0bf276a6da744a0abb6dc3e3ddd6 Mon Sep 17 00:00:00 2001 From: Martin Durant Date: Thu, 19 Sep 2024 14:37:02 -0400 Subject: [PATCH 5/5] Remove unused line --- src/dask_histogram/core.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/dask_histogram/core.py b/src/dask_histogram/core.py index 739c8ce..b80943d 100644 --- a/src/dask_histogram/core.py +++ b/src/dask_histogram/core.py @@ -524,8 +524,6 @@ def _get_optimization_function(): # running this optimization even in cases where it's unncessary # because if no AwkwardInputLayers from dask-awkward are # detected then the original graph is returned unchanged. - import importlib.metadata - try: from dask_awkward.lib.optimize import all_optimizations