Skip to content

pandas DataFrameModel accepts python generic types #2464

pandas DataFrameModel accepts python generic types

pandas DataFrameModel accepts python generic types #2464

Workflow file for this run

name: CI Tests
on:
push:
branches:
- main
- dev
- bugfix
- "release/*"
pull_request:
branches:
- main
- dev
- polars-dev
- bugfix
- "release/*"
env:
DEFAULT_PYTHON: 3.8
CI: "true"
# Increase this value to reset cache if environment.yml has not changed
CACHE_VERSION: 6
concurrency:
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
cancel-in-progress: true
jobs:
lint:
name: Linters (${{ matrix.python-version }})
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
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-
- name: Install dependencies
run: |
python -m pip install nox pre_commit \
mypy==0.982 \
types-click \
types-pyyaml \
types-pkg_resources \
types-requests \
types-pytz
- name: Pip info
run: python -m pip list
- name: Check requirements
run: >
nox
-db virtualenv -r
--non-interactive
--python ${{ matrix.python-version }}
--session requirements-${{ matrix.python-version }}
- name: Sort Imports
run: pre-commit run isort --all-files
- name: Black
if: always()
run: pre-commit run black --all-files
- name: Pylint
if: always()
run: pre-commit run pylint --all-files
- name: Mypy Type Checking
if: always()
run: pre-commit run mypy --all-files
tests:
name: >
CI Tests (${{ matrix.python-version }}, ${{ matrix.os }}, pandas-${{ matrix.pandas-version }}, pydantic-${{ matrix.pydantic-version }})
runs-on: ${{ matrix.os }}
defaults:
run:
shell: pwsh
env:
PYTHONUTF8: 1
NOX_FLAGS: -v --no-install --no-venv --non-interactive
PYTEST_FLAGS: --cov=pandera --cov-report=term-missing --cov-report=xml --cov-append
HYPOTHESIS_FLAGS: -n=auto -q --hypothesis-profile=ci
strategy:
fail-fast: true
matrix:
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
python-version: ["3.8", "3.9", "3.10", "3.11"]
pandas-version: ["1.5.3", "2.0.3", "2.2.0"]
pydantic-version: ["1.10.11", "2.3.0"]
include:
- os: ubuntu-latest
pip-cache: ~/.cache/pip
- os: macos-latest
pip-cache: ~/Library/Caches/pip
- os: windows-latest
pip-cache: ~/AppData/Local/pip/Cache
exclude:
- python-version: "3.8"
pandas-version: "2.2.0"
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
uses: actions/cache@v4
with:
path: ${{ matrix.pip-cache }}
key: ${{ runner.os }}-pip-${{ hashFiles('requirements-dev.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install deps
run:
pip install uv
uv pip install -r ci/requirements-py${{ matrix.python-version }}-pandas${{ matrix.pandas-version }}-pydantic${{ matrix.pydantic-version }}.txt
- run: |
pip list
printenv | sort
- name: Unit Tests - Core
run: nox ${{ env.NOX_FLAGS }} --session "tests(extra='core', pydantic='${{ matrix.pydantic-version }}', python='${{ matrix.python-version }}', pandas='${{ matrix.pandas-version }}')"
- name: Unit Tests - Hypotheses
run: nox ${{ env.NOX_FLAGS }} --session "tests(extra='hypotheses', pydantic='${{ matrix.pydantic-version }}', python='${{ matrix.python-version }}', pandas='${{ matrix.pandas-version }}')"
- name: Unit Tests - IO
run: nox ${{ env.NOX_FLAGS }} --session "tests(extra='io', pydantic='${{ matrix.pydantic-version }}', python='${{ matrix.python-version }}', pandas='${{ matrix.pandas-version }}')"
- name: Unit Tests - Mypy
# mypy tests hang on windows
if: ${{ matrix.os != 'windows-latest' }}
run: nox ${{ env.NOX_FLAGS }} --session "tests(extra='mypy', pydantic='${{ matrix.pydantic-version }}', python='${{ matrix.python-version }}', pandas='${{ matrix.pandas-version }}')"
- name: Unit Tests - Strategies
run: nox ${{ env.NOX_FLAGS }} --session "tests(extra='strategies', pydantic='${{ matrix.pydantic-version }}', python='${{ matrix.python-version }}', pandas='${{ matrix.pandas-version }}')"
- name: Unit Tests - FastAPI
# there's an issue with the fastapi tests in CI that's not reproducible locally
# when pydantic > v2
run: nox ${{ env.NOX_FLAGS }} --session "tests(extra='fastapi', pydantic='${{ matrix.pydantic-version }}', python='${{ matrix.python-version }}', pandas='${{ matrix.pandas-version }}')"
- name: Unit Tests - GeoPandas
run: nox ${{ env.NOX_FLAGS }} --session "tests(extra='geopandas', pydantic='${{ matrix.pydantic-version }}', python='${{ matrix.python-version }}', pandas='${{ matrix.pandas-version }}')"
- name: Unit Tests - Dask
if: ${{ matrix.pandas-version == '1.5.3' }}
run: nox ${{ env.NOX_FLAGS }} --session "tests(extra='dask', pydantic='${{ matrix.pydantic-version }}', python='${{ matrix.python-version }}', pandas='${{ matrix.pandas-version }}')"
- name: Unit Tests - Pyspark
if: ${{ matrix.os != 'windows-latest' && matrix.pandas-version == '1.5.3' }}
run: nox ${{ env.NOX_FLAGS }} --session "tests(extra='pyspark', pydantic='${{ matrix.pydantic-version }}', python='${{ matrix.python-version }}', pandas='${{ matrix.pandas-version }}')"
- name: Unit Tests - Modin-Dask
if: ${{ matrix.pandas-version == '1.5.3' }}
run: nox ${{ env.NOX_FLAGS }} --session "tests(extra='modin-dask', pydantic='${{ matrix.pydantic-version }}', python='${{ matrix.python-version }}', pandas='${{ matrix.pandas-version }}')"
- name: Unit Tests - Modin-Ray
# ray CI issues with the following:
# - windows, python 3.10
# Tracking issue: https://github.com/modin-project/modin/issues/5466
if: ${{ matrix.os != 'windows-latest' && matrix.pandas-version == '1.5.3' }}
run: nox ${{ env.NOX_FLAGS }} --session "tests(extra='modin-ray', pydantic='${{ matrix.pydantic-version }}', python='${{ matrix.python-version }}', pandas='${{ matrix.pandas-version }}')"
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
- name: Check Docstrings
if: ${{ matrix.os != 'windows-latest' && matrix.python-version == '3.11' && matrix.pandas-version == '2.0.3' }}
run: nox ${{ env.NOX_FLAGS }} --session doctests
- name: Check Docs
if: ${{ matrix.os != 'windows-latest' && matrix.python-version == '3.11' && matrix.pydantic-version == '2.0.3' }}
run: nox ${{ env.NOX_FLAGS }} --session docs