Skip to content

Commit 2fbc1d0

Browse files
authored
Merge pull request #336 from sentinel-hub/develop
Release version 3.8.0
2 parents 01aa7e0 + 1119340 commit 2fbc1d0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+1766
-637
lines changed

.flake8

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[flake8]
2-
ignore = E203, W503
2+
ignore = E203, W503, C408
33
exclude = .git, __pycache__
4+
min_python_version = 3.7.0
45
max-line-length= 120
56
max-complexity = 13
67
per-file-ignores =

.github/workflows/ci_action.yml

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
name: build
22

33
on:
4+
pull_request:
45
push:
6+
branches:
7+
- "master"
8+
- "develop"
59
schedule:
6-
- cron: '0 0 * * *'
10+
- cron: "0 0 * * *"
711

812
env:
913
# The only way to simulate if-else statement
10-
CHECKOUT_BRANCH: ${{ github.event_name == 'push' && github.ref || 'develop' }}
14+
CHECKOUT_BRANCH: ${{ github.event_name == 'schedule' && 'develop' || github.ref }}
1115

1216
jobs:
13-
14-
check-code-black-isort-flake8:
17+
check-pre-commit-hooks:
1518
runs-on: ubuntu-latest
1619
steps:
1720
- name: Checkout branch
@@ -25,21 +28,13 @@ jobs:
2528
python-version: "3.8"
2629
architecture: x64
2730

28-
- name: Prepare linters
29-
run: pip install black[jupyter] isort flake8 nbqa
30-
31-
- name: Check code compliance with black
32-
run: black . --check --diff
33-
34-
- name: Check code compliance with isort
31+
- name: Prepare pre-commit validators
3532
run: |
36-
isort . --check --diff
37-
nbqa isort . --nbqa-diff
33+
pip install pre-commit
34+
pre-commit install
3835
39-
- name: Check code compliance with flake8
40-
run: |
41-
flake8 .
42-
nbqa flake8 .
36+
- name: Check code compliance with pre-commit validators
37+
run: pre-commit run --all-files
4338

4439
check-code-pylint-and-mypy:
4540
runs-on: ubuntu-latest
@@ -54,10 +49,10 @@ jobs:
5449
with:
5550
python-version: "3.8"
5651
architecture: x64
57-
52+
5853
- name: Install packages
5954
run: pip install -e .[AWS,DEV]
60-
55+
6156
- name: Run mypy
6257
run: mypy sentinelhub setup.py
6358

@@ -69,10 +64,14 @@ jobs:
6964
strategy:
7065
matrix:
7166
python-version:
72-
- '3.7'
73-
- '3.8'
74-
- '3.9'
75-
- '3.10'
67+
- "3.7"
68+
- "3.9"
69+
- "3.10"
70+
include:
71+
# A flag marks whether full or partial tests should be run
72+
# We don't run integration tests on pull requests from outside repos, because they don't have secrets
73+
- python-version: "3.8"
74+
full_test_suite: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }}
7675
steps:
7776
- name: Checkout branch
7877
uses: actions/checkout@v2
@@ -92,7 +91,7 @@ jobs:
9291
pip install -e .[AWS,DEV]
9392
9493
- name: Run full tests and code coverage
95-
if: matrix.python-version == '3.8'
94+
if: ${{ matrix.full_test_suite }}
9695
run: |
9796
sentinelhub.config \
9897
--sh_client_id "${{ secrets.SH_CLIENT_ID }}" \
@@ -103,12 +102,12 @@ jobs:
103102
pytest --cov --cov-report=term --cov-report=xml
104103
105104
- name: Run pylint and reduced tests
106-
if: matrix.python-version != '3.8'
105+
if: ${{ !matrix.full_test_suite }}
107106
run: |
108107
pytest -m "not sh_integration and not aws_integration"
109108
110109
- name: Upload code coverage
111-
if: matrix.python-version == '3.8'
110+
if: ${{ matrix.full_test_suite }}
112111
uses: codecov/codecov-action@v2
113112
with:
114113
files: coverage.xml

.pre-commit-config.yaml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.3.0
4+
hooks:
5+
- id: end-of-file-fixer
6+
- id: requirements-txt-fixer
7+
- id: trailing-whitespace
8+
- id: debug-statements
9+
- id: check-json
10+
- id: check-toml
11+
- id: check-yaml
12+
- id: check-merge-conflict
13+
- id: debug-statements
14+
15+
- repo: https://github.com/psf/black
16+
rev: 22.8.0
17+
hooks:
18+
- id: black
19+
language_version: python3
20+
21+
- repo: https://github.com/pycqa/isort
22+
rev: 5.10.1
23+
hooks:
24+
- id: isort
25+
name: isort (python)
26+
27+
- repo: https://github.com/PyCQA/autoflake
28+
rev: v1.5.3
29+
hooks:
30+
- id: autoflake
31+
args:
32+
[
33+
--remove-all-unused-imports,
34+
--in-place,
35+
--ignore-init-module-imports,
36+
]
37+
38+
- repo: https://github.com/pycqa/flake8
39+
rev: 5.0.4
40+
hooks:
41+
- id: flake8
42+
additional_dependencies:
43+
- flake8-bugbear
44+
- flake8-comprehensions
45+
- flake8-simplify
46+
- flake8-typing-imports
47+
48+
- repo: https://github.com/nbQA-dev/nbQA
49+
rev: 1.4.0
50+
hooks:
51+
- id: nbqa-black
52+
- id: nbqa-isort
53+
- id: nbqa-flake8

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ $ pip install sentinelhub[AWS] # extra dependencies for interacting with Amazon
3535
Alternatively, the package can be installed with Conda from `conda-forge` channel
3636

