Skip to content

Commit

Permalink
Merge branch 'master' into issue437_better-documentation-of-crs-code-…
Browse files Browse the repository at this point in the history
…usage
  • Loading branch information
JohanKJSchreurs committed Sep 4, 2023
2 parents 2c9a133 + fd6d9f6 commit 401bbfc
Show file tree
Hide file tree
Showing 90 changed files with 1,060 additions and 622 deletions.
4 changes: 4 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,7 @@ cfd2e0d1cb3c270222cd4d2e4b0688da50087494
# pre-commit end-of-file-fixer and trailing-whitespace
d7ccd7b57aab823867415a9e75913d14e440ae25
c4759f2025cf777f761cb508a64e01c5c3ea3e72

# Import cleanups using isort
9ae624cb536c9aeda35c5e389f5d87e353c22726
f50c2e18583619f1c67de6c803cd65c0ac2d2f5e
9 changes: 8 additions & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@

name: Lint
on: [push, pull_request]
on:
push:
paths:
- '**.py'
pull_request:
paths:
- '**.py'
concurrency: ci-${{ github.ref }}
jobs:
build:
runs-on: ubuntu-latest
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/sphinx2ghpages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ name: Sphinx Documentation to GitHub Pages
on:
push:
branches: [ master ]
paths:
- 'docs/**'
- 'openeo/**'

concurrency:
group: docs-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
Expand Down
17 changes: 14 additions & 3 deletions .github/workflows/unittests.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@

name: Unit tests
on: [push, pull_request]
on:
push:
paths:
- 'setup.py'
- 'pyproject.toml'
- 'openeo/**'
- 'tests/**'
pull_request:
paths:
- 'setup.py'
- 'pyproject.toml'
- 'openeo/**'
- 'tests/**'
concurrency: ci-${{ github.ref }}
jobs:
build:
strategy:
Expand All @@ -15,8 +28,6 @@ jobs:
- "3.11"
# Additional special cases (see https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-adding-configurations)
include:
- os: "ubuntu-20.04"
python-version: "3.6"
- os: "windows-latest"
python-version: "3.11"
runs-on: ${{ matrix.os }}
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Removed

