-
-
Notifications
You must be signed in to change notification settings - Fork 428
607 lines (571 loc) · 20 KB
/
Copy pathci-tests.yml
File metadata and controls
607 lines (571 loc) · 20 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
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
name: CI Tests
on:
push:
branches:
- main
- dev
- bugfix
- "release/*"
- "fix/**"
pull_request:
branches:
- main
- dev
- ibis-dev
- dev/xarray
- bugfix
- "release/*"
env:
DEFAULT_PYTHON: 3.11
CI: "true"
concurrency:
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
cancel-in-progress: true
jobs:
lint:
name: Linters (python=${{ matrix.python-version }} polars=${{ matrix.polars-version }} )
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
polars-version: ["1.20.0", "1.33.1","1.42.1"]
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- uses: actions/cache@v4
with:
path: ~/.cache/pip # ubuntu location
key: ${{ runner.os }}-pip-${{ hashFiles('requirements-dev.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- uses: actions/cache@v4
with:
path: ~/.cache/uv
key: ${{ runner.os }}-uv-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml', 'requirements.txt', 'noxfile.py') }}
restore-keys: |
${{ runner.os }}-uv-${{ matrix.python-version }}-
${{ runner.os }}-uv-
- name: Install dependencies
run: |
for attempt in 1 2 3; do
python -m pip install uv nox prek \
mypy==0.982 \
types-click \
types-pytz \
types-pyyaml \
types-requests \
types-setuptools \
setuptools \
polars==${{ matrix.polars-version }} && break
if [ "$attempt" -eq 3 ]; then
exit 1
fi
sleep 10
done
- name: Install pandera
run: python -m pip install -e .
- name: Pip info
run: python -m pip list
- name: Check requirements
run: nox -db uv -r --non-interactive --python ${{ matrix.python-version }} --session requirements-${{ matrix.python-version }}
- if: always()
run: prek run ruff-check --all-files
- name: Mypy Type Checking
if: always()
run: prek run mypy --all-files
# Test that polars can be imported without pandas
import-test-polars-no-pandas:
name: Import Test Polars (no pandas)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install polars only (no pandas)
run: python -m pip install polars
- name: Uninstall pandas if present
run: python -m pip uninstall pandas -y || true
- name: Install pandera
run: python -m pip install -e .
- name: Test import pandera.polars
run: |
python -c "import pandera.polars; print('SUCCESS: pandera.polars imported without pandas')"
# test base functionality
unit-tests-base:
name: >
Unit Tests Base: python-${{ matrix.python-version }} ${{ matrix.os }}
runs-on: ${{ matrix.os }}
defaults:
run:
shell: pwsh
env:
PYTHONUTF8: 1
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
pydantic-version: ["2.12.3"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- uses: actions/cache@v4
with:
path: |
~/.cache/uv
~/AppData/Local/uv/cache
key: ${{ runner.os }}-uv-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml', 'requirements.txt', 'noxfile.py') }}
restore-keys: |
${{ runner.os }}-uv-${{ matrix.python-version }}-
${{ runner.os }}-uv-
- name: Install dev deps
shell: bash
run: |
for attempt in 1 2 3; do
pip install 'uv<0.7.0' nox && break
if [ "$attempt" -eq 3 ]; then
exit 1
fi
sleep 10
done
- run: |
pip list
printenv | sort
- name: Unit Tests Base
run: |
nox -v -db uv --non-interactive --session 'tests-${{ matrix.python-version }}(extra=None, pandas=None, pydantic=None, polars=None)'
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: false
flags: unit-tests-base-${{ runner.os }}-py${{ matrix.python-version }}
env:
CODECOV_TOKEN: ${{ secrets.PANDERA_CODECOV_TOKEN }}
# test pandas functionality
unit-tests-pandas:
name: >
Unit Tests Pandas: python-${{ matrix.python-version }} ${{ matrix.os }} (extra-pandas, pandas-${{ matrix.pandas-version }}, pydantic-${{ matrix.pydantic-version }})
runs-on: ${{ matrix.os }}
defaults:
run:
shell: pwsh
env:
PYTHONUTF8: 1
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
pandas-version: ["2.3.3", "3.0.0"]
pydantic-version: ["1.10.11", "2.12.3"]
exclude:
- pandas-version: "2.1.1"
python-version: "3.13"
- pandas-version: "2.1.1"
python-version: "3.14"
- pydantic-version: "1.10.11"
python-version: "3.14"
- pandas-version: "3.0.0"
python-version: "3.10"
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- uses: actions/cache@v4
with:
path: |
~/.cache/uv
~/AppData/Local/uv/cache
key: ${{ runner.os }}-uv-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml', 'requirements.txt', 'noxfile.py') }}
restore-keys: |
${{ runner.os }}-uv-${{ matrix.python-version }}-
${{ runner.os }}-uv-
- name: Install dev deps
shell: bash
run: |
for attempt in 1 2 3; do
pip install 'uv<0.7.0' nox && break
if [ "$attempt" -eq 3 ]; then
exit 1
fi
sleep 10
done
- run: |
pip list
printenv | sort
- name: Unit Tests - pandas
run: nox -v -db uv --non-interactive --session "tests-${{ matrix.python-version }}(extra='pandas', pandas='${{ matrix.pandas-version }}', pydantic='${{ matrix.pydantic-version }}', polars=None)"
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: false
flags: unit-tests-pandas-${{ runner.os }}-py${{ matrix.python-version }}-pandas${{ matrix.pandas-version }}-pydantic${{ matrix.pydantic-version }}
env:
CODECOV_TOKEN: ${{ secrets.PANDERA_CODECOV_TOKEN }}
# test extras that add functionality to core pandera features
unit-tests-supplemental-extras:
name: >
Unit Tests Supplemental Extras: python-${{ matrix.python-version }} ${{ matrix.os }} (extra-${{ matrix.extra }}, pandas-${{ matrix.pandas-version }}, pydantic-${{ matrix.pydantic-version }})
runs-on: ${{ matrix.os }}
defaults:
run:
shell: pwsh
env:
PYTHONUTF8: 1
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
pandas-version: ["2.3.3", "3.0.0"]
pydantic-version: ["2.12.3"]
extra:
- hypotheses
- io
- mypy
- strategies
- fastapi
- geopandas
exclude:
- extra: mypy
os: windows-latest
# remove this when pyogrio is supported on Python 3.14
- extra: geopandas
python-version: "3.14"
- pandas-version: "3.0.0"
python-version: "3.10"
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- uses: actions/cache@v4
with:
path: |
~/.cache/uv
~/AppData/Local/uv/cache
key: ${{ runner.os }}-uv-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml', 'requirements.txt', 'noxfile.py') }}
restore-keys: |
${{ runner.os }}-uv-${{ matrix.python-version }}-
${{ runner.os }}-uv-
- name: Install dev deps
shell: bash
run: |
for attempt in 1 2 3; do
pip install 'uv<0.7.0' nox && break
if [ "$attempt" -eq 3 ]; then
exit 1
fi
sleep 10
done
- run: |
pip list
printenv | sort
- name: Unit Tests - ${{ matrix.extra }}
run: nox -v -db uv --non-interactive --session "tests-${{ matrix.python-version }}(extra='${{ matrix.extra }}', pandas='${{ matrix.pandas-version }}', pydantic='${{ matrix.pydantic-version }}', polars=None)"
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: false
flags: unit-tests-${{ matrix.extra }}-${{ runner.os }}-py${{ matrix.python-version }}-pandas${{ matrix.pandas-version }}-pydantic${{ matrix.pydantic-version }}
env:
CODECOV_TOKEN: ${{ secrets.PANDERA_CODECOV_TOKEN }}
# The dataframe-extras jobs below exercise the native pandera.polars and
# pandera.ibis backends (PANDERA_USE_NARWHALS_BACKEND is unset / False).
# The `unit-tests-narwhals-backend` jobs below run the same test suites with
# PANDERA_USE_NARWHALS_BACKEND=True so the narwhals backend is active.
# test extras for popular dataframe libraries
unit-tests-dataframe-extras:
name: >
Unit Tests DataFrame Extras: python-${{ matrix.python-version }} ${{ matrix.os }} (extra-${{ matrix.extra }} pandas-${{ matrix.pandas-version }} polars=${{ matrix.polars-version }})
runs-on: ${{ matrix.os }}
defaults:
run:
shell: pwsh
env:
PYTHONUTF8: 1
PYTEST_FLAGS: --cov=pandera --cov-report=term-missing --cov-report=xml --cov-append
HYPOTHESIS_FLAGS: -n=auto -q --hypothesis-profile=ci
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
pandas-version: ["2.3.3"]
extra:
- dask
- polars
- pyspark
- modin-dask
- modin-ray
- ibis
- xarray
include:
- extra: polars
python-version: "3.10"
polars-version: "1.20.0"
- extra: polars
python-version: "3.11"
polars-version: "1.20.0"
- extra: polars
python-version: "3.12"
polars-version: "1.33.1"
- extra: polars
python-version: "3.13"
polars-version: "1.33.1"
- extra: polars
python-version: "3.14"
polars-version: "1.42.1"
- extra: polars
pydantic-version: "2.12.3"
exclude:
- extra: modin-ray
os: windows-latest
# pyspark serialization issue on windows: "pandas" module not found
- extra: pyspark
os: windows-latest
- extra: pyspark
python-version: "3.12"
- extra: pyspark
python-version: "3.13"
- extra: pyspark
python-version: "3.14"
- extra: modin-dask
python-version: "3.13"
- extra: modin-dask
python-version: "3.14"
- extra: modin-ray
python-version: "3.13"
- extra: modin-ray
python-version: "3.14"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: "zulu"
java-version: "17"
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- uses: actions/cache@v4
with:
path: |
~/.cache/uv
~/AppData/Local/uv/cache
key: ${{ runner.os }}-uv-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml', 'requirements.txt', 'noxfile.py') }}
restore-keys: |
${{ runner.os }}-uv-${{ matrix.python-version }}-
${{ runner.os }}-uv-
- name: Install dev deps
shell: bash
run: |
for attempt in 1 2 3; do
pip install 'uv<0.7.0' nox && break
if [ "$attempt" -eq 3 ]; then
exit 1
fi
sleep 10
done
- run: |
pip list
printenv | sort
- name: Unit Tests - ${{ matrix.extra }}
if: matrix.extra == 'polars'
run: nox -v -db uv --non-interactive --session "tests-${{ matrix.python-version }}(extra='${{ matrix.extra }}', pandas='${{ matrix.pandas-version }}', pydantic='${{ matrix.pydantic-version }}', polars='${{ matrix.polars-version }}')"
- name: Unit Tests - ${{ matrix.extra }}
if: matrix.extra != 'polars'
run: nox -v -db uv --non-interactive --session "tests-${{ matrix.python-version }}(extra='${{ matrix.extra }}', pandas='${{ matrix.pandas-version }}', pydantic=None, polars=None)"
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: false
flags: unit-tests-${{ matrix.extra }}-${{ runner.os }}-py${{ matrix.python-version }}-pandas${{ matrix.pandas-version }}-polars${{ matrix.polars-version }}
env:
CODECOV_TOKEN: ${{ secrets.PANDERA_CODECOV_TOKEN }}
# Run tests/polars/ and tests/ibis/ with narwhals co-installed and
# PANDERA_USE_NARWHALS_BACKEND=True so the narwhals backend is active for those
# frame types. Tests that expose narwhals backend gaps should be marked xfail.
unit-tests-narwhals-backend:
name: >
Unit Tests Narwhals Backend: python-${{ matrix.python-version }} (extra-${{ matrix.extra }})
runs-on: ubuntu-latest
defaults:
run:
shell: bash
env:
PYTHONUTF8: 1
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
extra: [polars, ibis, pyspark]
exclude:
- extra: pyspark
python-version: "3.12"
- extra: pyspark
python-version: "3.13"
- extra: pyspark
python-version: "3.14"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
if: matrix.extra == 'pyspark'
with:
distribution: "zulu"
java-version: "17"
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- uses: actions/cache@v4
with:
path: |
~/.cache/uv
~/AppData/Local/uv/cache
key: ${{ runner.os }}-uv-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml', 'requirements.txt', 'noxfile.py') }}
restore-keys: |
${{ runner.os }}-uv-${{ matrix.python-version }}-
${{ runner.os }}-uv-
- name: Install dev deps
run: |
for attempt in 1 2 3; do
pip install 'uv<0.7.0' nox && break
if [ "$attempt" -eq 3 ]; then
exit 1
fi
sleep 10
done
- run: |
pip list
printenv | sort
- name: Unit Tests - narwhals backend (${{ matrix.extra }})
run: nox -v -db uv --non-interactive --session "tests_narwhals_backend-${{ matrix.python-version }}(extra='${{ matrix.extra }}')"
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: false
flags: unit-tests-narwhals-backend-${{ matrix.extra }}-py${{ matrix.python-version }}
env:
CODECOV_TOKEN: ${{ secrets.PANDERA_CODECOV_TOKEN }}
# Run the narwhals-specific test suite (tests/narwhals/) with narwhals,
# polars, and ibis all co-installed. Tests in tests/narwhals/backends/ run
# once per backend (polars, ibis) using native frames.
unit-tests-narwhals:
name: >
Unit Tests Narwhals: python-${{ matrix.python-version }} ${{ matrix.os }}
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
env:
PYTHONUTF8: 1
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- uses: actions/cache@v4
with:
path: |
~/.cache/uv
~/AppData/Local/uv/cache
key: ${{ runner.os }}-uv-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml', 'requirements.txt', 'noxfile.py') }}
restore-keys: |
${{ runner.os }}-uv-${{ matrix.python-version }}-
${{ runner.os }}-uv-
- name: Install dev deps
shell: bash
run: |
for attempt in 1 2 3; do
pip install 'uv<0.7.0' nox && break
if [ "$attempt" -eq 3 ]; then
exit 1
fi
sleep 10
done
- run: |
pip list
printenv | sort
- name: Unit Tests - narwhals
run: nox -v -db uv --non-interactive --session "tests-${{ matrix.python-version }}(extra='narwhals', pandas=None, pydantic=None, polars=None)"
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: false
flags: unit-tests-narwhals-${{ runner.os }}-py${{ matrix.python-version }}
env:
CODECOV_TOKEN: ${{ secrets.PANDERA_CODECOV_TOKEN }}
docs:
name: Docs (${{ matrix.python-version }})
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
# TODO(deepyaman): Add Python version 3.14, pending Ray support;
# see https://github.com/ray-project/ray/issues/57642
python-version: ["3.10", "3.11", "3.12", "3.13"]
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: "zulu"
java-version: "17"
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- uses: actions/cache@v4
with:
path: ~/.cache/pip # ubuntu location
key: ${{ runner.os }}-pip-${{ hashFiles('requirements-dev.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- uses: actions/cache@v4
with:
path: ~/.cache/uv
key: ${{ runner.os }}-uv-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml', 'requirements.txt', 'noxfile.py') }}
restore-keys: |
${{ runner.os }}-uv-${{ matrix.python-version }}-
${{ runner.os }}-uv-
- name: Install dependencies
run: |
for attempt in 1 2 3; do
pip install 'uv<0.7.0' nox && break
if [ "$attempt" -eq 3 ]; then
exit 1
fi
sleep 10
done
- name: Pip info
run: python -m pip list
- name: Build docs and run doctest
run: >
nox
-db uv -r
--non-interactive
--session docs-${{ matrix.python-version }}