Skip to content

fix(polars): raise minimum polars version to 1.20.0 - #2412

Open
fhoehle wants to merge 1 commit into
unionai-oss:mainfrom
fhoehle:bugfix/2407
Open

fix(polars): raise minimum polars version to 1.20.0#2412
fhoehle wants to merge 1 commit into
unionai-oss:mainfrom
fhoehle:bugfix/2407

Conversation

@fhoehle

@fhoehle fhoehle commented Jul 11, 2026

Copy link
Copy Markdown

Closes #2407pandera[polars] failing during import with polars=0.20.* present.

As discussed in #2407, this bumps pandera's minimum supported polars version
from 0.20.0 to 1.20.0 and (re-)enables testing against 1.20.0, 1.33.1, and 1.42.1 in CI.

Changes

  • Increasing polars dependency floor from 0.20.0 to 1.20.0
  • CI/nox matrix tests polars versions: 1.20.0, 1.33.1, 1.42.1
  • Removing pre-1.0 handling e.g. get_lazyframe_* and calling collect_schema() directly
  • Adding a DeprecationWarning / @deprecated to Array(width=...) pointing users to use Array(shape=...)

Comments for reviewing

  • Version-specific handling is kept because:
    • polars changed its default decimal precision from 28 to 38 for polars >= 1.34.
    • pl.Series.unique() raises an InvalidOperationError for polars < 1.21.0 on Decimal columns. pandera.backends.polars.builtin_checks.unique_values_eq now uses pl.Series.to_list() instead of pl.Series.unique().
  • There is nearly no functional change for users on polars >= 1.20.0. The only user-facing change is a DeprecationWarning when Array(width=...) is used with a non-None width. I added a warning instead of dropping width to avoid breaking the user-facing API.

@fhoehle
fhoehle force-pushed the bugfix/2407 branch 2 times, most recently from 5d95f81 to 43b34d0 Compare July 17, 2026 11:22
@fhoehle fhoehle changed the title fix(polars): compatibility with polars 0.20.31 fix(polars): raise minimum polars version to 1.20.0 Jul 17, 2026
Drop the pre-1.0 compatibility code and update the CI/nox
matrix to 1.20.0, 1.33.1 and 1.42.1. Add a DeprecationWarning
for Array(width=...) pointing to shape=.

Closes unionai-oss#2407

Signed-off-by: fhoehle <fhoehle@users.noreply.github.com>
@codecov

codecov Bot commented Jul 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 91.23%. Comparing base (9d86aed) to head (c6c7dec).

Files with missing lines Patch % Lines
pandera/engines/polars_engine.py 85.71% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2412      +/-   ##
==========================================
+ Coverage   91.21%   91.23%   +0.02%     
==========================================
  Files         193      193              
  Lines       17135    17110      -25     
