Skip to content

Commit

Permalink
Merge pull request #336 from sentinel-hub/develop
Browse files Browse the repository at this point in the history
Release version 3.8.0
  • Loading branch information
zigaLuksic authored Oct 6, 2022
2 parents 01aa7e0 + 1119340 commit 2fbc1d0
Show file tree
Hide file tree
Showing 65 changed files with 1,766 additions and 637 deletions.
3 changes: 2 additions & 1 deletion .flake8
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[flake8]
ignore = E203, W503
ignore = E203, W503, C408
exclude = .git, __pycache__
min_python_version = 3.7.0
max-line-length= 120
max-complexity = 13
per-file-ignores =
Expand Down
51 changes: 25 additions & 26 deletions .github/workflows/ci_action.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
name: build

on:
pull_request:
push:
branches:
- "master"
- "develop"
schedule:
- cron: '0 0 * * *'
- cron: "0 0 * * *"

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

jobs:

check-code-black-isort-flake8:
check-pre-commit-hooks:
runs-on: ubuntu-latest
steps:
- name: Checkout branch
Expand All @@ -25,21 +28,13 @@ jobs:
python-version: "3.8"
architecture: x64

- name: Prepare linters
run: pip install black[jupyter] isort flake8 nbqa

- name: Check code compliance with black
run: black . --check --diff

- name: Check code compliance with isort
- name: Prepare pre-commit validators
run: |
isort . --check --diff
nbqa isort . --nbqa-diff
pip install pre-commit
pre-commit install
- name: Check code compliance with flake8
run: |
flake8 .
nbqa flake8 .
- name: Check code compliance with pre-commit validators
run: pre-commit run --all-files

check-code-pylint-and-mypy:
runs-on: ubuntu-latest
Expand All @@ -54,10 +49,10 @@ jobs:
with:
python-version: "3.8"
architecture: x64

- name: Install packages
run: pip install -e .[AWS,DEV]

- name: Run mypy
run: mypy sentinelhub setup.py

Expand All @@ -69,10 +64,14 @@ jobs:
strategy:
matrix:
python-version:
- '3.7'
- '3.8'
- '3.9'
- '3.10'
- "3.7"
- "3.9"
- "3.10"
include:
# A flag marks whether full or partial tests should be run
# We don't run integration tests on pull requests from outside repos, because they don't have secrets
- python-version: "3.8"
full_test_suite: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }}
steps:
- name: Checkout branch
uses: actions/checkout@v2
Expand All @@ -92,7 +91,7 @@ jobs:
pip install -e .[AWS,DEV]
- name: Run full tests and code coverage
if: matrix.python-version == '3.8'
if: ${{ matrix.full_test_suite }}
run: |
sentinelhub.config \
--sh_client_id "${{ secrets.SH_CLIENT_ID }}" \
Expand All @@ -103,12 +102,12 @@ jobs:
pytest --cov --cov-report=term --cov-report=xml
- name: Run pylint and reduced tests
if: matrix.python-version != '3.8'
if: ${{ !matrix.full_test_suite }}
run: |
pytest -m "not sh_integration and not aws_integration"
- name: Upload code coverage
if: matrix.python-version == '3.8'
if: ${{ matrix.full_test_suite }}
uses: codecov/codecov-action@v2
with:
files: coverage.xml
Expand Down
53 changes: 53 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
- id: end-of-file-fixer
- id: requirements-txt-fixer
- id: trailing-whitespace
- id: debug-statements
- id: check-json
- id: check-toml
- id: check-yaml
- id: check-merge-conflict
- id: debug-statements

- repo: https://github.com/psf/black
rev: 22.8.0
hooks:
- id: black
language_version: python3

- repo: https://github.com/pycqa/isort
rev: 5.10.1
hooks:
- id: isort
name: isort (python)

- repo: https://github.com/PyCQA/autoflake
rev: v1.5.3
hooks:
- id: autoflake
args:
[
--remove-all-unused-imports,
--in-place,
--ignore-init-module-imports,
]

- repo: https://github.com/pycqa/flake8
rev: 5.0.4
hooks:
- id: flake8
additional_dependencies:
- flake8-bugbear
- flake8-comprehensions
- flake8-simplify
- flake8-typing-imports

- repo: https://github.com/nbQA-dev/nbQA
rev: 1.4.0
hooks:
- id: nbqa-black
- id: nbqa-isort
- id: nbqa-flake8
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ $ pip install sentinelhub[AWS] # extra dependencies for interacting with Amazon
Alternatively, the package can be installed with Conda from `conda-forge` channel

```
$ conda install -c conda-forge sentinelhub
$ conda install -c conda-forge sentinelhub
```

To install the package manually, clone the repository and run
Expand Down
1 change: 0 additions & 1 deletion docs/source/_templates/module.rst_t
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,3 @@
{%- for option in automodule_options %}
:{{ option }}:
{%- endfor %}

14 changes: 7 additions & 7 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import contextlib
import os
import shutil
import sys
Expand All @@ -31,10 +32,11 @@
# built documents.
#
# The release is read from __init__ file and version is shortened release string.
for line in open(os.path.join(os.path.dirname(__file__), "../../sentinelhub/_version.py")):
if line.find("__version__") >= 0:
release = line.split("=")[1].strip()
release = release.strip('"').strip("'")
with open(os.path.join(os.path.dirname(__file__), "../../sentinelhub/_version.py")) as version_file:
for line in version_file:
if line.find("__version__") >= 0:
release = line.split("=")[1].strip()
release = release.strip('"').strip("'")
version = release.rsplit(".", 1)[0]

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

# copy examples
try:
with contextlib.suppress(FileExistsError):
shutil.copytree("../../examples", "./examples")
except FileExistsError:
pass


MARKDOWNS_FOLDER = "./markdowns"
Expand Down
2 changes: 1 addition & 1 deletion docs/source/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ Unofficial Windows wheels repository (link_).


.. _Github: https://github.com/sentinel-hub/sentinelhub-py
.. _link: https://www.lfd.uci.edu/~gohlke/pythonlibs/
.. _link: https://www.lfd.uci.edu/~gohlke/pythonlibs/
1 change: 1 addition & 0 deletions docs/source/tutorials.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ Advanced tutorials
:maxdepth: 4