3737
```
38-
$ conda install -c conda-forge sentinelhub
38+
$ conda install -c conda-forge sentinelhub
3939
```
4040

4141
To install the package manually, clone the repository and run

docs/source/_templates/module.rst_t

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,3 @@
66
{%- for option in automodule_options %}
77
:{{ option }}:
88
{%- endfor %}
9-

docs/source/conf.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
# add these directories to sys.path here. If the directory is relative to the
1313
# documentation root, use os.path.abspath to make it absolute, like shown here.
1414
#
15+
import contextlib
1516
import os
1617
import shutil
1718
import sys
@@ -31,10 +32,11 @@
3132
# built documents.
3233
#
3334
# The release is read from __init__ file and version is shortened release string.
34-
for line in open(os.path.join(os.path.dirname(__file__), "../../sentinelhub/_version.py")):
35-
if line.find("__version__") >= 0:
36-
release = line.split("=")[1].strip()
37-
release = release.strip('"').strip("'")
35+
with open(os.path.join(os.path.dirname(__file__), "../../sentinelhub/_version.py")) as version_file:
36+
for line in version_file:
37+
if line.find("__version__") >= 0:
38+
release = line.split("=")[1].strip()
39+
release = release.strip('"').strip("'")
3840
version = release.rsplit(".", 1)[0]
3941

4042
# -- General configuration ------------------------------------------------
@@ -217,10 +219,8 @@
217219
intersphinx_mapping = {"https://docs.python.org/3.8/": None}
218220

219221
# copy examples
220-
try:
222+
with contextlib.suppress(FileExistsError):
221223
shutil.copytree("../../examples", "./examples")
222-
except FileExistsError:
223-
pass
224224

225225

226226
MARKDOWNS_FOLDER = "./markdowns"

docs/source/install.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ Unofficial Windows wheels repository (link_).
2727

2828

2929
.. _Github: https://github.com/sentinel-hub/sentinelhub-py
30-
.. _link: https://www.lfd.uci.edu/~gohlke/pythonlibs/
30+
.. _link: https://www.lfd.uci.edu/~gohlke/pythonlibs/

docs/source/tutorials.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ Advanced tutorials
55
:maxdepth: 4
66

77
examples/session_sharing.ipynb
8+
examples/reading_pu_from_headers.ipynb

examples/batch_statistical.ipynb

Lines changed: 444 additions & 154 deletions
Large diffs are not rendered by default.

examples/data/session_sharing.drawio

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<mxfile host="app.diagrams.net" modified="2022-05-26T08:32:02.837Z" agent="5.0 (X11)" etag="XQO7OtGNrSaXBRrq08GQ" version="17.4.4" type="device"><diagram id="DOaRbYYg76pwdXUd3fTu" name="Page-1">7VrJcuIwEP0ajpPyglmOA2SZQ6pSxSHJUbEVWxXbcmQBZr5+WljyKgLMmJAwnFC31VpeP9rqlnv2NMpuGUqCe+rhsGcZXtazZz3LMk3HgR+hWeea4djOFT4jnuxUKubkN5ZKQ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fBEV7Btpo7gGxJvPny4W7wIDmEgy+Y2hjLhKvqG470uZNIAJaIZ4Az5MIA9SSonH6ktDkPW7mTplWRYfVXRWfLk1F2rPFK9P9fd5NiHJ08glh9I5C4tPzOxr/8A</diagram></mxfile>

examples/data/statapi_evalscript.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ function evaluatePixel(samples) {
3434
let NDVI = index(samples.B08, samples.B04);
3535
let NDVI_RE1 = index(samples.B08, samples.B05);
3636

37-
// Bare Soil Index
37+
// Bare Soil Index
3838
let NBSI = index((samples.B11 + samples.B04), (samples.B08 + samples.B02));
39-
39+
4040
// cloud probability normalized to interval [0, 1]
4141
let CLP = samples.CLP / 255.0;
4242

@@ -48,7 +48,7 @@ function evaluatePixel(samples) {
4848

4949
const f = 5000;
5050
return {
51-
bands: [samples.B01, samples.B02, samples.B03, samples.B04, samples.B05, samples.B06,
51+
bands: [samples.B01, samples.B02, samples.B03, samples.B04, samples.B05, samples.B06,
5252
samples.B07, samples.B08, samples.B8A, samples.B09, samples.B11, samples.B12],
5353
masks: [samples.CLM],
5454
indices: [toUINT(NDVI, f), toUINT(NDVI_RE1, f), toUINT(NBSI, f), toUINT(CLP, f)],

0 commit comments

Comments
 (0)