Skip to content

✨ Execution pattern reimplementation#35

Merged
benrutter merged 12 commits intomainfrom
execution-pattern
Jun 23, 2025
Merged

✨ Execution pattern reimplementation#35
benrutter merged 12 commits intomainfrom
execution-pattern

Conversation

@benrutter
Copy link
Copy Markdown
Owner

@benrutter benrutter commented Jun 23, 2025

Rework of backend of Wimsey to make fuller use of Narwhals (closes #33)

Quite a big change here, so if you're looking at this, please test before bumping up versions! Made change that should be visible, is that DataValidationException is now DataValidationError, and the profile module is now profiling to avoid shadowing the standard library.

However, the major change his is that Wimsey now really makes use of Narwhals to allow much more complex tests (although no new tests implemented here). Previously there was a relatively complex system whereby tests related to metrics that Wimsey did or didn't calculate. But now tests relate directly to a narwhals expression.

That means writing a test is now like this:

def test_that_row_count_is_exactly(n: int):
    def _check(row_count):
        return Result(
            name=f"row-count-is-{n}",
            success=row_count == n,
        )
    return nw.len(), _check

I.e. you return a Narwhals expression that evaluates a scalar, and a function for checking against that scalar.

I'll write this up as a guide in more detail, but if you compare to the previous model, this is both a lot simpler, and a lot more flexible, so I'm pretty excited about it!

Note to anyone following, I'm working towards v1 hopefully quite soon, so a few more breaking changes will be coming, to make sure I can reduce the API to things that can reasonably be guaranteed.

@benrutter benrutter merged commit 424808e into main Jun 23, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Shift all test backends to Narwhals + Test

1 participant