examples/session_sharing.ipynb
examples/reading_pu_from_headers.ipynb
598 changes: 444 additions & 154 deletions examples/batch_statistical.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion examples/data/session_sharing.drawio
Original file line number Diff line number Diff line change
@@ -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+hWeea4djOFT4jnuxUKubkN5ZKQ2oXxMNprSOnNOQkqStdGsfY5TUdYoyu6t1eaVifNUE+binmLgrb2kfi8SDXjhyj1N9h4gdqZtOQTyKkOktFGiCPrioq+7pnTxmlPG9F2RSHAjyFS253s+VpsTCGY76PweB9lN3e/FpapP/4/j6ho/Hs/occZYnChdxwzxqEMN7EI0to+qKpVC9KcY9IDFYPax5Q0UgYdXGaqn6whpemLehqI24Q4WsFMywVPArCZBUQjucJcsWTFZAKdAGPQpDMwnKJGcfZViDMAl7gJaYR5mwNXaRBXzpkrZgm5VXpX1M5Laj4diR1SFLKL0YuUYeGBP4AJ1hbnVDA+EjZG2Z7Y35SdJvwttAda8AdHAtc+5zBHZ0Y3P45g2s6J0bXOWd0i/fiqdAdaNBt4hN7P8UZAiQ3RGlK3DosjC5iD4tJDJBwRviTfCLaz0J/5UhpllW6zdZKiGErT1WhYiXE0mwjKbt8qdhrHV4a7oDt0AVz8e4jAEfMx/yDfpbevRX3ORr3KR3DIeJkWV+uzqdyhgdKYCNb2dPvN2iRb1NaVU9BzYGc+kD2uDFQjkNroA3Fim3/PeuGF9YdxLr+hXUdsG50Yd1BrLMvrOuAdeML6w5inXNhXQesUwnngTWNeQCe9cAuwhEVQMnnTFPJ2Fnd2D3d/z1+IwrU/+XHz0XMZi4yaOcilqH5rw2PlYyYuhpQJ7GyjI/Plci5K1ZeWUV8fK6FR32w9FAabGYuHfSpkdM09P7+ZqHTbJQmiwV+VujUFcv+iYU1YpSUHBqD6iv8Y1KC8IAZgc1h9oVe6sae3LzkzZ1QU1dq7JCaRyfU1845mpcirbLbt+GJrmh6Vjw5aUXkfHjSefn3q/HkpNnk+fBEV7Btpo7gGxJvPny4W7wIDmEgy+Y2hjLhKvqG470uZNIAJaIZ4Az5MIA9SSonH6ktDkPW7mTplWRYfVXRWfLk1F2rPFK9P9fd5NiHJ08glh9I5C4tPzOxr/8A</diagram></mxfile>
<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+hWeea4djOFT4jnuxUKubkN5ZKQ2oXxMNprSOnNOQkqStdGsfY5TUdYoyu6t1eaVifNUE+binmLgrb2kfi8SDXjhyj1N9h4gdqZtOQTyKkOktFGiCPrioq+7pnTxmlPG9F2RSHAjyFS253s+VpsTCGY76PweB9lN3e/FpapP/4/j6ho/Hs/occZYnChdxwzxqEMN7EI0to+qKpVC9KcY9IDFYPax5Q0UgYdXGaqn6whpemLehqI24Q4WsFMywVPArCZBUQjucJcsWTFZAKdAGPQpDMwnKJGcfZViDMAl7gJaYR5mwNXaRBXzpkrZgm5VXpX1M5Laj4diR1SFLKL0YuUYeGBP4AJ1hbnVDA+EjZG2Z7Y35SdJvwttAda8AdHAtc+5zBHZ0Y3P45g2s6J0bXOWd0i/fiqdAdaNBt4hN7P8UZAiQ3RGlK3DosjC5iD4tJDJBwRviTfCLaz0J/5UhpllW6zdZKiGErT1WhYiXE0mwjKbt8qdhrHV4a7oDt0AVz8e4jAEfMx/yDfpbevRX3ORr3KR3DIeJkWV+uzqdyhgdKYCNb2dPvN2iRb1NaVU9BzYGc+kD2uDFQjkNroA3Fim3/PeuGF9YdxLr+hXUdsG50Yd1BrLMvrOuAdeML6w5inXNhXQesUwnngTWNeQCe9cAuwhEVQMnnTFPJ2Fnd2D3d/z1+IwrU/+XHz0XMZi4yaOcilqH5rw2PlYyYuhpQJ7GyjI/Plci5K1ZeWUV8fK6FR32w9FAabGYuHfSpkdM09P7+ZqHTbJQmiwV+VujUFcv+iYU1YpSUHBqD6iv8Y1KC8IAZgc1h9oVe6sae3LzkzZ1QU1dq7JCaRyfU1845mpcirbLbt+GJrmh6Vjw5aUXkfHjSefn3q/HkpNnk+fBEV7Btpo7gGxJvPny4W7wIDmEgy+Y2hjLhKvqG470uZNIAJaIZ4Az5MIA9SSonH6ktDkPW7mTplWRYfVXRWfLk1F2rPFK9P9fd5NiHJ08glh9I5C4tPzOxr/8A</diagram></mxfile>
6 changes: 3 additions & 3 deletions examples/data/statapi_evalscript.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ function evaluatePixel(samples) {
let NDVI = index(samples.B08, samples.B04);
let NDVI_RE1 = index(samples.B08, samples.B05);

// Bare Soil Index
// Bare Soil Index
let NBSI = index((samples.B11 + samples.B04), (samples.B08 + samples.B02));

// cloud probability normalized to interval [0, 1]
let CLP = samples.CLP / 255.0;

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

const f = 5000;
return {
bands: [samples.B01, samples.B02, samples.B03, samples.B04, samples.B05, samples.B06,
bands: [samples.B01, samples.B02, samples.B03, samples.B04, samples.B05, samples.B06,
samples.B07, samples.B08, samples.B8A, samples.B09, samples.B11, samples.B12],
masks: [samples.CLM],
indices: [toUINT(NDVI, f), toUINT(NDVI_RE1, f), toUINT(NBSI, f), toUINT(CLP, f)],
Expand Down
Loading

0 comments on commit 2fbc1d0

Please sign in to comment.