Skip to content

Commit

Permalink
fixup modin version
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoGorelli committed Jan 5, 2025
1 parent b008021 commit f72bb4b
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
10 changes: 5 additions & 5 deletions narwhals/dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,16 +87,16 @@ def get_duckdb() -> Any:
return sys.modules.get("duckdb", None)


def get_dask_expr() -> Any:
"""Get dask_expr module (if already imported - else return None)."""
return sys.modules.get("dask_expr", None)


def get_ibis() -> Any:
"""Get ibis module (if already imported - else return None)."""
return sys.modules.get("ibis", None)


def get_dask_expr() -> Any:
"""Get dask_expr module (if already imported - else return None)."""
return sys.modules.get("dask_expr", None)


def get_pyspark() -> Any: # pragma: no cover
"""Get pyspark module (if already imported - else return None)."""
return sys.modules.get("pyspark", None)
Expand Down
10 changes: 6 additions & 4 deletions narwhals/translate.py
Original file line number Diff line number Diff line change
Expand Up @@ -559,9 +559,10 @@ def _from_native_impl( # noqa: PLR0915

# Modin
elif is_modin_dataframe(native_object): # pragma: no cover
import modin # ignore-banned-import

from narwhals._pandas_like.dataframe import PandasLikeDataFrame

mpd = get_modin()
if series_only:
if not pass_through:
msg = "Cannot only use `series_only` with modin.DataFrame"
Expand All @@ -571,15 +572,16 @@ def _from_native_impl( # noqa: PLR0915
PandasLikeDataFrame(
native_object,
implementation=Implementation.MODIN,
backend_version=parse_version(mpd.__version__),
backend_version=parse_version(modin.__version__),
version=version,
),
level="full",
)
elif is_modin_series(native_object): # pragma: no cover
import modin # ignore-banned-import

from narwhals._pandas_like.series import PandasLikeSeries

mpd = get_modin()
if not allow_series:
if not pass_through:
msg = "Please set `allow_series=True` or `series_only=True`"
Expand All @@ -589,7 +591,7 @@ def _from_native_impl( # noqa: PLR0915
PandasLikeSeries(
native_object,
implementation=Implementation.MODIN,
backend_version=parse_version(mpd.__version__),
backend_version=parse_version(modin.__version__),
version=version,
),
level="full",
Expand Down
4 changes: 3 additions & 1 deletion narwhals/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from narwhals.dependencies import get_cudf
from narwhals.dependencies import get_dask_dataframe
from narwhals.dependencies import get_duckdb
from narwhals.dependencies import get_ibis
from narwhals.dependencies import get_modin
from narwhals.dependencies import get_pandas
from narwhals.dependencies import get_polars
Expand Down Expand Up @@ -103,6 +104,7 @@ def from_native_namespace(
get_polars(): Implementation.POLARS,
get_dask_dataframe(): Implementation.DASK,
get_duckdb(): Implementation.DUCKDB,
get_ibis(): Implementation.IBIS,
}
return mapping.get(native_namespace, Implementation.UNKNOWN)

Expand Down Expand Up @@ -254,7 +256,7 @@ def is_dask(self) -> bool:

MIN_VERSIONS: dict[Implementation, tuple[int, ...]] = {
Implementation.PANDAS: (0, 25, 3),
Implementation.MODIN: (0, 25, 3),
Implementation.MODIN: (0, 32),
Implementation.CUDF: (24, 10),
Implementation.PYARROW: (11,),
Implementation.PYSPARK: (3, 3),
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ classifiers = [
[project.optional-dependencies]
# these should be aligned with MIN_VERSIONS in narwhals/utils.py
pandas = ["pandas>=0.25.3"]
modin = ["modin>=0.25.3"]
modin = ["modin>=0.32"]
cudf = ["cudf>=24.10.0"]
pyarrow = ["pyarrow>=11.0.0"]
pyspark = ["pyspark>=3.3.0"]
Expand Down

0 comments on commit f72bb4b

Please sign in to comment.