🌐 AI搜索 & 代理 主页
Skip to content

Conversation

@charris
Copy link
Member

@charris charris commented Sep 22, 2025

Backport of #29749.

https://mypy.readthedocs.io/en/stable/changelog.html#mypy-1-18

It's should be significantly faster now (~0.67x in case of scipy-stubs), and solves some issues that used to lead to some incorrectly inferred types in our type-tests (e.g. np.vstack)

@charris charris added this to the 2.3.4 release milestone Sep 22, 2025
@charris charris added 08 - Backport Used to tag backport PRs 41 - Static typing labels Sep 22, 2025
@github-actions

This comment has been minimized.

@jorenham
Copy link
Member

jorenham commented Sep 22, 2025

This also includes #29278, which is what's causing the mypy_primer diff

@github-actions

This comment has been minimized.

@charris
Copy link
Member Author

charris commented Sep 22, 2025

I added #29278 to get rid of an mypy error. Is there a better way?

FAILED numpy/typing/tests/test_typing.py::test_reveal[array_constructors] - Failed: numpy/typing/tests/data/reveal/array_constructors.pyi:56 - reveal mismatch:

    error:
    Expression is of type "ndarray[tuple[Any, ...], dtype[Any]]", not "Any" 
    [assert-type]
        assert_type(np.concatenate([A, A]), Any)  # pyright correctly infers t...
        ^

@jorenham
Copy link
Member

jorenham commented Sep 22, 2025

I added #29278 to get rid of an mypy error. Is there a better way?

The only relevant bit of #29278 is the change in numpy/typing/tests/data/reveal/array_constructors.pyi:56. Given the primer output, it's probably better to keep #29278 out of this, and only copy that specific change. (The reported ndarray[tuple[Any, ...], dtype[Any]] is the same as npt.NDArray[Any])

And I see that you removed the problematic ignore comments in numpy/typing/tests/data/reveal/testing.pyi already, which is exactly what I would've done.

@charris charris merged commit 540cf32 into numpy:maintenance/2.3.x Sep 22, 2025
80 of 81 checks passed
@charris charris deleted the backport-29749 branch September 23, 2025 00:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

08 - Backport Used to tag backport PRs 41 - Static typing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants