From d6c87032ae1fb2726c492056fe83281ec1436112 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Robert?= Date: Sun, 24 Nov 2024 16:57:34 +0100 Subject: [PATCH] DEP: drop lick as a hard dependency --- nonos/api/satellite.py | 9 ++++++++- pyproject.toml | 1 - requirements/tests_all.txt | 1 + tests/test_image_comp.py | 2 ++ 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/nonos/api/satellite.py b/nonos/api/satellite.py index ce46454c..9667133b 100644 --- a/nonos/api/satellite.py +++ b/nonos/api/satellite.py @@ -1,9 +1,9 @@ import warnings +from importlib.util import find_spec from pathlib import Path from typing import TYPE_CHECKING, Optional import numpy as np -from lick.lick import lick_box from nonos.api.analysis import Coordinates, GasField, Plotable from nonos.loaders import Recipe, loader_from, recipe_from @@ -97,6 +97,13 @@ def __init__( method_background: str = "nearest", light_source: bool = True, ): + if find_spec("lick") is None: + raise RuntimeError( + "NonosLick cannot be instantiated because lick is not installed" + ) + + from lick.lick import lick_box + self.xmin = xmin self.xmax = xmax self.ymin = ymin diff --git a/pyproject.toml b/pyproject.toml index 2c25ac0b..d048e3ff 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,7 +21,6 @@ requires-python = ">=3.9" dependencies = [ "cblind>=2.3.0", "inifix>=3.0.0", - "lick>=0.5.1", "loguru>=0.5.3", "matplotlib>=3.5.0", "numpy>=1.19.3", diff --git a/requirements/tests_all.txt b/requirements/tests_all.txt index b1db7509..be3d7b59 100644 --- a/requirements/tests_all.txt +++ b/requirements/tests_all.txt @@ -2,4 +2,5 @@ cblind>=2.3.0 cmocean>=3.0.3 cmyt>=2.0.0 +lick>=0.5.1 numexpr>=2.8.3 diff --git a/tests/test_image_comp.py b/tests/test_image_comp.py index 06775acb..5d1ef17d 100644 --- a/tests/test_image_comp.py +++ b/tests/test_image_comp.py @@ -1,4 +1,5 @@ from copy import deepcopy +from importlib.util import find_spec import inifix import matplotlib as mpl @@ -95,6 +96,7 @@ def test_3D_vm_xy(test_data_dir, temp_figure_and_axis): return fig +@pytest.mark.skipif(find_spec("lick") is None, reason="lick is not installed") @pytest.mark.parametrize("method", ["nearest", "linear"]) @pytest.mark.mpl_image_compare() def test_nonoslick_method(method, tmp_path):