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

fix: fix type __get_item__ #1958

Merged
merged 3 commits into from
Feb 7, 2025
Merged

Conversation

EdAbati
Copy link
Collaborator

@EdAbati EdAbati commented Feb 7, 2025

What type of PR is this? (check all applicable)

  • πŸ’Ύ Refactor
  • ✨ Feature
  • πŸ› Bug Fix
  • πŸ”§ Optimization
  • πŸ“ Documentation
  • βœ… Test
  • 🐳 Other

Related issues

Related to the mypy discussion on discord. I found few errors that should be better tackled in separate PRs :)

Checklist

  • Code follows style guide (ruff)
  • Tests added
  • Documented the changes

If you have comments or can explain your changes, please do so below

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

not sure if changing this should be allowed, but in theory we are just expanding the allowed types (adding np.array that is suppoerted anyway)
πŸ€”

Copy link
Member

@dangotbanned dangotbanned Feb 7, 2025

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Yup, totally allowed πŸ˜„ adding types should still be backwards-compatible

@EdAbati EdAbati marked this pull request as ready for review February 7, 2025 07:39
@dangotbanned
Copy link
Member

dangotbanned commented Feb 7, 2025

@EdAbati I think the issue you're running into is that np.ndarray is not a Sequence

import numpy as np
from collections.abc import Sequence

>>> isinstance(np.ndarray((2,2)), Sequence)
False

Edit

I might have spoke too soon, I'm getting the same failures on (https://github.com/narwhals-dev/narwhals/actions/runs/13200872617/job/36852325981?pr=1955)

Copy link
Member

@MarcoGorelli MarcoGorelli left a comment

Choose a reason for hiding this comment

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

thanks @EdAbati , and Dan for reviewing!

Copy link
Member

Choose a reason for hiding this comment

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

Yup, totally allowed πŸ˜„ adding types should still be backwards-compatible

@MarcoGorelli MarcoGorelli merged commit 20d52d7 into narwhals-dev:main Feb 7, 2025
24 of 25 checks passed
@EdAbati EdAbati mentioned this pull request Feb 7, 2025
10 tasks
@EdAbati EdAbati deleted the type-get-item branch February 8, 2025 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants