Repository navigation
338 lines (290 loc) · 11.1 KB
/
Copy pathpythonpackage.yml
File metadata and controls
338 lines (290 loc) · 11.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
name: Python package tests
on: [push, pull_request]
jobs:
test-fast:
runs-on: ${{ matrix.os }}
strategy:
max-parallel: 4
matrix:
python-version: ['3.10', '3.14']
os: [ubuntu-24.04] # , windows-2019]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Cache pip dependencies
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('**/pyproject.toml', '**/requirements*.txt') }}
restore-keys: |
${{ runner.os }}-pip-${{ matrix.python-version }}-
${{ runner.os }}-pip-
- name: Cache system dependencies (Ubuntu)
if: runner.os == 'Linux'
uses: actions/cache@v3
with:
path: |
/usr/include/gdal
/usr/lib/x86_64-linux-gnu/libgdal*
/usr/bin/gdal*
key: ${{ runner.os }}-gdal-${{ hashFiles('.github/workflows/pythonpackage.yml') }}
restore-keys: |
${{ runner.os }}-gdal-
- name: Install system dependencies (Ubuntu)
if: runner.os == 'Linux'
run: |
sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable
sudo apt-get update
sudo apt-get install -y libproj-dev libgeos-dev libspatialite-dev libgdal-dev gdal-bin netcdf-bin
gdal-config --version
- name: Upgrade pip
run: |
python -m pip install --upgrade pip
- name: Install GDAL Python bindings matching system library
if: runner.os == 'Linux'
run: |
pip install gdal==$(gdal-config --version)
- name: Install geoextent and dependencies
run: |
pip install -e .[dev,test,preview,nlp]
- name: Download spaCy English model for NER tests (issue #112)
run: |
python -m spacy download en_core_web_sm
- name: Check code formatting with black
run: |
black --check --diff .
- name: Smoke-check tagged docs examples
run: |
# Runs every `:class: smoke-check` block in docs/ and README.md and
# diffs the result against its `:class: smoke-check-output` partner.
# Network-dependent examples (`smoke-check-network`) skipped by default.
# See the "Documentation Code Snippets (Smoke-Check)" section in
# CLAUDE.md for the convention and `--regenerate` workflow.
python scripts/check_docs_examples.py
- name: Test with pytest (fast tests only)
run: |
# Uses default addopts: -m "not slow and not large_download"
pytest -v --tb=short --cov=geoextent --cov-report=xml --cov-report=term-missing
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
with:
file: ./coverage.xml
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false
test-providers:
runs-on: ${{ matrix.os }}
strategy:
max-parallel: 4
matrix:
python-version: ['3.10', '3.14']
os: [ubuntu-24.04]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Cache pip dependencies
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('**/pyproject.toml', '**/requirements*.txt') }}
restore-keys: |
${{ runner.os }}-pip-${{ matrix.python-version }}-
${{ runner.os }}-pip-
- name: Cache system dependencies (Ubuntu)
if: runner.os == 'Linux'
uses: actions/cache@v3
with:
path: |
/usr/include/gdal
/usr/lib/x86_64-linux-gnu/libgdal*
/usr/bin/gdal*
key: ${{ runner.os }}-gdal-${{ hashFiles('.github/workflows/pythonpackage.yml') }}
restore-keys: |
${{ runner.os }}-gdal-
- name: Install system dependencies (Ubuntu)
if: runner.os == 'Linux'
run: |
sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable
sudo apt-get update
sudo apt-get install -y libproj-dev libgeos-dev libspatialite-dev libgdal-dev gdal-bin netcdf-bin
gdal-config --version
- name: Upgrade pip
run: |
python -m pip install --upgrade pip
- name: Install GDAL Python bindings matching system library
if: runner.os == 'Linux'
run: |
pip install gdal==$(gdal-config --version)
- name: Install geoextent and dependencies
run: |
pip install -e .[dev,test,preview]
- name: Test provider samples (one test per provider)
run: |
pytest -v --tb=short -m provider_sample --cov=geoextent --cov-report=xml --cov-report=term-missing
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
with:
file: ./coverage.xml
flags: provider-sample
name: codecov-provider-sample
fail_ci_if_error: false
verify-test-collection:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.14
uses: actions/setup-python@v4
with:
python-version: '3.14'
- name: Cache system dependencies
uses: actions/cache@v3
with:
path: |
/usr/include/gdal
/usr/lib/x86_64-linux-gnu/libgdal*
/usr/bin/gdal*
key: ${{ runner.os }}-gdal-${{ hashFiles('.github/workflows/pythonpackage.yml') }}
restore-keys: |
${{ runner.os }}-gdal-
- name: Install system dependencies
run: |
sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable
sudo apt-get update
sudo apt-get install -y libproj-dev libgeos-dev libspatialite-dev libgdal-dev gdal-bin netcdf-bin
gdal-config --version
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install gdal==$(gdal-config --version)
pip install -e .[dev,test,preview]
- name: Discover and list all tests
run: |
echo "=== Discovering all test files ==="
find tests/ -name "test_*.py" -type f | sort
echo -e "\n=== Test collection verification ==="
pytest --collect-only -q | grep "test session starts\|collected"
echo -e "\n=== Running test collection with detailed output ==="
pytest --collect-only --tb=short
- name: Verify no tests are skipped due to missing dependencies
run: |
echo "=== Running a dry run to check for import errors ==="
pytest --collect-only --tb=line 2>&1 | tee test_collection.log
echo -e "\n=== Checking for common issues ==="
# Filter out test function names (inside <Function ...> tags) before
# checking for real Python import errors.
if grep -v '<Function' test_collection.log | grep -i "ImportError\|ModuleNotFoundError\|No module named"; then
echo "Found import errors in test collection"
exit 1
else
echo "No import errors found in test collection"
fi
test-fast-windows:
runs-on: windows-latest
continue-on-error: true
defaults:
run:
shell: bash -el {0}
steps:
- uses: actions/checkout@v4
- name: Enable long paths on Windows
shell: pwsh
run: |
New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" `
-Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force
- name: Set up Miniconda
uses: conda-incubator/setup-miniconda@v3
with:
python-version: '3.12'
channels: conda-forge
channel-priority: strict
activate-environment: geoextent-test
miniforge-version: latest
- name: Cache conda packages
uses: actions/cache@v3
with:
path: ~/conda_pkgs_dir
key: windows-conda-${{ hashFiles('.github/workflows/pythonpackage.yml') }}
restore-keys: |
windows-conda-
- name: Install GDAL and system deps via conda
run: |
conda install -y gdal libgdal libspatialite netcdf4 proj
- name: Install geoextent in dev mode (no dependency resolution)
run: |
pip install --no-deps -e .
- name: Install runtime dependencies (excluding gdal)
run: |
pip install pyproj "geojson>=2.4.1" geojsonio pygeoj pyshp \
patool python-dateutil pandas "numpy<2" requests traitlets \
wheel pangaeapy osfclient filesizelib "setuptools-scm>=8" \
tqdm bs4 geopy python-dotenv humanfriendly crossref-commons \
datacite owslib "laspy[lazrs]" curl_cffi
- name: Install dev and test dependencies
run: |
pip install pytest pytest-cov "pytest-xdist[psutil]" \
pytest-console-scripts geojson-validator black pre-commit \
"staticmap>=0.5.5" "term-image>=0.7,<0.8"
- name: Verify GDAL import
run: |
python -c "from osgeo import gdal; print(f'GDAL {gdal.VersionInfo()}')"
- name: Test with pytest (fast tests only)
run: |
pytest -v --tb=short -n auto -m "not slow and not large_download"
test-providers-windows:
runs-on: windows-latest
continue-on-error: true
defaults:
run:
shell: bash -el {0}
steps:
- uses: actions/checkout@v4
- name: Enable long paths on Windows
shell: pwsh
run: |
New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" `
-Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force
- name: Set up Miniconda
uses: conda-incubator/setup-miniconda@v3
with:
python-version: '3.12'
channels: conda-forge
channel-priority: strict
activate-environment: geoextent-test
miniforge-version: latest
- name: Cache conda packages
uses: actions/cache@v3
with:
path: ~/conda_pkgs_dir
key: windows-conda-${{ hashFiles('.github/workflows/pythonpackage.yml') }}
restore-keys: |
windows-conda-
- name: Install GDAL and system deps via conda
run: |
conda install -y gdal libgdal libspatialite netcdf4 proj
- name: Install geoextent in dev mode (no dependency resolution)
run: |
pip install --no-deps -e .
- name: Install runtime dependencies (excluding gdal)
run: |
pip install pyproj "geojson>=2.4.1" geojsonio pygeoj pyshp \
patool python-dateutil pandas "numpy<2" requests traitlets \
wheel pangaeapy osfclient filesizelib "setuptools-scm>=8" \
tqdm bs4 geopy python-dotenv humanfriendly crossref-commons \
datacite owslib "laspy[lazrs]" curl_cffi
- name: Install dev and test dependencies
run: |
pip install pytest pytest-cov "pytest-xdist[psutil]" \
pytest-console-scripts geojson-validator black pre-commit \
"staticmap>=0.5.5" "term-image>=0.7,<0.8"
- name: Verify GDAL import
run: |
python -c "from osgeo import gdal; print(f'GDAL {gdal.VersionInfo()}')"
- name: Test provider samples
run: |
pytest -v --tb=short -n auto -m provider_sample