Skip to content

Commit dbc7ecf

Browse files
authored
Revert "fix: Use importlib for polars version (#2952)", xfail map_batches test for now (#2996)
* Revert "fix: Use `importlib` for `polars` version (#2952)" This reverts commit bb740d2. * xfail test * comment out pyarrow nightly * nightly
1 parent ba1da16 commit dbc7ecf

File tree

4 files changed

+14
-11
lines changed

4 files changed

+14
-11
lines changed

.github/workflows/extremes.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,10 @@ jobs:
152152
uv pip install pandas --pre --index https://pypi.anaconda.org/scientific-python-nightly-wheels/simple --system -U
153153
- name: install pyarrow nightly
154154
run: |
155-
uv pip uninstall pyarrow --system
156-
uv pip install pyarrow --pre --index https://pypi.fury.io/arrow-nightlies/ --system -U
155+
# commented out nightly whilst it fails to install
156+
uv pip install -U pyarrow --system
157+
# uv pip uninstall pyarrow --system
158+
# uv pip install pyarrow --pre --index https://pypi.fury.io/arrow-nightlies/ --system -U
157159
- name: install numpy nightly
158160
run: |
159161
uv pip uninstall numpy --system
@@ -172,7 +174,7 @@ jobs:
172174
run: |
173175
DEPS=$(uv pip freeze)
174176
echo "$DEPS" | grep 'pandas.*dev'
175-
echo "$DEPS" | grep 'pyarrow.*dev'
177+
# echo "$DEPS" | grep 'pyarrow.*dev'
176178
echo "$DEPS" | grep 'numpy.*dev'
177179
echo "$DEPS" | grep 'dask.*@'
178180
- name: Run pytest

narwhals/_utils.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -603,11 +603,7 @@ def backend_version(implementation: Implementation, /) -> tuple[int, ...]:
603603
impl = implementation
604604
module_name = _IMPLEMENTATION_TO_MODULE_NAME.get(impl, impl.value)
605605
native_namespace = _import_native_namespace(module_name)
606-
if impl.is_polars():
607-
from importlib import metadata
608-
609-
into_version = metadata.version("polars")
610-
elif impl.is_sqlframe():
606+
if impl.is_sqlframe():
611607
import sqlframe._version
612608

613609
into_version = sqlframe._version

tests/expr_and_series/map_batches_test.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
from __future__ import annotations
22

3+
import pytest
4+
35
import narwhals as nw
46
from tests.utils import ConstructorEager, assert_equal_data
57

@@ -12,7 +14,12 @@ def test_map_batches_expr(constructor_eager: ConstructorEager) -> None:
1214
assert_equal_data(expected, {"a": [2, 3, 4], "b": [5, 6, 7]})
1315

1416

15-
def test_map_batches_expr_numpy(constructor_eager: ConstructorEager) -> None:
17+
def test_map_batches_expr_numpy(
18+
constructor_eager: ConstructorEager, request: pytest.FixtureRequest
19+
) -> None:
20+
if "polars" in str(constructor_eager):
21+
# https://github.com/narwhals-dev/narwhals/issues/2995
22+
request.applymarker(pytest.mark.xfail(strict=False))
1623
df = nw.from_native(constructor_eager(data))
1724
expected = df.select(
1825
nw.col("a")

tests/utils.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@
2525

2626
def get_module_version_as_tuple(module_name: str) -> tuple[int, ...]:
2727
try:
28-
if module_name == "polars":
29-
return Implementation.POLARS._backend_version()
3028
return parse_version(__import__(module_name).__version__)
3129
except ImportError:
3230
return (0, 0, 0)

0 commit comments

Comments
 (0)