- Bumped minimal supported Python version to 3.7 ([#460](https://github.com/Open-EO/openeo-python-client/issues/460))

### Fixed


Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ examples and in-depth discussion.

## Installation

Python 3.6 or higher is required.
Python 3.7 or higher is required.
As always, it is recommended to work in some kind of virtual environment
(using `venv`, `virtualenv`, conda, docker, ...)
to install the `openeo` package and its dependencies:
Expand Down
2 changes: 1 addition & 1 deletion docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ openeo.util
-------------

.. automodule:: openeo.util
:members: to_bbox_dict, BBoxDict, load_json_resource, normalize_crs
:members: to_bbox_dict, BBoxDict, load_json_resource, normalize_crs, string_to_temporal_extent


openeo.processes
Expand Down
2 changes: 1 addition & 1 deletion docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ The package is a pure Python implementation and its dependencies are carefully c
Basic install
=============

At least *Python 3.6* is recommended.
At least *Python 3.7* is required (since version 0.23.0).
Also, it is recommended to work in a some kind of *virtual environment* (``venv``, ``conda``, ...)
to avoid polluting the base install of Python on your operating system
or introducing conflicts with other applications.
Expand Down
3 changes: 1 addition & 2 deletions docs/process_mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@
"""
import datetime
import importlib
import sys
from textwrap import dedent
import importlib

from openeo.internal.documentation import _process_registry


# TODO: automate running of this tool. E.g. use https://nedbatchelder.com/code/cog
# TODO: support operators properly (use `+` in docs instead of `__add__`)

Expand Down
4 changes: 2 additions & 2 deletions examples/R_example.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import openeo
import logging
from openeo.auth.auth_bearer import BearerAuth
import time

import openeo
from openeo.auth.auth_bearer import BearerAuth

logging.basicConfig(level=logging.INFO)

Expand Down
3 changes: 2 additions & 1 deletion examples/eodc_example.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import logging

import openeo
from openeo.rest.job import RESTJob
from openeo.auth.auth_bearer import BearerAuth
from openeo.rest.job import RESTJob

logging.basicConfig(level=logging.DEBUG)

Expand Down
3 changes: 2 additions & 1 deletion examples/gee_example.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import logging

import openeo
from openeo.internal.graph_building import PGNode
import logging

logging.basicConfig(level=logging.INFO)

Expand Down
3 changes: 2 additions & 1 deletion examples/gee_uc1_temp.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import openeo
import logging

import openeo

logging.basicConfig(level=logging.INFO)

GEE_DRIVER_URL = "https://earthengine.openeo.org/v1.0"
Expand Down
3 changes: 2 additions & 1 deletion examples/mundialis_example.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#!/usr/bin/env python3

import logging
import openeo
import time

import openeo

logging.basicConfig(level=logging.INFO)

backend_url = 'https://openeo.mundialis.de'
Expand Down
2 changes: 1 addition & 1 deletion examples/mundialis_extended.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/usr/bin/env python3
import json
import logging
import sys
from datetime import datetime

import openeo
import sys

logger = logging.getLogger(__name__)

Expand Down
1 change: 1 addition & 0 deletions examples/mundialis_mini.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env python3

import json

import openeo

backend_url = 'https://openeo.mundialis.de'
Expand Down
5 changes: 4 additions & 1 deletion examples/ndvi_composite.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import os
from pathlib import Path

import openeo
from skimage.morphology import selem

import openeo

connection = openeo.connect("https://openeo-dev.vito.be")
bbox = {"west": 4.996033, "south": 51.258922, "east": 5.091603, "north": 51.282696}
connection.authenticate_basic()
Expand Down Expand Up @@ -75,6 +76,7 @@ def test_composite_by_udf():

from openeo.rest.datacube import DataCube


def test_debug_udf():
"""
Shows how to run your UDF locally for testing. This method uses the same code as the backend, and can be used to check validity of your UDF.
Expand All @@ -86,6 +88,7 @@ def test_debug_udf():

from examples.udf.median_composite import apply_datacube


def test_debug_udf_direct_invoke():
"""
Shows how to run your UDF locally for testing, by invoking the function directly, breakpoints work.
Expand Down
7 changes: 4 additions & 3 deletions examples/phenology_example.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
from shapely.geometry import Polygon

import openeo
import logging
import os
from pathlib import Path

import pandas as pd
from shapely.geometry import Polygon

import openeo

#enable logging in requests library
logging.basicConfig(level=logging.DEBUG)
Expand Down
6 changes: 3 additions & 3 deletions examples/profiling_example.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
from pathlib import Path
import openeo
import pstats
import tarfile
import tempfile
import pstats
from pathlib import Path

import openeo

if __name__ == '__main__':

Expand Down
2 changes: 1 addition & 1 deletion examples/py3_process_wrapper-wcps_eurac.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/usr/bin/env python3
import json
import logging
import sys
from datetime import datetime

import openeo
import sys

logger = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion examples/udf/median_composite.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import xarray
import numpy as np
import xarray

from openeo.udf import XarrayDataCube

Expand Down
5 changes: 3 additions & 2 deletions examples/vito_example.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import openeo
import logging
import json
import logging

import openeo

logging.basicConfig(level=logging.INFO)

Expand Down
5 changes: 2 additions & 3 deletions openeo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ class BaseOpenEoException(Exception):


from openeo._version import __version__

from openeo.rest.datacube import DataCube, UDF
from openeo.rest.connection import connect, session, Connection
from openeo.rest.connection import Connection, connect, session
from openeo.rest.datacube import UDF, DataCube
from openeo.rest.job import BatchJob, RESTJob


Expand Down
16 changes: 9 additions & 7 deletions openeo/api/process.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import warnings
from typing import Union

Expand Down Expand Up @@ -35,7 +37,7 @@ def to_dict(self) -> dict:
return d

@classmethod
def raster_cube(cls, name: str = "data", description: str = "A data cube.") -> 'Parameter':
def raster_cube(cls, name: str = "data", description: str = "A data cube.") -> Parameter:
"""
Helper to easily create a 'raster-cube' parameter.
Expand All @@ -46,7 +48,7 @@ def raster_cube(cls, name: str = "data", description: str = "A data cube.") -> '
return cls(name=name, description=description, schema={"type": "object", "subtype": "raster-cube"})

@classmethod
def datacube(cls, name: str = "data", description: str = "A data cube.") -> "Parameter":
def datacube(cls, name: str = "data", description: str = "A data cube.") -> Parameter:
"""
Helper to easily create a 'datacube' parameter.
Expand All @@ -59,7 +61,7 @@ def datacube(cls, name: str = "data", description: str = "A data cube.") -> "Par
return cls(name=name, description=description, schema={"type": "object", "subtype": "datacube"})

@classmethod
def string(cls, name: str, description: str = None, default=_DEFAULT_UNDEFINED, values=None) -> 'Parameter':
def string(cls, name: str, description: str = None, default=_DEFAULT_UNDEFINED, values=None) -> Parameter:
"""Helper to create a 'string' type parameter."""
schema = {"type": "string"}
if values is not None:
Expand All @@ -68,21 +70,21 @@ def string(cls, name: str, description: str = None, default=_DEFAULT_UNDEFINED,


@classmethod
def integer(cls, name: str, description: str = None, default=_DEFAULT_UNDEFINED) -> 'Parameter':
def integer(cls, name: str, description: str = None, default=_DEFAULT_UNDEFINED) -> Parameter:
"""Helper to create a 'integer' type parameter."""
return cls(name=name, description=description, schema={"type": "integer"}, default=default)

@classmethod
def number(cls, name: str, description: str = None, default=_DEFAULT_UNDEFINED) -> 'Parameter':
def number(cls, name: str, description: str = None, default=_DEFAULT_UNDEFINED) -> Parameter:
"""Helper to create a 'number' type parameter."""
return cls(name=name, description=description, schema={"type": "number"}, default=default)

@classmethod
def boolean(cls, name: str, description: str = None, default=_DEFAULT_UNDEFINED) -> 'Parameter':
def boolean(cls, name: str, description: str = None, default=_DEFAULT_UNDEFINED) -> Parameter:
"""Helper to create a 'boolean' type parameter."""
return cls(name=name, description=description, schema={"type": "boolean"}, default=default)

@classmethod
def array(cls, name: str, description: str = None, default=_DEFAULT_UNDEFINED) -> 'Parameter':
def array(cls, name: str, description: str = None, default=_DEFAULT_UNDEFINED) -> Parameter:
"""Helper to create a 'array' type parameter."""
return cls(name=name, description=description, schema={"type": "array"}, default=default)
9 changes: 5 additions & 4 deletions openeo/capabilities.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from __future__ import annotations

import contextlib
from abc import ABC
import re
from typing import Union, Tuple

from abc import ABC
from typing import Tuple, Union

# TODO Is this base class (still) useful?

Expand All @@ -24,7 +25,7 @@ def api_version(self) -> str:
raise NotImplementedError

@property
def api_version_check(self) -> 'ComparableVersion':
def api_version_check(self) -> ComparableVersion:
"""Helper to easily check if the API version is at least or below some threshold version."""
api_version = self.api_version()
if not api_version:
Expand Down
Loading

0 comments on commit 401bbfc

Please sign in to comment.