Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: use more robust dtype comparisons, use Narwhals stable API in tests #3670

Merged
merged 1 commit into from
Nov 3, 2024

Conversation

MarcoGorelli
Copy link
Contributor

@MarcoGorelli MarcoGorelli commented Nov 3, 2024

Since Narwhals 1.9.0 (release last month), nw.Datetime has time_unit and time_zone metadata, which means that hash(nw.Datetime) has changed.
This change only affects the main Narwhals namespace - the narwhals.stable.v1 namespace (which you're using 🙌 ) is unaffected

The fact that having narwhals.stable.v1 allowed us to make this change without it affecting any users is a pretty good feeling 😄

I've rewritten the dtype comparison from

elif dtype in {nw.Datetime, nw.Date}:

to

elif dtype == nw.Datetime or dtype == nw.Date:

so that it will also work in the same way if and when you decide to move to narwhals.stable.v2 (when we get there). There'll be no obligation to perform such a move of course, we'll keep stable.v1 working as-is, so either way, there's no impact on users


See the second bullet point at https://narwhals-dev.github.io/narwhals/backcompat/#after-stablev1 for more context

@MarcoGorelli MarcoGorelli marked this pull request as ready for review November 3, 2024 14:35
Copy link
Member

@dangotbanned dangotbanned left a comment

Choose a reason for hiding this comment

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

Nothing to add here at all, your explanation was super helpful

Thanks for this @MarcoGorelli

@dangotbanned dangotbanned merged commit 613b6e4 into vega:main Nov 3, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants