Skip to content

feat: Support plugin native objects in is_into_*#3754

Open
FBruzzesi wants to merge 2 commits into
mainfrom
feat/plugin-is-into
Open

feat: Support plugin native objects in is_into_*#3754
FBruzzesi wants to merge 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

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

1 participant