Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(python): remove dataframe consortium standard api entrypoint #14279

Merged
merged 1 commit into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions py-polars/polars/dataframe/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
_check_for_numpy,
_check_for_pandas,
_check_for_pyarrow,
dataframe_api_compat,
hvplot,
import_optional,
)
Expand Down Expand Up @@ -1357,19 +1356,6 @@ def __dataframe__(

return PolarsDataFrame(self, allow_copy=allow_copy)

def __dataframe_consortium_standard__(
self, *, api_version: str | None = None
) -> Any:
"""
Provide entry point to the Consortium DataFrame Standard API.

This is developed and maintained outside of polars.
Please report any issues to https://github.com/data-apis/dataframe-api-compat.
"""
return dataframe_api_compat.polars_standard.convert_to_standard_compliant_dataframe(
self.lazy(), api_version=api_version
)

def _comp(self, other: Any, op: ComparisonOperator) -> DataFrame:
"""Compare a DataFrame with another object."""
if isinstance(other, DataFrame):
Expand Down
6 changes: 0 additions & 6 deletions py-polars/polars/dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from types import ModuleType
from typing import TYPE_CHECKING, Any, ClassVar, Hashable, cast

_DATAFRAME_API_COMPAT_AVAILABLE = True
_DELTALAKE_AVAILABLE = True
_FSSPEC_AVAILABLE = True
_GEVENT_AVAILABLE = True
Expand Down Expand Up @@ -150,7 +149,6 @@ def _lazy_import(module_name: str) -> tuple[ModuleType, bool]:
import pickle
import subprocess

import dataframe_api_compat
import deltalake
import fsspec
import gevent
Expand All @@ -175,9 +173,6 @@ def _lazy_import(module_name: str) -> tuple[ModuleType, bool]:
subprocess, _ = _lazy_import("subprocess")

# heavy/optional third party libs
dataframe_api_compat, _DATAFRAME_API_COMPAT_AVAILABLE = _lazy_import(
"dataframe_api_compat"
)
deltalake, _DELTALAKE_AVAILABLE = _lazy_import("deltalake")
fsspec, _FSSPEC_AVAILABLE = _lazy_import("fsspec")
hvplot, _HVPLOT_AVAILABLE = _lazy_import("hvplot")
Expand Down Expand Up @@ -281,7 +276,6 @@ def import_optional(
"pickle",
"subprocess",
# lazy-load third party libs
"dataframe_api_compat",
"deltalake",
"fsspec",
"gevent",
Expand Down
15 changes: 1 addition & 14 deletions py-polars/polars/lazyframe/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
is_polars_dtype,
py_type_to_dtype,
)
from polars.dependencies import dataframe_api_compat, subprocess
from polars.dependencies import subprocess
from polars.io._utils import _is_local_file, _is_supported_cloud
from polars.io.csv._utils import _check_arg_is_1byte
from polars.io.ipc.anonymous_scan import _scan_ipc_fsspec
Expand Down Expand Up @@ -693,19 +693,6 @@ def schema(self) -> OrderedDict[str, DataType]:
"""
return OrderedDict(self._ldf.schema())

def __dataframe_consortium_standard__(
self, *, api_version: str | None = None
) -> Any:
"""
Provide entry point to the Consortium DataFrame Standard API.

This is developed and maintained outside of polars.
Please report any issues to https://github.com/data-apis/dataframe-api-compat.
"""
return dataframe_api_compat.polars_standard.convert_to_standard_compliant_dataframe(
self, api_version=api_version
)

@property
def width(self) -> int:
"""
Expand Down
14 changes: 0 additions & 14 deletions py-polars/polars/series/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
_check_for_numpy,
_check_for_pandas,
_check_for_pyarrow,
dataframe_api_compat,
hvplot,
)
from polars.dependencies import numpy as np
Expand Down Expand Up @@ -1486,19 +1485,6 @@ def __array_ufunc__(
)
raise NotImplementedError(msg)

def __column_consortium_standard__(self, *, api_version: str | None = None) -> Any:
"""
Provide entry point to the Consortium DataFrame Standard API.

This is developed and maintained outside of polars.
Please report any issues to https://github.com/data-apis/dataframe-api-compat.
"""
return (
dataframe_api_compat.polars_standard.convert_to_standard_compliant_column(
self, api_version=api_version
)
)

def _repr_html_(self) -> str:
"""Format output data in HTML for display in Jupyter Notebooks."""
return self.to_frame()._repr_html_(from_series=True)
Expand Down
1 change: 0 additions & 1 deletion py-polars/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ ignore_missing_imports = true
module = [
"IPython.*",
"matplotlib.*",
"dataframe_api_compat.*",
]
follow_imports = "skip"

Expand Down
2 changes: 0 additions & 2 deletions py-polars/requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ pyxlsb
xlsx2csv
XlsxWriter
deltalake>=0.14.0
# Dataframe interchange protocol
dataframe-api-compat>=0.1.6
pyiceberg>=0.5.0
# Csv
zstandard
Expand Down
30 changes: 0 additions & 30 deletions py-polars/tests/unit/test_consortium_standard.py

This file was deleted.

Loading