Skip to content

Add type guard for what from_native supports #3530

@OutSquareCapital

Description

@OutSquareCapital

We would like to learn about your use case. For example, if this feature is needed to adopt Narwhals in an open source project, could you please enter the link to it below?

It would be nice if typing.runtime_checkable decorator could be added to NativeFrame.

Please describe the purpose of the new feature or describe the problem to solve.

This would allow me to avoid maintaining a copy of the Protocol in my own project for instances checking.
Also, I haven't looked at how NativeFrame is used in narwhals internals, but if there's any getattr access to check at runtime the Protocol compliance, this can be a nicer alternative.

My test suite show that it works :)

Suggest a solution if possible.

No response

If you have tried alternatives, please describe them below.

No response

Additional information that may help us understand your needs.

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions