Skip to content

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

Description

@fhoehle

Describe the bug
The pandera extra polars does allow versions beginning with >= 0.20.0 see pyproject.toml of the latest release 0.32.1. Unfortunately, an import of pandera/engines/polars_engine.py raises a ModuleNotFoundError: No module named 'polars._typing' error for polars=0.20.*.

  • I have checked that this issue has not already been reported.
  • I have confirmed this bug exists on the latest version of pandera.
  • (optional) I have confirmed this bug exists on the main branch of pandera.

Note: Please read this guide detailing how to provide the necessary information for us to reproduce your bug.

Code Sample, a copy-pastable example

# Environment: pandera[polars]==0.32.1, polars==0.20.31
import pandera.polars  # raises before we even define a schema

Traceback:

File ".../pandera/polars.py", line 10, in <module>
    from pandera.api.polars.components import Column
File ".../pandera/api/polars/components.py", line 15, in <module>
    from pandera.engines import polars_engine
File ".../pandera/engines/polars_engine.py", line 23, in <module>
    from polars._typing import ColumnNameOrSelector, PythonDataType
ModuleNotFoundError: No module named 'polars._typing'

Expected behavior

There should be no ModuleNotFoundError error.

Desktop (please complete the following information):

OS: macOS (Darwin 25.5.0, arm64)
Python: 3.12
pandera version: 0.32.1 (from PyPI)
polars version: 0.20.31

Comment

The polars._typing submodule was removed with polars>=1. If polars<1 should be still supported I'm open to submit a PR fixing this bug. My personal opinion would be to keep polars=0.20.* available for some time to ease migrations.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions