Skip to content

Commit d484ded

Browse files
committed
Resolve noxfile.py conflict: Add polars version parametrization
- Add POLARS_VERSIONS = ["0.20.0", "1.32.2"] constant - Update _testing_requirements to accept polars parameter - Modify polars handling to use parametrized version: polars=={polars} - Rename EXTRA_PYTHON_PYDANTIC to EXTRA_PYTHON_PYDANTIC_POLARS - Add polars-specific test parametrization for multiple polars versions - Update tests function signature to include polars parameter This resolves the merge conflict with upstream/main regarding polars version handling and testing parametrization. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> Signed-off-by: Shuntaro Takahashi <[email protected]>
1 parent 4a8504d commit d484ded

File tree

1 file changed

+22
-11
lines changed

1 file changed

+22
-11
lines changed

noxfile.py

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
PYTHON_VERSIONS = ["3.9", "3.10", "3.11", "3.12", "3.13"]
2424
PANDAS_VERSIONS = ["2.1.1", "2.2.3"]
2525
PYDANTIC_VERSIONS = ["1.10.11", "2.10.6"]
26+
POLARS_VERSIONS = ["0.20.0", "1.32.2"]
2627
PACKAGE = "pandera"
2728
SOURCE_PATHS = PACKAGE, "tests", "noxfile.py"
2829
REQUIREMENT_PATH = "requirements.txt"
@@ -117,10 +118,12 @@ def _testing_requirements(
117118
extra: Optional[str] = None,
118119
pandas: Optional[str] = None,
119120
pydantic: Optional[str] = None,
121+
polars: Optional[str] = None,
120122
) -> list[str]:
121123

122124
pandas = pandas or PANDAS_VERSIONS[-1]
123125
pydantic = pydantic or PYDANTIC_VERSIONS[-1]
126+
polars = polars or POLARS_VERSIONS[-1]
124127

125128
_requirements = PYPROJECT["project"]["dependencies"]
126129
if extra is not None:
@@ -155,12 +158,11 @@ def _testing_requirements(
155158
req = "pyarrow >= 13"
156159
if req == "ibis-framework" or req.startswith("ibis-framework "):
157160
req = "ibis-framework[duckdb,polars]"
158-
if req == "polars" or req.startswith("polars "):
159-
# TODO(deepyaman): Support latest Polars.
160-
req = "polars < 1.30.0"
161+
if req == "polars":
162+
req = f"polars=={polars}"
161163
if sys.platform == "darwin":
162164
# On macOS, add polars-lts-cpu in addition to polars (which tends to get pulled in as a transitive dependency)
163-
_updated_requirements.append("polars-lts-cpu < 1.30.0")
165+
_updated_requirements.append(f"polars-lts-cpu=={polars}")
164166

165167
# for some reason uv will try to install an old version of dask,
166168
# have to specifically pin dask[dataframe] to a higher version
@@ -179,38 +181,47 @@ def _testing_requirements(
179181

180182

181183
# the base module with no extras
182-
EXTRA_PYTHON_PYDANTIC = [(None, None, None)]
184+
EXTRA_PYTHON_PYDANTIC_POLARS = [(None, None, None, None)]
183185
for extra in OPTIONAL_DEPENDENCIES:
184186
if extra == "pandas":
185187
# Only test upper and lower bounds of pandas and pydantic with the
186188
# pandas extra. The other dataframe library intregations assume either
187189
# no pandas version, latest supported pandas version, and latest
188190
# pydantic version. None of the other dataframe libraries use the
189191
# pydantic integration.
190-
EXTRA_PYTHON_PYDANTIC.extend(
192+
EXTRA_PYTHON_PYDANTIC_POLARS.extend(
191193
[
192-
(extra, pandas, pydantic)
194+
(extra, pandas, pydantic, None)
193195
for pandas in PANDAS_VERSIONS
194196
for pydantic in PYDANTIC_VERSIONS
195197
]
196198
)
199+
elif extra == "polars":
200+
# Test with multiple polars versions
201+
EXTRA_PYTHON_PYDANTIC_POLARS.extend(
202+
[
203+
(extra, None, PYDANTIC_VERSIONS[-1], polars)
204+
for polars in POLARS_VERSIONS
205+
]
206+
)
197207
else:
198-
EXTRA_PYTHON_PYDANTIC.append(
199-
(extra, PANDAS_VERSIONS[-1], PYDANTIC_VERSIONS[-1])
208+
EXTRA_PYTHON_PYDANTIC_POLARS.append(
209+
(extra, PANDAS_VERSIONS[-1], PYDANTIC_VERSIONS[-1], None)
200210
)
201211

202212

203213
@nox.session(venv_backend="uv", python=PYTHON_VERSIONS)
204-
@nox.parametrize("extra, pandas, pydantic", EXTRA_PYTHON_PYDANTIC)
214+
@nox.parametrize("extra, pandas, pydantic, polars", EXTRA_PYTHON_PYDANTIC_POLARS)
205215
def tests(
206216
session: Session,
207217
extra: Optional[str] = None,
208218
pandas: Optional[str] = None,
209219
pydantic: Optional[str] = None,
220+
polars: Optional[str] = None,
210221
) -> None:
211222
"""Run the test suite."""
212223

213-
requirements = _testing_requirements(session, extra, pandas, pydantic)
224+
requirements = _testing_requirements(session, extra, pandas, pydantic, polars)
214225
session.install(*requirements)
215226
session.install("-e", ".", "--config-settings", "editable_mode=compat")
216227
session.run("uv", "pip", "list")

0 commit comments

Comments
 (0)