Skip to content

Commit 266a0dc

Browse files
Merge pull request #219 from geo-engine/ubuntu-24
ubuntu 24 geo engine
2 parents d06c7b6 + facd2f2 commit 266a0dc

File tree

8 files changed

+29
-55
lines changed

8 files changed

+29
-55
lines changed

.github/.backend_git_ref

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
main
1+
35bae875265258dfacb8c9103e6967c7c934406a

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ on:
1212

1313
jobs:
1414
check:
15-
uses: geo-engine/geoengine-python/.github/workflows/test-python.yml@main
15+
uses: geo-engine/geoengine-python/.github/workflows/test-python.yml@ubuntu-24
1616

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

3333
with:
3434
python-version: 3.9

.github/workflows/test-python.yml

Lines changed: 16 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,8 @@ on:
1818

1919
jobs:
2020
check:
21-
runs-on: ubuntu-22.04
22-
23-
services:
24-
postgres:
25-
image: postgis/postgis
26-
env:
27-
POSTGRES_USER: geoengine
28-
POSTGRES_PASSWORD: geoengine
29-
POSTGRES_DB: geoengine
30-
ports:
31-
- 5432:5432
32-
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
21+
runs-on: ubuntu-24.04
22+
container: quay.io/geoengine/devcontainer:latest
3323

3424
defaults:
3525
run:
@@ -46,9 +36,9 @@ jobs:
4636
echo "GEOENGINE_VERSION=$(cat .github/.backend_git_ref)" >> $GITHUB_OUTPUT
4737
if ${{ inputs.use-uv }}; then
4838
echo "PIP_INSTALL=uv pip install --resolution=lowest-direct" >> $GITHUB_OUTPUT
49-
echo "VENV_CALL=source .venv/bin/activate" >> $GITHUB_OUTPUT
39+
echo "VENV_CALL=. .venv/bin/activate" >> $GITHUB_OUTPUT
5040
else
51-
echo "PIP_INSTALL=pip install" >> $GITHUB_OUTPUT
41+
echo "PIP_INSTALL=python -m pip install" >> $GITHUB_OUTPUT
5242
echo "VENV_CALL=" >> $GITHUB_OUTPUT
5343
fi
5444
if ${{ inputs.coverage }}; then
@@ -62,28 +52,6 @@ jobs:
6252
repository: geo-engine/geoengine
6353
ref: ${{ steps.vars.outputs.GEOENGINE_VERSION }}
6454
path: backend
65-
- name: Free Disk Space (Ubuntu)
66-
uses: jlumbroso/free-disk-space@main
67-
with:
68-
tool-cache: true
69-
android: true
70-
dotnet: true
71-
haskell: true
72-
large-packages: true
73-
docker-images: true
74-
swap-storage: true
75-
- name: Install lld & GDAL & Protobuf
76-
run: |
77-
sudo apt-get update
78-
sudo apt-get install lld libgdal-dev gdal-bin build-essential clang curl protobuf-compiler libgeos-dev libproj-dev
79-
sudo apt-get clean
80-
export C_INCLUDE_PATH=/usr/include/gdal:$C_INCLUDE_PATH
81-
export CPLUS_INCLUDE_PATH=/usr/include/gdal:$CPLUS_INCLUDE_PATH
82-
sudo ldconfig
83-
- name: Install Rustup
84-
run: |
85-
curl --proto '=https' --tlsv1.2 --retry 10 --retry-connrefused -fsSL "https://sh.rustup.rs" | sh -s -- --profile minimal --default-toolchain none -y
86-
echo "${CARGO_HOME:-$HOME/.cargo}/bin" >> $GITHUB_PATH
8755
- name: Set up Python ${{ inputs.python-version }}
8856
uses: actions/setup-python@v4
8957
with:
@@ -93,7 +61,7 @@ jobs:
9361
- name: Setup UV and create venv
9462
if: ${{ inputs.use-uv }}
9563
run: |
96-
pip install uv
64+
python -m pip install uv
9765
uv venv
9866
- name: Install build dependencies
9967
run: |
@@ -133,16 +101,23 @@ jobs:
133101
python -m mypy tests
134102
- name: Test
135103
run: |
104+
service postgresql start
136105
${{ steps.vars.outputs.VENV_CALL }}
137106
pytest ${{ steps.vars.outputs.COVERAGE_COMMAND }}
138107
env:
139108
GEOENGINE_TEST_CODE_PATH: ${{ github.workspace }}/backend
140109
GEOENGINE_TEST_BUILD_TYPE: "release"
141-
- name: Upload coverage to Coveralls
110+
- name: Report coverage to Coveralls
142111
if: ${{ inputs.coverage }}
143-
uses: coverallsapp/github-action@v2
144-
with:
145-
base-path: library
112+
# 1. We need to adjust the paths in the lcov file to match the repository structure.
113+
# 2. We need to download the coveralls script and upload the report.
114+
run: |
115+
sed -i 's|SF:geoengine/|SF:|' ../coverage.lcov
116+
curl -sL https://coveralls.io/coveralls-linux.tar.gz | tar -xz && ./coveralls report ../coverage.lcov
117+
# If we don't run it in the code folder, the paths in the report will prefixed with `library/geoengine/`.
118+
working-directory: library/geoengine
119+
env:
120+
COVERALLS_REPO_TOKEN: ${{ github.token }}
146121
- name: Examples
147122
run: |
148123
${{ steps.vars.outputs.VENV_CALL }}

examples/layers.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@
151151
},
152152
{
153153
"cell_type": "code",
154-
"execution_count": 5,
154+
"execution_count": null,
155155
"metadata": {},
156156
"outputs": [
157157
{
@@ -196,7 +196,7 @@
196196
}
197197
],
198198
"source": [
199-
"test_collection = root_of_layerdb.items[1].load()\n",
199+
"test_collection = root_of_layerdb.items[0].load()\n",
200200
"test_collection"
201201
]
202202
},
@@ -1162,7 +1162,7 @@
11621162
"name": "python",
11631163
"nbconvert_exporter": "python",
11641164
"pygments_lexer": "ipython3",
1165-
"version": "3.10.12"
1165+
"version": "3.12.3"
11661166
},
11671167
"orig_nbformat": 4,
11681168
"vscode": {

geoengine/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
'''Entry point for Geo Engine Python Library'''
22

3-
from pkg_resources import get_distribution
43
from requests import utils
54
from pydantic import ValidationError
65
from geoengine_openapi_client.exceptions import BadRequestException, OpenApiException, ApiTypeError, ApiValueError, \
76
ApiKeyError, ApiAttributeError, ApiException, NotFoundException
87
from geoengine_openapi_client import UsageSummaryGranularity
8+
import geoengine_openapi_client
99

1010
from . import workflow_builder
1111
from .raster_workflow_rio_writer import RasterWorkflowRioWriter
@@ -39,7 +39,7 @@
3939
add_or_replace_dataset_with_permissions, dataset_info_by_name
4040

4141

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

4444

4545
def default_user_agent(_name="python-requests"):

geoengine/auth.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
import os
1010
from dotenv import load_dotenv
11-
from pkg_resources import get_distribution
1211
from requests.auth import AuthBase
1312
import urllib3
1413

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

7675
if credentials is not None:
7776
session = http.request(

tests/test_auth.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from datetime import datetime
44
import unittest
55
import os
6-
from pkg_resources import get_distribution
6+
import geoengine_openapi_client
77
import geoengine as ge
88
from geoengine.error import GeoEngineException
99
from geoengine.types import QueryRectangle
@@ -120,7 +120,7 @@ def test_initialize_env(self):
120120
def test_user_agent(self):
121121
with UrllibMocker() as m:
122122
m.post('http://mock-instance/anonymous',
123-
request_headers={'User-Agent': f'geoengine-python/{get_distribution("geoengine").version}'},
123+
request_headers={'User-Agent': f'geoengine-python/{geoengine_openapi_client.__version__}'},
124124
json={
125125
"id": "e327d9c3-a4f3-4bd7-a5e1-30b26cae8064",
126126
"user": None,

tests/test_wfs.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import geopandas as gpd
99
import geopandas.testing # pylint: disable=unused-import
1010
from shapely.geometry import Point
11-
from pkg_resources import get_distribution
11+
import geoengine_openapi_client
1212
import geoengine as ge
1313
from . import UrllibMocker
1414

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

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

0 commit comments

Comments
 (0)