Skip to content

feat: Support plugin native objects in is_into_* - #3754

Merged
FBruzzesi merged 2 commits into
mainfrom
feat/plugin-is-into
Jul 7, 2026
Merged

feat: Support plugin native objects in is_into_*#3754
FBruzzesi merged 2 commits into
mainfrom
feat/plugin-is-into

Conversation

@FBruzzesi

Copy link
Copy Markdown
Member

Description

Closes #3714

What type of PR is this? (check all applicable)

  • 💾 Refactor
  • ✨ Feature
  • 🐛 Bug Fix
  • 🔧 Optimization
  • 📝 Documentation
  • ✅ Test
  • 🐳 Other

@FBruzzesi FBruzzesi added enhancement New feature or request extensibility labels Jul 5, 2026
Comment thread src/narwhals/plugins.py
Comment on lines +113 to +131
def is_native_dataframe(native_object: Any) -> bool:
"""Check whether an installed plugin converts `native_object` to an eager DataFrame."""
from narwhals._utils import Version, is_compliant_dataframe

return is_compliant_dataframe(from_native(native_object, Version.MAIN))


def is_native_lazyframe(native_object: Any) -> bool:
"""Check whether an installed plugin converts `native_object` to a LazyFrame."""
from narwhals._utils import Version, is_compliant_lazyframe

return is_compliant_lazyframe(from_native(native_object, Version.MAIN))


def is_native_series(native_object: Any) -> bool:
"""Check whether an installed plugin converts `native_object` to a Series."""
from narwhals._utils import Version, is_compliant_series

return is_compliant_series(from_native(native_object, Version.MAIN))

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whether an object is eager or lazy is only knowable from the compliant object a plugin produces, so this calls the plugin's from_native and inspects the result.

Comment thread tests/plugins_test.py

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mocking everything I can here, #3753 adds much more features in test-plugin that can be used here

@MarcoGorelli MarcoGorelli left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @FBruzzesi !

assert not is_into_lazyframe(data)
assert not v1_is_into_lazyframe(data)
assert not v2_is_into_lazyframe(data)
# If `test_plugin` is installed, a plain `dict` is convertible to a LazyFrame.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😄 nice

@FBruzzesi
FBruzzesi merged commit 8589a46 into main Jul 7, 2026
42 checks passed
@FBruzzesi
FBruzzesi deleted the feat/plugin-is-into branch July 7, 2026 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request extensibility

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Plugin native objects should be supported in is_into_lazyframe

2 participants