Skip to main content

Geo Engine Python Package

CI Coverage Status Documentation

This package allows easy access to Geo Engine functionality from Python environments.

Test

Create a virtual environment

Create a virtual environment (e.g., python3 -m venv env).

# create new venv
python3 -m venv env
# activate new venv
source env/bin/activate

Re-create virtual environment

# go out of old venv
deactivate
# delete old venv
rm -r .venv
# create new venv
python3 -m venv .venv
# activate new venv
source .venv/bin/activate

Install dependencies

Then, install the dependencies with:

python3 -m pip install -e .
python3 -m pip install -e .[test]

Run tests

Run tests with:

pytest

Test instance

You have to set the environment variable GEOENGINE_TEST_CODE_PATH to the code folder of the Geo Engine instance you want to test against. Dotenv is supported, so you can create a .env file in the root of the project.

Coverage

You can check the coverage with:

pytest --cov=geoengine

Test examples

You can test the examples with:

python3 -m pip install -e .[examples]
./test_all_notebooks.py

Or you can test a single example with:

./test_notebook.py examples/ndvi_ports.ipynb

Dependencies

Since we use cartopy, you need to have the following system dependencies installed.

  • GEOS
  • PROJ

For Ubuntu, you can use this command:

sudo apt-get install libgeos-dev libproj-dev

Build

You can build the package with:

python3 -m pip install -e .[dev]
python3 -m build

Formatting

This package is formatted according to ruff. You can check it by calling:

python3 -m ruff format --check

Our tip is to install ruff and use it to format the code.

VSCode

If you use VSCode, you can install the ruff extension and set it as the default formatter.

Lints

Our CI automatically checks for lint errors. We use ruff to check the code. You can check it by calling:

python3 -m ruff check

Our tip is to activate linting with ruff in your IDE.

Type Checking

Our CI automatically checks for typing errors. We use mypy to check the code. You can check it by calling:

python3 -m mypy geoengine
python3 -m mypy tests

Using the config file mypy.ini, you can suppress missing stub errors for external libraries. You can ignore a library by adding two lines to the config file. For example, suppressing matplotlib would look like this:

[mypy-matplotlib.*]
ignore_missing_imports = True

If there are typing-stubs packages you can install using pip, you can use these packages instead of ignoring the reported errors. To find out, which packages could be installed you can use the following command:

python3 -m mypy geoengine --install-types
python3 -m mypy tests --install-types

Keep in mind, that you need to add the missing stubs by extending the dependencies in setup.cfg or ignoring them with mypy.ini.

Our tip is to activate type checking with mypy in your IDE.

All checks from above

You can call ./check.sh to run all the checks that are shown above.

Documentation

Generate documentation HTML with:

pdoc3 --html --output-dir docs geoengine

Examples

There are several examples in the examples folder. It is necessary to install the dependencies with:

python3 -m pip install -e .[examples]

Distribute to PyPI

Test-PyPI

python3 -m build
python3 -m twine upload --repository testpypi dist/*

PyPI

python3 -m build
python3 -m twine upload --repository pypi dist/*

Try it out

Start a python terminal and try it out:

import geoengine as ge
from datetime import datetime

ge.initialize("https://nightly.peter.geoengine.io/api")

time = datetime.strptime('2014-04-01T12:00:00.000Z', "%Y-%m-%dT%H:%M:%S.%f%z")

processing_graph = ge.processing_graph_by_id('4cdf1ffe-cb67-5de2-a1f3-3357ae0112bd')

print(processing_graph.get_result_descriptor())

processing_graph.get_dataframe(ge.Bbox([-60.0, 5.0, 61.0, 6.0], [time, time]))

Authentication

If the Geo Engine server requires authentication, you can set your credentials in the following ways:

  1. in the initialize method: ge.initialize("https://nightly.peter.geoengine.io/api", ("email", "password"))
  2. as environment variables export GEOENGINE_EMAIL="email" and export GEOENGINE_PASSWORD="password"
  3. in a .env file in the current working directory with the content:
GEOENGINE_EMAIL="email"
GEOENGINE_PASSWORD="password"

Metadata

Release files for geoengine 0.10.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for geoengine 0.10.0
File Size Uploaded Provenance Actions
geoengine-0.10.0.tar.gz 100.5 kB Without provenance Details for geoengine-0.10.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for geoengine 0.10.0
File Interpreter ABI Platform Actions
geoengine-0.10.0-py3-none-any.whl Python 3 none any Details for geoengine-0.10.0-py3-none-any.whl

Total release size: 173.1 kB

Release files / geoengine-0.10.0.tar.gz

Download URL geoengine-0.10.0.tar.gz
Size 100.5 kB
Tags Source
SHA-256 checksum
How to use checksums
1ece4613c5112a1d1013777c413c6146c5246f4ee89ca35d5108f5927f80886c
BLAKE2b-256 checksum
How to use checksums
fa91552e43d06096154f67871c8a639925550e702c7338f357273bbc7f07bc93
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.10.22

Release files / geoengine-0.10.0-py3-none-any.whl

Download URL geoengine-0.10.0-py3-none-any.whl
Size 72.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fdcfc5a37918e7205ef65dd3623a3bde1d03414e09deb72140a350a732d57d8d
BLAKE2b-256 checksum
How to use checksums
ef39fb36a417d95764e4c02f3395f6db6076c8104663d401ad7cac78294d1a7a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.10.22

Security for geoengine 0.10.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page