Skip to content

Use simple unions in dtypes and rename grammar rule - #136

Merged
lagru merged 4 commits into
scientific-python:mainfrom
lagru:dtype-union
Nov 9, 2026
Merged

lagru merged 4 commits into
scientific-python:mainfrom
lagru:dtype-union

Conversation

@lagru

@lagru lagru commented Nov 9, 2026

Copy link
Copy Markdown
Member

When releasing v0.7.0, I wasn't sure if numpy.dtype would accept unions, so I implemented them as an expansion and named the grammar rule accordingly.

But now I found examples in NumPy's repo like this one

np.ndarray[ShapeT, np.dtype[np.floating | np.integer | np.bool]],

So, I'm quickly deprecating that unnecessary functionality.

Release note

For maintainers and optionally contributors, please refer to changelist's README on how to document this PR for the release notes.

The grammar rule 'dtype_to_expand' is deprecated in favor of 'dtype_union'.
Since `numpy.dtype` supports unions, the rule was renamed. Use the rule
'dtype_union' if you want to modify this expression in a plugin.
Using the rule in a plugin will trigger a warning and will stop working in v0.8.0.

@lagru lagru added the deprecation (Breaking) API change or removal of a feature label Nov 9, 2026
@lagru lagru added this to the v0.7.1 milestone Nov 9, 2026
@lagru lagru modified the milestones: v0.7.1, v0.8 Nov 9, 2026
@lagru
lagru merged commit a6d1885 into scientific-python:main Nov 9, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

deprecation (Breaking) API change or removal of a feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant