Skip to content

Commit cfd156f

Browse files
committed
trying to see an effect of plugin
1 parent 8d4cda6 commit cfd156f

File tree

3 files changed

+14
-10
lines changed

3 files changed

+14
-10
lines changed

narwhals/translate.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,7 @@ def _from_native_impl( # noqa: C901, PLR0911, PLR0912, PLR0915
535535

536536
# TODO @mp: this should be connection point to plugin
537537

538+
# not sure first if statement is needed
538539
if sys.version_info < (3, 10):
539540
from importlib_metadata import entry_points
540541
else:
@@ -544,6 +545,14 @@ def _from_native_impl( # noqa: C901, PLR0911, PLR0912, PLR0915
544545

545546
print(discovered_plugins)
546547

548+
"""
549+
TODO @mp: need logic to go over all the entry points found, and if daft found,
550+
(others later), we return the daft dataframe from_native. I think the transformation has
551+
to happen inside the daft_plugin, first would just like to see that I can actually read
552+
it in
553+
554+
"""
555+
547556
if not pass_through:
548557
msg = f"Expected pandas-like dataframe, Polars dataframe, or Polars lazyframe, got: {type(native_object)}"
549558
raise TypeError(msg)

plugins/daft-plugin/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
setuptools.setup(
66
name="daft-plugin",
77
entry_points={
8-
"daft.extension": [
8+
"daft-plugin.extension": [
99
"X1 = daft-plugin:ExampleOne"
1010
# "X2 = daft-plugin:ExampleTwo",
1111
]

plugins/daft-plugin/src/on_by_default.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,13 @@
22

33
from __future__ import annotations
44

5-
from typing import TYPE_CHECKING, Any
6-
7-
if TYPE_CHECKING:
8-
from collections.abc import Generator
9-
105

116
class ExampleOne:
127
"""First Example Plugin."""
138

14-
def __init__(self, tree: Any) -> None:
15-
self.tree = tree
9+
def __init__(self):
10+
pass
1611

17-
def run(self) -> Generator[Any, Any, None]:
12+
def run(self) -> None:
1813
"""Do nothing."""
19-
yield from []
14+
print('ExampleOne just ran!')

0 commit comments

Comments
 (0)