Skip to content

Commit

Permalink
chore(python): remove dataframe consortium standard api entrypoint (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoGorelli committed Feb 5, 2024
1 parent 846e62d commit ec1c7eb
Show file tree
Hide file tree
Showing 7 changed files with 1 addition and 81 deletions.
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.

0 comments on commit ec1c7eb

Please sign in to comment.