Skip to content

Commit

Permalink
Move dependency-heavy tasks to extras (#739)
Browse files Browse the repository at this point in the history
* remove redundant versions

* process features extras

* process mask extras

* fix pyproject extra
  • Loading branch information
zigaLuksic authored Aug 31, 2023
1 parent 5940817 commit 7a34967
Show file tree
Hide file tree
Showing 19 changed files with 25 additions and 42 deletions.
2 changes: 0 additions & 2 deletions eolearn/core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,3 @@
from .utils.fs import get_filesystem, load_s3_filesystem, pickle_fs, unpickle_fs
from .utils.parallelize import execute_with_mp_lock, join_futures, join_futures_iter, parallelize
from .utils.parsing import FeatureParser

__version__ = "1.4.2"
2 changes: 0 additions & 2 deletions eolearn/coregistration/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,3 @@
"""

from .coregistration import ECCRegistrationTask, get_gradient

__version__ = "1.4.2"
16 changes: 0 additions & 16 deletions eolearn/features/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,10 @@

from .bands_extraction import EuclideanNormTask, NormalizedDifferenceIndexTask
from .blob import BlobTask, DoGBlobTask, DoHBlobTask, LoGBlobTask
from .clustering import ClusteringTask
from .doubly_logistic_approximation import DoublyLogisticApproximationTask
from .feature_manipulation import FilterTimeSeriesTask, LinearFunctionTask, SimpleFilterTask, ValueFilloutTask
from .haralick import HaralickTask
from .hog import HOGTask
from .interpolation import (
AkimaInterpolationTask,
BSplineInterpolationTask,
CubicInterpolationTask,
CubicResamplingTask,
InterpolationTask,
KrigingInterpolationTask,
LinearInterpolationTask,
LinearResamplingTask,
NearestResamplingTask,
ResamplingTask,
SplineInterpolationTask,
)
from .local_binary_pattern import LocalBinaryPatternTask
from .radiometric_normalization import (
BlueCompositingTask,
Expand All @@ -37,5 +23,3 @@
AddMaxMinTemporalIndicesTask,
AddSpatioTemporalFeaturesTask,
)

__version__ = "1.4.2"
4 changes: 4 additions & 0 deletions eolearn/features/extra/__init__.py
Original file line number Diff line number Diff line change
@@ -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.
"""
File renamed without changes.
File renamed without changes.
2 changes: 0 additions & 2 deletions eolearn/geometry/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,3 @@
SuperpixelSegmentationTask,
)
from .transformations import RasterToVectorTask, VectorToRasterTask

__version__ = "1.4.2"
2 changes: 0 additions & 2 deletions eolearn/io/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,3 @@
SentinelHubSen2corTask,
get_available_timestamps,
)

__version__ = "1.4.2"
3 changes: 0 additions & 3 deletions eolearn/mask/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
Public classes and functions of mask subpackage
"""

from .cloud_mask import CloudMaskTask
from .mask_counting import ClassFrequencyTask
from .masking import JoinMasksTask, MaskFeatureTask
from .snow_mask import SnowMaskTask, TheiaSnowMaskTask
from .utils import resize_images

__version__ = "1.4.2"
4 changes: 4 additions & 0 deletions eolearn/mask/extra/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
"""
A collection of EOTasks with non-standard dependencies. Use the extra `MASK_EXTRA` to install dependencies or
install the module-specific dependencies by hand.
"""
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from eolearn.core.types import Feature
from eolearn.core.utils.common import _apply_to_spatial_axes

from .utils import resize_images
from ..utils import resize_images

LOGGER = logging.getLogger(__name__)

Expand Down
2 changes: 0 additions & 2 deletions eolearn/ml_tools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,3 @@

from .sampling import BlockSamplingTask, FractionSamplingTask, GridSamplingTask, sample_by_values
from .train_test_split import TrainTestSplitTask

__version__ = "1.4.2"
2 changes: 0 additions & 2 deletions eolearn/visualization/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,3 @@
"""

from .eopatch import PlotBackend, PlotConfig

__version__ = "1.4.2"
19 changes: 13 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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,MASK_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",
Expand All @@ -79,7 +79,8 @@ 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 = ["opencv-python-headless"]
mask_extra = ["lightgbm>=2.0.11, <4", "s2cloudless", "scikit-image>=0.13.0"]
mltools = ["shapely"]
tdigest = ["tdigest==0.5.2.2"]
mltoolsplotting = ["matplotlib"]
Expand Down Expand Up @@ -174,7 +175,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"]


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
from numpy.testing import assert_array_equal

from eolearn.core import FeatureType
from eolearn.mask import CloudMaskTask
from eolearn.mask.cloud_mask import _get_window_indices, _OldCloudMaskTask
from eolearn.mask.extra.cloud_mask import CloudMaskTask, _get_window_indices, _OldCloudMaskTask


@pytest.mark.parametrize(
Expand Down

0 comments on commit 7a34967

Please sign in to comment.