Skip to content

MAINT: update lock file to unblock CI#445

Merged
lucascolley merged 2 commits into
data-apis:mainfrom
lucascolley:update-pixi
Sep 27, 2025
Merged

MAINT: update lock file to unblock CI#445
lucascolley merged 2 commits into
data-apis:mainfrom
lucascolley:update-pixi

Conversation

@lucascolley

Copy link
Copy Markdown
Member

No description provided.

@lucascolley

Copy link
Copy Markdown
Member Author

@jorenham any advice for the NumPy dtype typing failures that have appeared upon upgrading mypy?

@lucascolley

Copy link
Copy Markdown
Member Author

and dtype is np.float32
and
if library is Backend.CUPY and dtype is np.float32:

@lucascolley lucascolley added the maintenance general maintenance label Sep 26, 2025
@lucascolley lucascolley added this to the 0.9.1 milestone Sep 26, 2025
@jorenham

Copy link
Copy Markdown
Member

@jorenham any advice for the NumPy dtype typing failures that have appeared upon upgrading mypy?

You're comparing a np.dtype instance using is with a type[np.float32], which indeed is always false. You probably want to instead do dtype.type is np.float32

@lucascolley

Copy link
Copy Markdown
Member Author

@jorenham any advice for the NumPy dtype typing failures that have appeared upon upgrading mypy?

You're comparing a np.dtype instance using is with a type[np.float32], which indeed is always false. You probably want to instead do dtype.type is np.float32

So the problem is that we're annotating np.float32 with np.dtype[Any]? How are we supposed to type that?

@jorenham

Copy link
Copy Markdown
Member

@jorenham any advice for the NumPy dtype typing failures that have appeared upon upgrading mypy?

You're comparing a np.dtype instance using is with a type[np.float32], which indeed is always false. You probably want to instead do dtype.type is np.float32

So the problem is that we're annotating np.float32 with np.dtype[Any]? How are we supposed to type that?

is dtype an instance of np.dtype, e.g. dtype=np.dtype("float32")', or is is a scalar type like dtype=np.float32?

@lucascolley

Copy link
Copy Markdown
Member Author

A scalar type.

@lucascolley

Copy link
Copy Markdown
Member Author

@jorenham

Copy link
Copy Markdown
Member

A scalar type.

Ah ok, then

dtype: np.dtype[Any],

should instead be dtype: type[np.generic] or dtype: type[np.floating] or something like that

@jorenham

jorenham commented Sep 27, 2025

Copy link
Copy Markdown
Member

BTW, hypothesis also has a dedicated strategy for this: https://hypothesis.readthedocs.io/en/latest/reference/strategies.html#hypothesis.extra.numpy.floating_dtypes

It's for np.dtypes though :P

@lucascolley

Copy link
Copy Markdown
Member Author

Sounds like we should use that then!

@lucascolley

Copy link
Copy Markdown
Member Author

thanks, I think 11d5472 should do it

@lucascolley lucascolley merged commit 33e3888 into data-apis:main Sep 27, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintenance general maintenance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants