Skip to content

Commit bd4717b

Browse files
authored
Release 1.5.3, Merge pull request #785 from sentinel-hub/develop
Release 1.5.3
2 parents 0310d55 + 43545cf commit bd4717b

32 files changed

+242
-245
lines changed

.github/workflows/ci_action.yml

+20-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,9 @@ jobs:
8585
cache: pip
8686

8787
- name: Install packages
88-
run: pip install -e .[DEV] --upgrade --upgrade-strategy eager
88+
run: | # must install async-timeout until ray fixes issue
89+
pip install -e .[DEV] --upgrade --upgrade-strategy eager
90+
pip install async-timeout
8991
9092
- name: Run full tests and code coverage
9193
if: ${{ matrix.full_test_suite }}
@@ -110,3 +112,20 @@ jobs:
110112
files: coverage.xml
111113
fail_ci_if_error: true
112114
verbose: false
115+
116+
mirror-and-integration-test-on-gitlab:
117+
if: github.event_name == 'push'
118+
runs-on: ubuntu-latest
119+
steps:
120+
- uses: actions/checkout@v1
121+
- name: Mirror + trigger CI
122+
uses: SvanBoxel/gitlab-mirror-and-ci-action@master
123+
with:
124+
args: "https://git.sinergise.com/eo/code/eo-learn/"
125+
env:
126+
FOLLOW_TAGS: "true"
127+
GITLAB_HOSTNAME: "git.sinergise.com"
128+
GITLAB_USERNAME: "github-action"
129+
GITLAB_PASSWORD: ${{ secrets.GITLAB_PASSWORD }}
130+
GITLAB_PROJECT_ID: "164"
131+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/ci_trigger.yml

+10-21
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,19 @@
1-
name: mirror_and_trigger
1+
name: trigger
22

33
on:
4-
pull_request:
5-
push:
6-
branches:
7-
- "master"
8-
- "develop"
9-
workflow_call:
104
release:
115
types:
126
- published
137

148
jobs:
15-
mirror-and-integration-test-on-gitlab:
16-
if: github.event_name == 'push'
9+
trigger:
1710
runs-on: ubuntu-latest
1811
steps:
19-
- uses: actions/checkout@v1
20-
- name: Mirror + trigger CI
21-
uses: SvanBoxel/gitlab-mirror-and-ci-action@master
22-
with:
23-
args: "https://git.sinergise.com/eo/code/eo-learn/"
24-
env:
25-
FOLLOW_TAGS: "true"
26-
GITLAB_HOSTNAME: "git.sinergise.com"
27-
GITLAB_USERNAME: "github-action"
28-
GITLAB_PASSWORD: ${{ secrets.GITLAB_PASSWORD }}
29-
GITLAB_PROJECT_ID: "164"
30-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
12+
- name: Trigger API
13+
run: >
14+
curl -X POST --fail \
15+
-F token=${{ secrets.GITLAB_PIPELINE_TRIGGER_TOKEN }} \
16+
-F ref=main \
17+
-F variables[CUSTOM_RUN_TAG]=auto \
18+
-F variables[LAYER_NAME]=dotai-eo \
19+
https://git.sinergise.com/api/v4/projects/1031/trigger/pipeline

.gitlab-ci.yml

-15
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ image: python:3.9
22

33
stages:
44
- test
5-
- build
65

76
run_sh_integration_tests:
87
stage: test
@@ -14,17 +13,3 @@ run_sh_integration_tests:
1413
- pip install .[DEV]
1514
- sentinelhub.config --sh_client_id "$SH_CLIENT_ID" --sh_client_secret "$SH_CLIENT_SECRET" > /dev/null # Gitlab can't mask SH_CLIENT_SECRET in logs
1615
- pytest -m sh_integration
17-
18-
build_docker_image:
19-
stage: build
20-
needs: []
21-
rules:
22-
- if: $CI_COMMIT_TAG # run only on releases
23-
when: always
24-
variables:
25-
CUSTOM_RUN_TAG: auto # this will create images with the latest tag and the version tag
26-
LAYER_NAME: dotai-eo
27-
- when: manual
28-
trigger:
29-
project: eo/infra/docker
30-
allow_failure: true

.pre-commit-config.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,18 @@ repos:
1313
- id: debug-statements
1414

1515
- repo: https://github.com/psf/black
16-
rev: 23.10.1
16+
rev: 23.12.1
1717
hooks:
1818
- id: black
1919
language_version: python3
2020

2121
- repo: https://github.com/charliermarsh/ruff-pre-commit
22-
rev: "v0.1.4"
22+
rev: "v0.1.11"
2323
hooks:
2424
- id: ruff
2525

2626
- repo: https://github.com/nbQA-dev/nbQA
27-
rev: 1.7.0
27+
rev: 1.7.1
2828
hooks:
2929
- id: nbqa-black
3030
- id: nbqa-ruff

.zenodo.json

+3
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,9 @@
206206
},
207207
{
208208
"id": "101004112"
209+
},
210+
{
211+
"id": "101059548"
209212
}
210213
]
211214
}

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## [Version 1.5.3] - 2024-01-10
2+
3+
- Fix `numpy<2` in anticipation of numpy 2.0 release.
4+
5+
16
## [Version 1.5.2] - 2023-11-07
27

38
- `RayExecutor` can now forward remote kwargs to ray jobs.

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -202,4 +202,4 @@ See [LICENSE](https://github.com/sentinel-hub/eo-learn/blob/master/LICENSE).
202202

203203
## Acknowledgements
204204

205-
This project has received funding from the European Union’s Horizon 2020 research and innovation programme under grant agreements No. 776115 and No. 101004112.
205+
This project has received funding from the European Union’s Horizon 2020 research and innovation programme under grant agreements No. 776115, No. 101004112 and No. 101059548.

eolearn/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Main module of the `eolearn` package."""
22

3-
__version__ = "1.5.2"
3+
__version__ = "1.5.3"
44

55
import importlib.util
66
import warnings

eolearn/core/constants.py

+10-7
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@
1313
from enum import Enum, EnumMeta
1414
from typing import Any, TypeVar
1515

16+
from typing_extensions import deprecated
17+
1618
from sentinelhub import BBox, MimeType
17-
from sentinelhub.exceptions import deprecated_function
1819

1920
from .exceptions import EODeprecationWarning
2021

@@ -157,14 +158,16 @@ def is_image(self) -> bool:
157158
"""True if FeatureType stores a dictionary with arrays that represent images. False otherwise."""
158159
return self.is_array() and self.is_spatial()
159160

160-
@deprecated_function(
161-
EODeprecationWarning, "Use the equivalent `is_array` method, or consider if `is_image` fits better."
161+
@deprecated(
162+
"The method `is_raster` has been deprecated. Use the equivalent `is_array` method, or consider if `is_image`"
163+
" fits better.",
164+
category=EODeprecationWarning,
162165
)
163166
def is_raster(self) -> bool:
164167
"""True if FeatureType stores a dictionary with raster data. False otherwise."""
165168
return self.is_array()
166169

167-
@deprecated_function(EODeprecationWarning)
170+
@deprecated("The method `has_dict` has been deprecated.", category=EODeprecationWarning)
168171
def has_dict(self) -> bool:
169172
"""True if FeatureType stores a dictionary. False otherwise."""
170173
return self in [
@@ -181,7 +184,7 @@ def has_dict(self) -> bool:
181184
FeatureType.META_INFO,
182185
]
183186

184-
@deprecated_function(EODeprecationWarning)
187+
@deprecated("The method `contains_ndarrays` has been deprecated.", category=EODeprecationWarning)
185188
def contains_ndarrays(self) -> bool:
186189
"""True if FeatureType stores a dictionary of numpy.ndarrays. False otherwise."""
187190
return self.is_array()
@@ -201,7 +204,7 @@ def ndim(self) -> int | None:
201204
}[self]
202205
return None
203206

204-
@deprecated_function(EODeprecationWarning)
207+
@deprecated("The method `type` has been deprecated.", category=EODeprecationWarning)
205208
def type(self) -> type:
206209
"""Returns type of the data for the given FeatureType."""
207210
if self is FeatureType.TIMESTAMPS:
@@ -210,7 +213,7 @@ def type(self) -> type:
210213
return BBox
211214
return dict
212215

213-
@deprecated_function(EODeprecationWarning)
216+
@deprecated("The method `file_format` has been deprecated.", category=EODeprecationWarning)
214217
def file_format(self) -> MimeType:
215218
"""Returns a mime type enum of a file format into which data of the feature type will be serialized"""
216219
if self.is_array():

eolearn/core/core_tasks.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
import fs
1919
import numpy as np
2020
from fs.base import FS
21+
from typing_extensions import deprecated
2122

2223
from sentinelhub import SHConfig
23-
from sentinelhub.exceptions import deprecated_class
2424

2525
from .constants import FeatureType, OverwritePermission
2626
from .eodata import EOPatch
@@ -56,7 +56,9 @@ def execute(self, eopatch: EOPatch) -> EOPatch:
5656
return eopatch.copy(features=self.features, deep=self.deep, copy_timestamps=self.copy_timestamps)
5757

5858

59-
@deprecated_class(EODeprecationWarning, "Use `CopyTask` with the configuration `deep=True`.")
59+
@deprecated(
60+
"Use `CopyTask` with the configuration `deep=True` instead of `DeepCopyTask`.", category=EODeprecationWarning
61+
)
6062
class DeepCopyTask(CopyTask):
6163
"""[DEPRECATED] Makes a deep copy of the given EOPatch."""
6264

@@ -119,7 +121,7 @@ def __init__(
119121
all features will be saved.
120122
:param overwrite_permission: A level of permission for overwriting an existing EOPatch
121123
to 9 (highest compression).
122-
:save_timestamps: Whether to save the timestamps of the EOPatch. With the `"auto"` setting timestamps are saved
124+
:save_timestamps: Save the timestamps of the EOPatch. With the `"auto"` setting timestamps are saved
123125
if `features=...` or if other temporal features are being saved.
124126
:param use_zarr: Saves numpy-array based features into Zarr files. Requires ZARR extra dependencies.
125127
:param temporal_selection: Writes all of the data to the chosen temporal indices of preexisting arrays. Can be
@@ -191,7 +193,7 @@ def __init__(
191193
default configuration will be taken.
192194
:param features: A collection of features to be loaded. By default, all features will be loaded.
193195
:param lazy_loading: If `True` features will be lazy loaded.
194-
:load_timestamps: Whether to load the timestamps of the EOPatch. With the `"auto"` setting timestamps are loaded
196+
:load_timestamps: Load the timestamps of the EOPatch. With the `"auto"` setting timestamps are loaded
195197
if `features=...` or if other temporal features are being loaded.
196198
:param temporal_selection: Only loads data corresponding to the chosen indices. Can also be a callable that,
197199
given a list of timestamps, returns a list of booleans declaring which temporal slices to load.

eolearn/core/eodata.py

+23-14
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@
3434
import geopandas as gpd
3535
import numpy as np
3636
from fs.base import FS
37+
from typing_extensions import deprecated
3738

3839
from sentinelhub import CRS, BBox, parse_time
39-
from sentinelhub.exceptions import deprecated_function
4040

4141
from .constants import FEATURETYPE_DEPRECATION_MSG, TIMESTAMP_COLUMN, FeatureType, OverwritePermission
4242
from .eodata_io import FeatureIO, load_eopatch_content, save_eopatch
@@ -427,7 +427,10 @@ def __contains__(self, key: object) -> bool:
427427
"`(feature_type, feature_name)` pairs."
428428
)
429429

430-
@deprecated_function(EODeprecationWarning, "Use the `merge` method instead.")
430+
@deprecated(
431+
"The `+` operator for EOPatches has been deprecated. Use the function `eolearn.core.merge_eopatches` instead.",
432+
category=EODeprecationWarning,
433+
)
431434
def __add__(self, other: EOPatch) -> EOPatch:
432435
"""Merges two EOPatches into a new EOPatch."""
433436
return self.merge(other)
@@ -499,7 +502,7 @@ def __copy__(
499502
"""Returns a new EOPatch with shallow copies of given features.
500503
501504
:param features: A collection of features or feature types that will be copied into new EOPatch.
502-
:param copy_timestamps: Whether to copy timestamps to the new EOPatch. By default copies them over if all
505+
:param copy_timestamps: Copy timestamps to the new EOPatch. By default copies them over if all
503506
features are copied or if any temporal features are getting copied.
504507
"""
505508
if not features: # For some reason deepcopy and copy pass {} by default
@@ -526,7 +529,7 @@ def __deepcopy__(
526529
527530
:param memo: built-in parameter for memoization
528531
:param features: A collection of features or feature types that will be copied into new EOPatch.
529-
:param copy_timestamps: Whether to copy timestamps to the new EOPatch. By default copies them over if all
532+
:param copy_timestamps: Copy timestamps to the new EOPatch. By default copies them over if all
530533
features are copied or if any temporal features are getting copied.
531534
"""
532535
if not features: # For some reason deepcopy and copy pass {} by default
@@ -564,7 +567,7 @@ def copy(
564567
:param features: Features to be copied into a new `EOPatch`. By default, all features will be copied.
565568
:param deep: If `True` it will make a deep copy of all data inside the `EOPatch`. Otherwise, only a shallow copy
566569
of `EOPatch` will be made. Note that `BBOX` and `TIMESTAMPS` will be copied even with a shallow copy.
567-
:param copy_timestamps: Whether to copy timestamps to the new EOPatch. By default copies them over if all
570+
:param copy_timestamps: Copy timestamps to the new EOPatch. By default copies them over if all
568571
features are copied or if any temporal features are getting copied.
569572
:return: An EOPatch copy.
570573
"""
@@ -591,14 +594,14 @@ def get_features(self) -> list[Feature]:
591594
592595
:return: List of non-empty features
593596
"""
594-
feature_list: list[Feature] = []
595597
with warnings.catch_warnings():
596598
warnings.filterwarnings("ignore", message=FEATURETYPE_DEPRECATION_MSG.format(".*?", ".*?"))
597599
removed_ftypes = {FeatureType.BBOX, FeatureType.TIMESTAMPS} # list comprehensions make ignoring hard
598-
for feature_type in (ftype for ftype in FeatureType if ftype not in removed_ftypes):
599-
for feature_name in self[feature_type]:
600-
feature_list.append((feature_type, feature_name))
601-
return feature_list
600+
return [
601+
(feature_type, feature_name)
602+
for feature_type in (ftype for ftype in FeatureType if ftype not in removed_ftypes)
603+
for feature_name in self[feature_type]
604+
]
602605

603606
def save(
604607
self,
@@ -620,7 +623,7 @@ def save(
620623
:param overwrite_permission: A level of permission for overwriting an existing EOPatch
621624
:param filesystem: An existing filesystem object. If not given it will be initialized according to the `path`
622625
parameter.
623-
:save_timestamps: Whether to save the timestamps of the EOPatch. With the `"auto"` setting timestamps are saved
626+
:save_timestamps: Save the timestamps of the EOPatch. With the `"auto"` setting timestamps are saved
624627
if `features=...` or if other temporal features are being saved.
625628
:param use_zarr: Saves numpy-array based features into Zarr files. Requires ZARR extra dependencies.
626629
:param temporal_selection: Writes all of the data to the chosen temporal indices of preexisting arrays. Can be
@@ -666,7 +669,7 @@ def load(
666669
:param lazy_loading: If `True` features will be lazy loaded.
667670
:param filesystem: An existing filesystem object. If not given it will be initialized according to the `path`
668671
parameter.
669-
:load_timestamps: Whether to load the timestamps of the EOPatch. With the `"auto"` setting timestamps are loaded
672+
:load_timestamps: Load the timestamps of the EOPatch. With the `"auto"` setting timestamps are loaded
670673
if `features=...` or if other temporal features are being loaded.
671674
:param temporal_selection: Only loads data corresponding to the chosen indices. Can also be a callable that,
672675
given a list of timestamps, returns a list of booleans declaring which temporal slices to load.
@@ -688,7 +691,10 @@ def load(
688691
_trigger_loading_for_eopatch_features(eopatch)
689692
return eopatch
690693

691-
@deprecated_function(EODeprecationWarning, "Use the function `eolearn.core.merge_eopatches` instead.")
694+
@deprecated(
695+
"The EOPatch method `merge` has been deprecated. Use the function `eolearn.core.merge_eopatches` instead.",
696+
category=EODeprecationWarning,
697+
)
692698
def merge(
693699
self,
694700
*eopatches: EOPatch,
@@ -727,7 +733,10 @@ def merge(
727733
self, *eopatches, features=features, time_dependent_op=time_dependent_op, timeless_op=timeless_op
728734
)
729735

730-
@deprecated_function(EODeprecationWarning, "Please use the method `temporal_subset` instead.")
736+
@deprecated(
737+
"The method `consolidate_timestamps` has been deprecated. Use the method `temporal_subset` instead.",
738+
category=EODeprecationWarning,
739+
)
731740
def consolidate_timestamps(self, timestamps: list[dt.datetime]) -> set[dt.datetime]:
732741
"""Removes all frames from the EOPatch with a date not found in the provided timestamps list.
733742

0 commit comments

Comments
 (0)