Skip to content

Conversation

@stanmart
Copy link
Collaborator

glum will soon pass narwhals.stable.v2.DataFrame`s to tabmat, so we will have to handle them properly. The fact that

isinstance(
    narwhals.stable.v2.Enum([]),
    narwhals.stable.v1.Enum
) == False

would cause issues in from_df, which this update solves.

Note, that

isinstance(
    narwhals.stable.v1.Enum(),
    narwhals.stable.v2.Enum
) == True

so this change does not break the ability to accept v1 dataframes.

Checklist

  • Added a CHANGELOG.rst entry

@stanmart stanmart changed the title Switch to Narwhal's v2 namespace Switch to Narwhals' v2 namespace Nov 19, 2025
@stanmart stanmart requested a review from Copilot November 20, 2025 10:14
Copilot finished reviewing on behalf of stanmart November 20, 2025 10:16
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates tabmat to use Narwhals' v2 stable namespace (narwhals.stable.v2) instead of v1. This change is necessary because glum will soon pass v2 DataFrames to tabmat, and v1 type checking is incompatible with v2 objects. The update also includes parameter name changes to align with v2 API (strict=Falsepass_through=True). Since v2 is backwards compatible with v1 objects, this change maintains support for v1 DataFrames.

Key changes:

  • Updated all imports from narwhals.stable.v1 to narwhals.stable.v2
  • Changed API parameters from strict=False to pass_through=True in accordance with v2 API
  • Updated dependency requirements to narwhals>=2.0.0

Reviewed Changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/test_categorical_matrix.py Updated import to use v2 namespace
src/tabmat/constructor.py Updated import to use v2 namespace
src/tabmat/categorical_matrix.py Updated import to v2 namespace and migrated parameter names to v2 API
pixi.toml Updated narwhals dependency constraint to >=2.0.0 and 2.0.* for oldies environment
pixi.lock Updated narwhals package version from 1.4.1 to 2.0.1
conda.recipe/meta.yaml Updated narwhals dependency constraint to >=2

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@stanmart stanmart merged commit 3cf349e into main Nov 26, 2025
32 checks passed
@stanmart stanmart deleted the narwhals-v2 branch November 26, 2025 12:24
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.

3 participants