==========================================
- Hits        15629    15611      -18     
+ Misses       1506     1499       -7     
Flag Coverage Δ
unit-tests-base-Linux-py3.10 15.40% <0.00%> (+0.02%) ⬆️
unit-tests-base-Linux-py3.11 15.40% <0.00%> (+0.02%) ⬆️
unit-tests-base-Linux-py3.12 15.40% <0.00%> (+0.02%) ⬆️
unit-tests-base-Linux-py3.13 15.40% <0.00%> (+0.02%) ⬆️
unit-tests-base-Linux-py3.14 15.27% <0.00%> (+0.02%) ⬆️
unit-tests-base-Windows-py3.10 15.32% <0.00%> (+0.02%) ⬆️
unit-tests-base-Windows-py3.11 15.32% <0.00%> (+0.02%) ⬆️
unit-tests-base-Windows-py3.12 15.32% <0.00%> (+0.02%) ⬆️
unit-tests-base-Windows-py3.13 15.32% <0.00%> (+0.02%) ⬆️
unit-tests-base-Windows-py3.14 15.19% <0.00%> (+0.02%) ⬆️
unit-tests-base-macOS-py3.10 15.34% <0.00%> (+0.02%) ⬆️
unit-tests-base-macOS-py3.11 15.34% <0.00%> (+0.02%) ⬆️
unit-tests-base-macOS-py3.12 15.34% <0.00%> (+0.02%) ⬆️
unit-tests-base-macOS-py3.13 15.34% <0.00%> (+0.02%) ⬆️
unit-tests-base-macOS-py3.14 15.21% <0.00%> (+0.02%) ⬆️
unit-tests-dask-Linux-py3.10-pandas2.3.3-polars 24.27% <0.00%> (+0.03%) ⬆️
unit-tests-dask-Linux-py3.11-pandas2.3.3-polars 24.27% <0.00%> (+0.03%) ⬆️
unit-tests-dask-Linux-py3.12-pandas2.3.3-polars 24.27% <0.00%> (+0.03%) ⬆️
unit-tests-dask-Linux-py3.13-pandas2.3.3-polars 24.27% <0.00%> (+0.03%) ⬆️
unit-tests-dask-Linux-py3.14-pandas2.3.3-polars 24.18% <0.00%> (+0.03%) ⬆️
unit-tests-dask-Windows-py3.10-pandas2.3.3-polars 24.18% <0.00%> (+0.03%) ⬆️
unit-tests-dask-Windows-py3.11-pandas2.3.3-polars 24.18% <0.00%> (+0.03%) ⬆️
unit-tests-dask-Windows-py3.12-pandas2.3.3-polars 24.18% <0.00%> (+0.03%) ⬆️
unit-tests-dask-Windows-py3.13-pandas2.3.3-polars 24.18% <0.00%> (+0.03%) ⬆️
unit-tests-dask-Windows-py3.14-pandas2.3.3-polars 24.09% <0.00%> (+0.03%) ⬆️
unit-tests-dask-macOS-py3.10-pandas2.3.3-polars 24.21% <0.00%> (+0.03%) ⬆️
unit-tests-dask-macOS-py3.11-pandas2.3.3-polars 24.21% <0.00%> (+0.01%) ⬆️
unit-tests-fastapi-Linux-py3.11-pandas3.0.0-pydantic2.12.3 24.77% <0.00%> (+0.01%) ⬆️
unit-tests-fastapi-Linux-py3.13-pandas2.3.3-pydantic2.12.3 24.71% <0.00%> (+0.02%) ⬆️
unit-tests-fastapi-Linux-py3.14-pandas2.3.3-pydantic2.12.3 24.62% <0.00%> (+0.02%) ⬆️
unit-tests-fastapi-Linux-py3.14-pandas3.0.0-pydantic2.12.3 24.69% <0.00%> (+0.03%) ⬆️
unit-tests-geopandas-Linux-py3.10-pandas2.3.3-pydantic2.12.3 30.09% <0.00%> (+<0.01%) ⬆️
unit-tests-geopandas-Linux-py3.11-pandas3.0.0-pydantic2.12.3 30.09% <0.00%> (+0.04%) ⬆️
unit-tests-geopandas-Linux-py3.12-pandas3.0.0-pydantic2.12.3 30.09% <0.00%> (+0.04%) ⬆️
unit-tests-geopandas-Linux-py3.13-pandas3.0.0-pydantic2.12.3 30.09% <0.00%> (+<0.01%) ⬆️
unit-tests-hypotheses-Linux-py3.10-pandas2.3.3-pydantic2.12.3 22.51% <0.00%> (+0.04%) ⬆️
unit-tests-hypotheses-Linux-py3.11-pandas2.3.3-pydantic2.12.3 22.51% <0.00%> (+0.03%) ⬆️
unit-tests-hypotheses-Linux-py3.11-pandas3.0.0-pydantic2.12.3 22.55% <0.00%> (+0.03%) ⬆️
unit-tests-hypotheses-Linux-py3.13-pandas2.3.3-pydantic2.12.3 22.51% <0.00%> (+0.04%) ⬆️
unit-tests-hypotheses-Linux-py3.13-pandas3.0.0-pydantic2.12.3 22.55% <0.00%> (+0.01%) ⬆️
unit-tests-ibis-Linux-py3.10-pandas2.3.3-polars 28.92% <25.00%> (+0.07%) ⬆️
unit-tests-ibis-Linux-py3.11-pandas2.3.3-polars 28.92% <25.00%> (+0.07%) ⬆️
unit-tests-ibis-Linux-py3.12-pandas2.3.3-polars 28.92% <25.00%> (+0.07%) ⬆️
unit-tests-ibis-Linux-py3.13-pandas2.3.3-polars 28.92% <25.00%> (+0.07%) ⬆️
unit-tests-ibis-Linux-py3.14-pandas2.3.3-polars 28.73% <25.00%> (+0.07%) ⬆️
unit-tests-ibis-Windows-py3.10-pandas2.3.3-polars 28.85% <25.00%> (+0.07%) ⬆️
unit-tests-ibis-Windows-py3.11-pandas2.3.3-polars 28.85% <25.00%> (+0.07%) ⬆️
unit-tests-ibis-Windows-py3.12-pandas2.3.3-polars 28.85% <25.00%> (+0.07%) ⬆️
unit-tests-ibis-Windows-py3.13-pandas2.3.3-polars 28.85% <25.00%> (+0.07%) ⬆️
unit-tests-ibis-Windows-py3.14-pandas2.3.3-polars 28.66% <25.00%> (+0.06%) ⬆️
unit-tests-ibis-macOS-py3.10-pandas2.3.3-polars 28.86% <25.00%> (+0.07%) ⬆️
unit-tests-ibis-macOS-py3.11-pandas2.3.3-polars 28.86% <25.00%> (+0.07%) ⬆️
unit-tests-io-Linux-py3.11-pandas3.0.0-pydantic2.12.3 38.12% <30.00%> (+0.02%) ⬆️
unit-tests-io-Linux-py3.12-pandas2.3.3-pydantic2.12.3 38.15% <30.00%> (+0.01%) ⬆️
unit-tests-io-Linux-py3.12-pandas3.0.0-pydantic2.12.3 38.12% <30.00%> (+0.02%) ⬆️
unit-tests-io-Windows-py3.10-pandas2.3.3-pydantic2.12.3 37.75% <30.00%> (+0.02%) ⬆️
unit-tests-modin-ray-Linux-py3.10-pandas2.3.3-polars 30.69% <0.00%> (+0.04%) ⬆️
unit-tests-modin-ray-Linux-py3.11-pandas2.3.3-polars 30.69% <0.00%> (+0.04%) ⬆️
unit-tests-modin-ray-Linux-py3.12-pandas2.3.3-polars 30.69% <0.00%> (+0.04%) ⬆️
unit-tests-modin-ray-macOS-py3.10-pandas2.3.3-polars 30.63% <0.00%> (+0.01%) ⬆️
unit-tests-modin-ray-macOS-py3.11-pandas2.3.3-polars 30.63% <0.00%> (+0.01%) ⬆️
unit-tests-narwhals-Linux-py3.10 28.28% <30.00%> (+0.02%) ⬆️
unit-tests-narwhals-Linux-py3.11 28.28% <30.00%> (+0.02%) ⬆️
unit-tests-narwhals-Linux-py3.12 28.28% <30.00%> (+0.02%) ⬆️
unit-tests-narwhals-Linux-py3.13 28.28% <30.00%> (+0.02%) ⬆️
unit-tests-narwhals-Linux-py3.14 28.06% <30.00%> (+0.02%) ⬆️
unit-tests-narwhals-backend-ibis-py3.10 31.85% <25.00%> (+0.04%) ⬆️
unit-tests-narwhals-backend-ibis-py3.11 31.74% <25.00%> (+0.04%) ⬆️
unit-tests-narwhals-backend-ibis-py3.12 31.74% <25.00%> (+0.04%) ⬆️
unit-tests-narwhals-backend-ibis-py3.13 31.74% <25.00%> (+0.04%) ⬆️
unit-tests-narwhals-backend-ibis-py3.14 31.53% <25.00%> (+0.04%) ⬆️
unit-tests-narwhals-backend-polars-py3.10 34.42% <50.00%> (-0.06%) ⬇️
unit-tests-narwhals-backend-polars-py3.11 34.41% <50.00%> (-0.06%) ⬇️
unit-tests-narwhals-backend-polars-py3.12 34.41% <50.00%> (-0.06%) ⬇️
unit-tests-narwhals-backend-polars-py3.13 34.41% <50.00%> (-0.06%) ⬇️
unit-tests-narwhals-backend-polars-py3.14 34.27% <50.00%> (-0.06%) ⬇️
unit-tests-narwhals-backend-pyspark-py3.10 43.53% <25.00%> (+0.06%) ⬆️
unit-tests-narwhals-backend-pyspark-py3.11 43.56% <25.00%> (+0.06%) ⬆️
unit-tests-pandas-Linux-py3.10-pandas2.3.3-pydantic1.10.11 42.82% <0.00%> (+0.06%) ⬆️
unit-tests-pandas-Linux-py3.10-pandas2.3.3-pydantic2.12.3 42.98% <0.00%> (+0.06%) ⬆️
unit-tests-pandas-Linux-py3.11-pandas2.3.3-pydantic1.10.11 42.82% <0.00%> (+0.06%) ⬆️
unit-tests-pandas-Linux-py3.11-pandas2.3.3-pydantic2.12.3 42.98% <0.00%> (+0.06%) ⬆️
unit-tests-pandas-Linux-py3.11-pandas3.0.0-pydantic1.10.11 42.84% <0.00%> (+0.06%) ⬆️
unit-tests-pandas-Linux-py3.11-pandas3.0.0-pydantic2.12.3 42.99% <0.00%> (+0.06%) ⬆️
unit-tests-pandas-Linux-py3.12-pandas2.3.3-pydantic1.10.11 42.81% <0.00%> (+0.06%) ⬆️
unit-tests-pandas-Linux-py3.12-pandas2.3.3-pydantic2.12.3 42.97% <0.00%> (+0.06%) ⬆️
unit-tests-pandas-Linux-py3.12-pandas3.0.0-pydantic1.10.11 42.82% <0.00%> (+0.06%) ⬆️
unit-tests-pandas-Linux-py3.12-pandas3.0.0-pydantic2.12.3 42.98% <0.00%> (+0.06%) ⬆️
unit-tests-pandas-Linux-py3.13-pandas2.3.3-pydantic1.10.11 42.81% <0.00%> (+0.06%) ⬆️
unit-tests-pandas-Linux-py3.13-pandas2.3.3-pydantic2.12.3 42.97% <0.00%> (+0.06%) ⬆️
unit-tests-pandas-Linux-py3.13-pandas3.0.0-pydantic1.10.11 42.82% <0.00%> (+0.06%) ⬆️
unit-tests-pandas-Linux-py3.13-pandas3.0.0-pydantic2.12.3 42.98% <0.00%> (+0.06%) ⬆️
unit-tests-pandas-Linux-py3.14-pandas2.3.3-pydantic2.12.3 42.95% <0.00%> (+0.06%) ⬆️
unit-tests-pandas-Linux-py3.14-pandas3.0.0-pydantic2.12.3 42.96% <0.00%> (+0.06%) ⬆️
unit-tests-pandas-Windows-py3.10-pandas2.3.3-pydantic1.10.11 42.74% <0.00%> (+0.06%) ⬆️
unit-tests-pandas-Windows-py3.10-pandas2.3.3-pydantic2.12.3 42.89% <0.00%> (+0.06%) ⬆️
unit-tests-pandas-Windows-py3.11-pandas2.3.3-pydantic1.10.11 42.74% <0.00%> (+0.06%) ⬆️
unit-tests-pandas-Windows-py3.11-pandas2.3.3-pydantic2.12.3 42.89% <0.00%> (+0.06%) ⬆️
unit-tests-pandas-Windows-py3.11-pandas3.0.0-pydantic1.10.11 42.75% <0.00%> (+0.06%) ⬆️
unit-tests-pandas-Windows-py3.11-pandas3.0.0-pydantic2.12.3 42.91% <0.00%> (+0.06%) ⬆️
unit-tests-pandas-Windows-py3.12-pandas2.3.3-pydantic1.10.11 42.72% <0.00%> (+0.06%) ⬆️
unit-tests-pandas-Windows-py3.12-pandas2.3.3-pydantic2.12.3 42.88% <0.00%> (+0.06%) ⬆️
unit-tests-pandas-Windows-py3.12-pandas3.0.0-pydantic1.10.11 42.74% <0.00%> (+0.06%) ⬆️
unit-tests-pandas-Windows-py3.12-pandas3.0.0-pydantic2.12.3 42.89% <0.00%> (+0.06%) ⬆️
unit-tests-pandas-Windows-py3.13-pandas2.3.3-pydantic1.10.11 42.72% <0.00%> (+0.06%) ⬆️
unit-tests-pandas-Windows-py3.13-pandas2.3.3-pydantic2.12.3 42.88% <0.00%> (+0.06%) ⬆️
unit-tests-pandas-Windows-py3.13-pandas3.0.0-pydantic1.10.11 42.74% <0.00%> (+0.06%) ⬆️
unit-tests-pandas-Windows-py3.13-pandas3.0.0-pydantic2.12.3 42.89% <0.00%> (+0.06%) ⬆️
unit-tests-pandas-Windows-py3.14-pandas2.3.3-pydantic2.12.3 42.86% <0.00%> (+0.06%) ⬆️
unit-tests-pandas-Windows-py3.14-pandas3.0.0-pydantic2.12.3 42.88% <0.00%> (+0.06%) ⬆️
unit-tests-pandas-macOS-py3.10-pandas2.3.3-pydantic1.10.11 42.76% <0.00%> (+0.06%) ⬆️
unit-tests-pandas-macOS-py3.10-pandas2.3.3-pydantic2.12.3 42.92% <0.00%> (+0.06%) ⬆️
unit-tests-pandas-macOS-py3.11-pandas2.3.3-pydantic1.10.11 42.76% <0.00%> (+0.06%) ⬆️
unit-tests-pandas-macOS-py3.11-pandas2.3.3-pydantic2.12.3 42.92% <0.00%> (+0.06%) ⬆️
unit-tests-pandas-macOS-py3.11-pandas3.0.0-pydantic1.10.11 42.77% <0.00%> (+0.06%) ⬆️
unit-tests-pandas-macOS-py3.11-pandas3.0.0-pydantic2.12.3 42.93% <0.00%> (+0.06%) ⬆️
unit-tests-pandas-macOS-py3.12-pandas2.3.3-pydantic1.10.11 42.75% <0.00%> (+0.06%) ⬆️
unit-tests-pandas-macOS-py3.12-pandas2.3.3-pydantic2.12.3 42.91% <0.00%> (+0.06%) ⬆️
unit-tests-pandas-macOS-py3.12-pandas3.0.0-pydantic1.10.11 42.76% <0.00%> (+0.06%) ⬆️
unit-tests-pandas-macOS-py3.12-pandas3.0.0-pydantic2.12.3 42.92% <0.00%> (+0.06%) ⬆️
unit-tests-pandas-macOS-py3.13-pandas2.3.3-pydantic1.10.11 42.75% <0.00%> (+0.06%) ⬆️
unit-tests-pandas-macOS-py3.13-pandas2.3.3-pydantic2.12.3 42.91% <0.00%> (+0.06%) ⬆️
unit-tests-pandas-macOS-py3.13-pandas3.0.0-pydantic1.10.11 42.76% <0.00%> (+0.06%) ⬆️
unit-tests-pandas-macOS-py3.13-pandas3.0.0-pydantic2.12.3 42.92% <0.00%> (+0.06%) ⬆️
unit-tests-pandas-macOS-py3.14-pandas2.3.3-pydantic2.12.3 42.89% <0.00%> (+0.06%) ⬆️
unit-tests-pandas-macOS-py3.14-pandas3.0.0-pydantic2.12.3 42.90% <0.00%> (+0.06%) ⬆️
unit-tests-polars-Linux-py3.10-pandas2.3.3-polars1.20.0 31.02% <90.00%> (?)
unit-tests-polars-Linux-py3.11-pandas2.3.3-polars1.20.0 31.01% <90.00%> (?)
unit-tests-polars-Linux-py3.12-pandas2.3.3-polars1.33.1 31.01% <90.00%> (-0.06%) ⬇️
unit-tests-polars-Linux-py3.13-pandas2.3.3-polars1.33.1 31.01% <90.00%> (-0.06%) ⬇️
unit-tests-polars-Linux-py3.14-pandas2.3.3-polars1.42.1 30.89% <90.00%> (?)
unit-tests-polars-Windows-py3.10-pandas2.3.3-polars1.20.0 30.95% <90.00%> (?)
unit-tests-polars-Windows-py3.11-pandas2.3.3-polars1.20.0 30.94% <90.00%> (?)
unit-tests-polars-Windows-py3.12-pandas2.3.3-polars1.33.1 30.94% <90.00%> (-0.06%) ⬇️
unit-tests-polars-Windows-py3.13-pandas2.3.3-polars1.33.1 30.94% <90.00%> (-0.06%) ⬇️
unit-tests-polars-Windows-py3.14-pandas2.3.3-polars1.42.1 30.81% <90.00%> (?)
unit-tests-polars-macOS-py3.10-pandas2.3.3-polars1.20.0 30.96% <90.00%> (?)
unit-tests-polars-macOS-py3.11-pandas2.3.3-polars1.20.0 30.95% <90.00%> (?)
unit-tests-strategies-Linux-py3.10-pandas2.3.3-pydantic2.12.3 34.20% <0.00%> (+0.01%) ⬆️
unit-tests-strategies-Linux-py3.12-pandas2.3.3-pydantic2.12.3 34.20% <0.00%> (+0.01%) ⬆️
unit-tests-xarray-Linux-py3.10-pandas2.3.3-polars 31.77% <0.00%> (+0.04%) ⬆️
unit-tests-xarray-Linux-py3.11-pandas2.3.3-polars 31.77% <0.00%> (+0.04%) ⬆️
unit-tests-xarray-Linux-py3.12-pandas2.3.3-polars 31.77% <0.00%> (+0.04%) ⬆️
unit-tests-xarray-Linux-py3.13-pandas2.3.3-polars 31.77% <0.00%> (+0.04%) ⬆️
unit-tests-xarray-Linux-py3.14-pandas2.3.3-polars 31.70% <0.00%> (+0.04%) ⬆️
unit-tests-xarray-Windows-py3.10-pandas2.3.3-polars 31.70% <0.00%> (+0.04%) ⬆️
unit-tests-xarray-Windows-py3.11-pandas2.3.3-polars 31.70% <0.00%> (+0.04%) ⬆️
unit-tests-xarray-Windows-py3.12-pandas2.3.3-polars 31.70% <0.00%> (+0.04%) ⬆️
unit-tests-xarray-Windows-py3.13-pandas2.3.3-polars 31.70% <0.00%> (+0.04%) ⬆️
unit-tests-xarray-Windows-py3.14-pandas2.3.3-polars 31.63% <0.00%> (+0.04%) ⬆️
unit-tests-xarray-macOS-py3.10-pandas2.3.3-polars 31.71% <0.00%> (+0.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@fhoehle

fhoehle commented Jul 22, 2026

Copy link
Copy Markdown
Author

@cosmicBboy, the failing check, Unit Tests DataFrame Extras: python-3.11 macos-latest (extra-pyspark ...), appears to be orthogonal to the changes here. The failure is a Spark JVM resource error on the macOS runner (OutOfMemoryError: unable to create native thread) in the pyspark suite.

Past runs on unrelated branches show the same job failing the same way (29499846387, 29466166130, 29454466833), so I guess the failure is unrelated and not anything introduced here.
I hope a retry could resolve the issue.

@cosmicBboy

Copy link
Copy Markdown
Collaborator

@fhoehle that test should be fixed on main, would you mind rebasing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pandera[polars] 0.32.1 fails to import using polars=0.20

2 participants