Skip to content

Commit bdabbc1

Browse files
committed
Scope DataFrameLike claims to tested backends
Remove cuDF/Modin name-drops from the docstring, error message and tests. They are reachable through Narwhals like any other backend but are not exercised here (no GPU; Modin's pinned deps conflict), so naming them as features overclaims. The validation path is described generically as "any Narwhals-supported backend" with pandas, Polars and PyArrow as the tested set. Drops the permanently-skipped Modin test.
1 parent dad6d84 commit bdabbc1

2 files changed

Lines changed: 7 additions & 29 deletions

File tree

param/parameters.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3527,13 +3527,11 @@ class DataFrameLike(ClassSelector[t.Any]):
35273527
Unlike :class:`DataFrame`, which is restricted to ``pandas.DataFrame``,
35283528
``DataFrameLike`` accepts any object supported by
35293529
`Narwhals <https://narwhals-dev.github.io>`_. pandas, Polars and PyArrow
3530-
are exercised in this project's test suite; Modin and cuDF are supported
3531-
through the same Narwhals code path but are not run in CI (Modin's pinned
3532-
dependencies conflict with the test environment and cuDF is GPU-only).
3533-
The value is passed through unchanged, so reading the parameter returns
3534-
the original native object (no Narwhals wrapper). Authors who want a
3535-
backend-agnostic API can call ``narwhals.from_native`` on the value
3536-
themselves.
3530+
are exercised in this project's test suite; any other Narwhals-supported
3531+
backend uses the identical code path. The value is passed through
3532+
unchanged, so reading the parameter returns the original native object
3533+
(no Narwhals wrapper). Authors who want a backend-agnostic API can call
3534+
``narwhals.from_native`` on the value themselves.
35373535
35383536
Narwhals is an optional dependency, imported on instantiation; a clear
35393537
``ImportError`` with the install command is raised if it is missing. The
@@ -3652,8 +3650,8 @@ def _as_narwhals(self, val):
36523650
kind = 'a dataframe-like' if self.allow_lazy else 'an eager dataframe-like'
36533651
raise ValueError(
36543652
f"{_validate_error_prefix(self)} value must be {kind} object "
3655-
f"that Narwhals recognises (pandas, Polars, PyArrow, cuDF, "
3656-
f"Modin), not {type(val).__name__!r}."
3653+
f"that Narwhals recognises (pandas, Polars, PyArrow, ...), "
3654+
f"not {type(val).__name__!r}."
36573655
) from e
36583656

36593657
def _validate(self, val):

tests/testdataframelike.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,9 @@
3030
except ModuleNotFoundError:
3131
pa = None
3232

33-
try:
34-
import modin.pandas as mpd
35-
except Exception:
36-
# modin import can fail for reasons beyond ModuleNotFoundError (missing
37-
# execution engine), so guard broadly and skip rather than error.
38-
mpd = None
39-
4033
skip_no_pandas = pytest.mark.skipif(pd is None, reason="pandas not available")
4134
skip_no_polars = pytest.mark.skipif(pl is None, reason="polars not available")
4235
skip_no_pyarrow = pytest.mark.skipif(pa is None, reason="pyarrow not available")
43-
skip_no_modin = pytest.mark.skipif(mpd is None, reason="modin not available")
4436

4537

4638
class TestDataFrameLikeDefaults(unittest.TestCase):
@@ -85,18 +77,6 @@ class P(param.Parameterized):
8577
src = pa.table({'a': [1, 2]})
8678
self.assertIs(P(df=src).df, src)
8779

88-
@skip_no_modin
89-
def test_modin(self):
90-
class P(param.Parameterized):
91-
df = param.DataFrameLike(
92-
default=pd.DataFrame({'a': [1]}), rows=2, columns={'a'})
93-
src = mpd.DataFrame({'a': [1, 2]})
94-
p = P(df=src)
95-
self.assertIs(p.df, src)
96-
self.assertIsInstance(p.df, mpd.DataFrame)
97-
with self.assertRaises(ValueError):
98-
P(df=mpd.DataFrame({'a': [1]})) # rows=2 mismatch
99-
10080

10181
@skip_no_pandas
10282
class TestDataFrameLikeRejects(unittest.TestCase):

0 commit comments

Comments
 (0)