Deprecation related to Polars 1.32's new Categorical/Enum implementation
When running import pandera.polars as pa with polars 1.32 installed, the below deprecation warning is raised:
import pandera.polars as pa
..\.venv\Lib\site-packages\pandera\polars.py:11: in <module>
from pandera.api.polars.components import Column
..\.venv\Lib\site-packages\pandera\api\polars\components.py:15: in <module>
from pandera.engines import polars_engine
..\.venv\Lib\site-packages\pandera\engines\polars_engine.py:730: in <module>
@Engine.register_dtype(equivalents=[pl.Categorical])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
..\.venv\Lib\site-packages\pandera\engines\engine.py:217: in _wrapper
cls._register_equivalents(pandera_dtype_cls, *equivalents)
..\.venv\Lib\site-packages\pandera\engines\engine.py:160: in _register_equivalents
pandera_dtype = pandera_dtype_cls() # type: ignore
^^^^^^^^^^^^^^^^^^^
..\.venv\Lib\site-packages\pandera\engines\polars_engine.py:744: in __init__
object.__setattr__(self, "type", pl.Categorical(ordering=ordering))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
..\.venv\Lib\site-packages\polars\datatypes\classes.py:796: in __init__
issue_deprecation_warning(
..\.venv\Lib\site-packages\polars\_utils\deprecation.py:61: in issue_deprecation_warning
issue_warning(message, DeprecationWarning)
..\.venv\Lib\site-packages\polars\_utils\various.py:494: in issue_warning
warnings.warn(
E DeprecationWarning: the physical Categorical ordering is deprecated. The ordering is now always lexical.
E (Deprecated in version 1.32.0)
This is related to https://github.com/pola-rs/polars/pull/23016.
- [x] I have checked that this issue has not already been reported.
- [x] I have confirmed this bug exists on the latest version of pandera.
- [x] (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
# pip install "polars>=1.32" --upgrade
import pandera.polars as pa
Expected behavior
The import should succeed without deprecations.
Bump! Just hit this while attempting to author a unit test for @beartype's pandera.polars support over at beartype/beartype#557, @cosmicBboy. It's not a super-big deal at the moment, because unit test warnings are easily ignorable. Still, it's... kinda concerning.
This will definitely rupture and implode at some point. And @beartype doesn't want to be standing there when the fireworks start. 😅