Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/.backend_git_ref
Original file line number Diff line number Diff line change
@@ -1 +1 @@
main
35bae875265258dfacb8c9103e6967c7c934406a
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:

jobs:
check:
uses: geo-engine/geoengine-python/.github/workflows/test-python.yml@main
uses: geo-engine/geoengine-python/.github/workflows/test-python.yml@ubuntu-24

strategy:
fail-fast: false
Expand All @@ -28,7 +28,7 @@ jobs:
# Checks the library using minimum version resolution
# `uv` has this feature built-in, c.f. https://github.com/astral-sh/uv
check-min-version:
uses: geo-engine/geoengine-python/.github/workflows/test-python.yml@main
uses: geo-engine/geoengine-python/.github/workflows/test-python.yml@ubuntu-24

with:
python-version: 3.9
Expand Down
57 changes: 16 additions & 41 deletions .github/workflows/test-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,8 @@ on:

jobs:
check:
runs-on: ubuntu-22.04

services:
postgres:
image: postgis/postgis
env:
POSTGRES_USER: geoengine
POSTGRES_PASSWORD: geoengine
POSTGRES_DB: geoengine
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
runs-on: ubuntu-24.04
container: quay.io/geoengine/devcontainer:latest

defaults:
run:
Expand All @@ -46,9 +36,9 @@ jobs:
echo "GEOENGINE_VERSION=$(cat .github/.backend_git_ref)" >> $GITHUB_OUTPUT
if ${{ inputs.use-uv }}; then
echo "PIP_INSTALL=uv pip install --resolution=lowest-direct" >> $GITHUB_OUTPUT
echo "VENV_CALL=source .venv/bin/activate" >> $GITHUB_OUTPUT
echo "VENV_CALL=. .venv/bin/activate" >> $GITHUB_OUTPUT
else
echo "PIP_INSTALL=pip install" >> $GITHUB_OUTPUT
echo "PIP_INSTALL=python -m pip install" >> $GITHUB_OUTPUT
echo "VENV_CALL=" >> $GITHUB_OUTPUT
fi
if ${{ inputs.coverage }}; then
Expand All @@ -62,28 +52,6 @@ jobs:
repository: geo-engine/geoengine
ref: ${{ steps.vars.outputs.GEOENGINE_VERSION }}
path: backend
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
tool-cache: true
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true
- name: Install lld & GDAL & Protobuf
run: |
sudo apt-get update
sudo apt-get install lld libgdal-dev gdal-bin build-essential clang curl protobuf-compiler libgeos-dev libproj-dev
sudo apt-get clean
export C_INCLUDE_PATH=/usr/include/gdal:$C_INCLUDE_PATH
export CPLUS_INCLUDE_PATH=/usr/include/gdal:$CPLUS_INCLUDE_PATH
sudo ldconfig
- name: Install Rustup
run: |
curl --proto '=https' --tlsv1.2 --retry 10 --retry-connrefused -fsSL "https://sh.rustup.rs" | sh -s -- --profile minimal --default-toolchain none -y
echo "${CARGO_HOME:-$HOME/.cargo}/bin" >> $GITHUB_PATH
- name: Set up Python ${{ inputs.python-version }}
uses: actions/setup-python@v4
with:
Expand All @@ -93,7 +61,7 @@ jobs:
- name: Setup UV and create venv
if: ${{ inputs.use-uv }}
run: |
pip install uv
python -m pip install uv
uv venv
- name: Install build dependencies
run: |
Expand Down Expand Up @@ -133,16 +101,23 @@ jobs:
python -m mypy tests
- name: Test
run: |
service postgresql start
${{ steps.vars.outputs.VENV_CALL }}
pytest ${{ steps.vars.outputs.COVERAGE_COMMAND }}
env:
GEOENGINE_TEST_CODE_PATH: ${{ github.workspace }}/backend
GEOENGINE_TEST_BUILD_TYPE: "release"
- name: Upload coverage to Coveralls
- name: Report coverage to Coveralls
if: ${{ inputs.coverage }}
uses: coverallsapp/github-action@v2
with:
base-path: library
# 1. We need to adjust the paths in the lcov file to match the repository structure.
# 2. We need to download the coveralls script and upload the report.
run: |
sed -i 's|SF:geoengine/|SF:|' ../coverage.lcov
curl -sL https://coveralls.io/coveralls-linux.tar.gz | tar -xz && ./coveralls report ../coverage.lcov
# If we don't run it in the code folder, the paths in the report will prefixed with `library/geoengine/`.
working-directory: library/geoengine
env:
COVERALLS_REPO_TOKEN: ${{ github.token }}
- name: Examples
run: |
${{ steps.vars.outputs.VENV_CALL }}
Expand Down
6 changes: 3 additions & 3 deletions examples/layers.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": null,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -196,7 +196,7 @@
}
],
"source": [
"test_collection = root_of_layerdb.items[1].load()\n",
"test_collection = root_of_layerdb.items[0].load()\n",
"test_collection"
]
},
Expand Down Expand Up @@ -1162,7 +1162,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.12"
"version": "3.12.3"
},
"orig_nbformat": 4,
"vscode": {
Expand Down
4 changes: 2 additions & 2 deletions geoengine/__init__.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
'''Entry point for Geo Engine Python Library'''

from pkg_resources import get_distribution
from requests import utils
from pydantic import ValidationError
from geoengine_openapi_client.exceptions import BadRequestException, OpenApiException, ApiTypeError, ApiValueError, \
ApiKeyError, ApiAttributeError, ApiException, NotFoundException
from geoengine_openapi_client import UsageSummaryGranularity
import geoengine_openapi_client

from . import workflow_builder
from .raster_workflow_rio_writer import RasterWorkflowRioWriter
Expand Down Expand Up @@ -39,7 +39,7 @@
add_or_replace_dataset_with_permissions, dataset_info_by_name


DEFAULT_USER_AGENT = f'geoengine-python/{get_distribution("geoengine").version}'
DEFAULT_USER_AGENT = f'geoengine-python/{geoengine_openapi_client.__version__}'


def default_user_agent(_name="python-requests"):
Expand Down
3 changes: 1 addition & 2 deletions geoengine/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

import os
from dotenv import load_dotenv
from pkg_resources import get_distribution
from requests.auth import AuthBase
import urllib3

Expand Down Expand Up @@ -71,7 +70,7 @@ def __init__(self,
# Auto-generated SessionApi cannot handle dynamically differing return types (SimpleSession or UserSession).
# Because of that requests must be send manually.
http = urllib3.PoolManager()
user_agent = f'geoengine-python/{get_distribution("geoengine").version}'
user_agent = f'geoengine-python/{geoengine_openapi_client.__version__}'

if credentials is not None:
session = http.request(
Expand Down
4 changes: 2 additions & 2 deletions tests/test_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from datetime import datetime
import unittest
import os
from pkg_resources import get_distribution
import geoengine_openapi_client
import geoengine as ge
from geoengine.error import GeoEngineException
from geoengine.types import QueryRectangle
Expand Down Expand Up @@ -120,7 +120,7 @@ def test_initialize_env(self):
def test_user_agent(self):
with UrllibMocker() as m:
m.post('http://mock-instance/anonymous',
request_headers={'User-Agent': f'geoengine-python/{get_distribution("geoengine").version}'},
request_headers={'User-Agent': f'geoengine-python/{geoengine_openapi_client.__version__}'},
json={
"id": "e327d9c3-a4f3-4bd7-a5e1-30b26cae8064",
"user": None,
Expand Down
4 changes: 2 additions & 2 deletions tests/test_wfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import geopandas as gpd
import geopandas.testing # pylint: disable=unused-import
from shapely.geometry import Point
from pkg_resources import get_distribution
import geoengine_openapi_client
import geoengine as ge
from . import UrllibMocker

Expand Down Expand Up @@ -829,7 +829,7 @@ def test_owslib_user_agent(self):
}]
},
request_headers={'Authorization': 'Bearer e327d9c3-a4f3-4bd7-a5e1-30b26cae8064',
'User-Agent': f'geoengine/openapi-client/python/{get_distribution("geoengine-openapi-client").version}'}
'User-Agent': f'geoengine/openapi-client/python/{geoengine_openapi_client.__version__}'}
)

ge.initialize("http://mock-instance")
Expand Down