From e9f1acced6cd664be0b94d85c14c9b89c0273894 Mon Sep 17 00:00:00 2001 From: Ziga Luksic Date: Thu, 31 Aug 2023 14:25:28 +0200 Subject: [PATCH] process features extras --- eolearn/features/extra/__init__.py | 4 ++++ eolearn/features/{ => extra}/clustering.py | 0 eolearn/features/{ => extra}/interpolation.py | 0 pyproject.toml | 23 ++++++++++++++----- tests/features/{ => extra}/test_clustering.py | 2 +- .../{ => extra}/test_interpolation.py | 2 +- 6 files changed, 23 insertions(+), 8 deletions(-) create mode 100644 eolearn/features/extra/__init__.py rename eolearn/features/{ => extra}/clustering.py (100%) rename eolearn/features/{ => extra}/interpolation.py (100%) rename tests/features/{ => extra}/test_clustering.py (96%) rename tests/features/{ => extra}/test_interpolation.py (99%) diff --git a/eolearn/features/extra/__init__.py b/eolearn/features/extra/__init__.py new file mode 100644 index 00000000..0f1b579e --- /dev/null +++ b/eolearn/features/extra/__init__.py @@ -0,0 +1,4 @@ +""" +A collection of EOTasks with non-standard dependencies. Use the extra `FEATURES_EXTRA` to install dependencies or +install the module-specific dependencies by hand. +""" diff --git a/eolearn/features/clustering.py b/eolearn/features/extra/clustering.py similarity index 100% rename from eolearn/features/clustering.py rename to eolearn/features/extra/clustering.py diff --git a/eolearn/features/interpolation.py b/eolearn/features/extra/interpolation.py similarity index 100% rename from eolearn/features/interpolation.py rename to eolearn/features/extra/interpolation.py diff --git a/pyproject.toml b/pyproject.toml index a1461535..646fb46f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -59,15 +59,15 @@ dependencies = [ all = [ "eo-learn[COREGISTRATION,FEATURES,GEOMETRY,IO,MASK,MLTOOLS,VISUALIZATION]", ] -full = ["eo-learn[ALL,RAY,ZARR,METEOBLUE,TDIGEST]"] +full = ["eo-learn[ALL,RAY,ZARR,METEOBLUE,TDIGEST,FEATURES_EXTRA]"] ray = ["ray[default]"] zarr = ["s3fs", "zarr"] coregistration = [ "opencv-python-headless", -] # using headless version of opencv, otherwise gitlab runners fail -features = [ +] # using headless, otherwise gitlab runners fail +features = ["opencv-python-headless"] +features_extra = [ "numba>=0.53.0", - "opencv-python-headless", "scikit-image>=0.19.0", "scikit-learn", "scipy", @@ -79,7 +79,12 @@ geodb = [ "xcube-geodb @ git+git://github.com/dcs4cop/xcube-geodb.git", ] meteoblue = ["meteoblue_dataset_sdk>=1,<2"] -mask = ["lightgbm>=2.0.11, <4", "opencv-python-headless", "s2cloudless", "scikit-image>=0.13.0"] +mask = [ + "lightgbm>=2.0.11, <4", + "opencv-python-headless", + "s2cloudless", + "scikit-image>=0.13.0", +] mltools = ["shapely"] tdigest = ["tdigest==0.5.2.2"] mltoolsplotting = ["matplotlib"] @@ -174,7 +179,13 @@ ignore = [ "B028", # always demands a stacklevel argument when warning "PT011", # complains for `pytest.raises(ValueError)` but we use it a lot ] -per-file-ignores = { "__init__.py" = ["F401", "I002"], "conf.py" = ["I002", "FA100"] } +per-file-ignores = { "__init__.py" = [ + "F401", + "I002", +], "conf.py" = [ + "I002", + "FA100", +] } exclude = [".git", "__pycache__", "build", "dist"] diff --git a/tests/features/test_clustering.py b/tests/features/extra/test_clustering.py similarity index 96% rename from tests/features/test_clustering.py rename to tests/features/extra/test_clustering.py index 6339f24e..b143b080 100644 --- a/tests/features/test_clustering.py +++ b/tests/features/extra/test_clustering.py @@ -13,7 +13,7 @@ import pytest from eolearn.core import FeatureType -from eolearn.features import ClusteringTask +from eolearn.features.extra.clustering import ClusteringTask logging.basicConfig(level=logging.DEBUG) diff --git a/tests/features/test_interpolation.py b/tests/features/extra/test_interpolation.py similarity index 99% rename from tests/features/test_interpolation.py rename to tests/features/extra/test_interpolation.py index fdef3293..f563b993 100644 --- a/tests/features/test_interpolation.py +++ b/tests/features/extra/test_interpolation.py @@ -16,7 +16,7 @@ from sentinelhub.testing_utils import assert_statistics_match from eolearn.core import EOPatch, EOTask, FeatureType -from eolearn.features import ( +from eolearn.features.extra.interpolation import ( InterpolationTask, KrigingInterpolationTask, LinearInterpolationTask,