Skip to content

Refine public Compliant* methods #2713

@MarcoGorelli

Description

@MarcoGorelli

We're currently using the compliant classes to share some code between implementations

This is fine, but for protocols with other 3rd party backends should implement, I don't think this is ok:

  • it will make it harder for us to change some internals
  • it forces them to implement methods like _evaluate_expr which they really shouldn't need to care about

I'd like to suggest therefore that we aim to have:

  • CompliantDataFrame, CompliantLazyFrame, CompliantSeries, CompliantExpr, CompliantNamespace: these should be Protocols which only implement the necessary functionality which we call from narwhals.DataFrame / ...
  • we can subclass these to preserve some common functionality within Narwhals. For example, DuckDBExpr / SparkLikeExpr / ... all inherit from LazyExpr, which in turn inherits from CompliantExpr. It's fine to have some implementations in LazyExpr

PRs

Sub-issues

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions