Skip to content

chore(typing): Widen _utils signatures#2712

Merged
MarcoGorelli merged 7 commits intomainfrom
widen-utils-typing
Jun 25, 2025
Merged

chore(typing): Widen _utils signatures#2712
MarcoGorelli merged 7 commits intomainfrom
widen-utils-typing

Conversation

@dangotbanned
Copy link
Member

@dangotbanned dangotbanned commented Jun 21, 2025

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

  • 💾 Refactor
  • ✨ Feature
  • 🐛 Bug Fix
  • 🔧 Optimization
  • 📝 Documentation
  • ✅ Test
  • 🐳 Other

Related issues

Checklist

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

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

With that, I noticed a few others that also didn't need all the features of Sequence.

For reference, this section of the stubs is probably handy when trying to decide which Protocol to use
https://github.com/python/typeshed/blob/b98b6c376bb8d1443108c42c766e3de199328d32/stdlib/typing.pyi#L619-L643

In light of (#2706 (comment))

Splitting out a change from https://github.com/narwhals-dev/narwhals/blob/7bb0d0df3d2f75bc903aa9fc2abf0ecc5a61f432/narwhals/_utils.py#L1194

With that, I noticed a few others that also didn't need all the features of `Sequence`
The type here is dependent on `check_columns_exist`
See #2495 (comment)
`list[str] | _1DArray` is assignable to `Collection[str]`
Previously, failed on `Sequence[str]` due to `numpy`
@dangotbanned

This comment was marked as resolved.

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.

@MarcoGorelli MarcoGorelli merged commit c3237b0 into main Jun 25, 2025
32 checks passed
@MarcoGorelli MarcoGorelli deleted the widen-utils-typing branch June 25, 2025 17:23
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