-
Notifications
You must be signed in to change notification settings - Fork 206
chore: Isolate interchange-level support #3721
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
Open
dangotbanned
wants to merge
45
commits into
chore/issue-2932-rm-level
Choose a base branch
from
chore/issue-2932-rm-level-break
base: chore/issue-2932-rm-level
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
45 commits
Select commit
Hold shift + click to select a range
e745e37
chore!: Remove interchange (temporary)
dangotbanned 4940eb3
chore: Reintroduce (limited) interchange support
dangotbanned 3288b0d
grow up mypy
dangotbanned ce86e5c
test: fix invalid test
dangotbanned 60068f0
test: isolate `test_invalid_filter`
dangotbanned 3cfb767
chore: reintroduce `ibis`
dangotbanned 6ba4d66
fix: remember that `duckdb` doesn't support interchange
dangotbanned 902796a
fix: add compat alias for marimo
dangotbanned b7e533d
ignore mypy
dangotbanned 4e9f986
Merge branch 'chore/issue-2932-rm-level' into chore/issue-2932-rm-lev…
dangotbanned 3ceb3e0
test: add `tests.interchange`
dangotbanned ecfc247
test: migrate `get_level` tests
dangotbanned 545e9a3
test: migrate `from_native` tests
dangotbanned fc21485
test: migrate `interchange_*` test modules
dangotbanned af940e6
docs: add a package doc
dangotbanned 68506ea
fix: Don't require `eager_or_interchange_only=True`
dangotbanned d7c5b45
test: isolate interchange `is_into_*frame` tests
dangotbanned edc6fea
fix: Stop expecting interchange to support everything
dangotbanned 4a85d71
chore: isolate `duckdb` interchange
dangotbanned af0bb3c
refactor: Simplify both `duckdb` and `ibis`
dangotbanned f4f7d72
test: cover `get_column`, `to_native` explicitly
dangotbanned 68f8136
refactor: remove everything that isn't tested
dangotbanned 28dbbf2
refactor: goodbye `supports_dataframe_interchange`
dangotbanned 94f2e86
fix: avoid `Protocol.__init__`
dangotbanned 395ee9d
chore: no cover on unreachable path
dangotbanned 9adb2db
chore: remove dead comment
dangotbanned c27bfbd
refactor: Simplify `SQLLazyFrame.to_narwhals`
dangotbanned 9a7879e
refactor: Expose what is actually used externally
dangotbanned 0d596eb
refactor: Fix weird leftovers
dangotbanned 322ccba
chore: rename and explain `__getattr__` trick
dangotbanned 7699757
docs(typing): Explain magic
dangotbanned 7c121b7
refactor: `__all__` is shorter
dangotbanned 0402c65
shrinky-dink
dangotbanned 4eb26e2
fix: Don't give false hope
dangotbanned fd13f4b
refactor: remove `_interchange.series.py`
dangotbanned 35478b3
refactor: share more between interchange series/frame
dangotbanned c857c8c
test: update error pattern x2
dangotbanned f19899b
refactor: consistent imports
dangotbanned 9f794e5
test: move fixtures to `interchange.conftest`
dangotbanned 4bbdf11
merge upstream
FBruzzesi bb05096
fix: exclude `cudf.DataFrame` too
dangotbanned 28545e0
refactor: lower density, more clarity?
dangotbanned 8eb114c
chore: guard against `ibis` removing `__dataframe__` support
dangotbanned 3199d03
no cov fireducks
dangotbanned 955a677
refactor: invert checks, explain a bit more
dangotbanned File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| from __future__ import annotations | ||
|
|
||
| from typing import TYPE_CHECKING | ||
|
|
||
| from duckdb import DuckDBPyRelation | ||
|
|
||
| from narwhals import _interchange | ||
| from narwhals._duckdb.dataframe import to_arrow_table | ||
| from narwhals._utils import Implementation | ||
|
|
||
| if TYPE_CHECKING: | ||
| import pandas as pd | ||
| import pyarrow as pa | ||
|
|
||
|
|
||
| class DuckDBDataFrame(_interchange.LazyFrame[DuckDBPyRelation]): | ||
| _implementation = Implementation.DUCKDB | ||
|
|
||
| def to_pandas(self) -> pd.DataFrame: | ||
| return self._compliant.native.df() | ||
|
|
||
| def to_arrow(self) -> pa.Table: | ||
| return to_arrow_table(self._compliant.native) |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -273,7 +273,7 @@ def narwhals_to_native_dtype( # noqa: PLR0912, C901 | |
| if duckdb_type := NW_TO_DUCKDB_DTYPES.get(base_type): | ||
| return duckdb_type | ||
| if isinstance_or_issubclass(dtype, dtypes.Enum): | ||
| if version is Version.V1: | ||
| if version is Version.V1: # pragma: no cover | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably should remove this branch (same reason as #3721 (comment)) |
||
| msg = "Converting to Enum is not supported in narwhals.stable.v1" | ||
| raise NotImplementedError(msg) | ||
| if isinstance(dtype, dtypes.Enum): | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| from __future__ import annotations | ||
|
|
||
| from typing import TYPE_CHECKING | ||
|
|
||
| import ibis | ||
|
|
||
| from narwhals import _interchange | ||
| from narwhals._utils import Implementation | ||
|
|
||
| if TYPE_CHECKING: | ||
| import pandas as pd | ||
| import pyarrow as pa | ||
|
|
||
|
|
||
| class IbisDataFrame(_interchange.LazyFrame[ibis.Table]): | ||
| _implementation = Implementation.IBIS | ||
|
|
||
| def to_pandas(self) -> pd.DataFrame: | ||
| return self._compliant.native.to_pandas() | ||
|
|
||
| def to_arrow(self) -> pa.Table: | ||
| return self._compliant.native.to_pyarrow() |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.