Skip to content

Commit ff2f7c9

Browse files
authored
Merge pull request #706 from numpy/bump-deps
2 parents 3653388 + b388aaf commit ff2f7c9

10 files changed

Lines changed: 637 additions & 752 deletions

File tree

pyproject.toml

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[build-system]
2-
requires = ["uv_build>=0.8"]
2+
requires = ["uv_build>=0.8.17,<0.9"]
33
build-backend = "uv_build"
44

55
[tool.uv.build-backend]
@@ -9,7 +9,7 @@ source-exclude = ['\@test', ".ruff_cache", ".ruff.toml"]
99

1010
[project]
1111
name = "numtype"
12-
version = "2.3.2.0.dev0"
12+
version = "2.3.3.0.dev0"
1313
description = "Experimental Typing Stubs for NumPy"
1414
readme = "README.md"
1515
authors = [{ name = "Joren Hammudoglu", email = "jhammudoglu@gmail.com" }]
@@ -39,7 +39,7 @@ requires-python = ">=3.11"
3939
dependencies = []
4040

4141
[project.optional-dependencies]
42-
numpy = ["numpy>=2.3.2,<2.4"]
42+
numpy = ["numpy>=2.3.3,<2.4"]
4343

4444
[project.urls]
4545
Homepage = "https://numpy.org/"
@@ -50,12 +50,12 @@ Changelog = "https://github.com/numpy/numtype/releases"
5050
[dependency-groups]
5151
numpy = ["numtype[numpy]"]
5252
lint = [
53-
"dprint-py>=0.50.1.4",
54-
"ruff>=0.12.10",
53+
"dprint-py>=0.50.2.0",
54+
"ruff>=0.13.0",
5555
]
5656
pytest = [
5757
{ include-group = "numpy" },
58-
"pytest>=8.4.1",
58+
"pytest>=8.4.2",
5959
"typing_extensions>=4.15.0",
6060
]
6161
list_and_test = [
@@ -70,22 +70,21 @@ types = [
7070
basedpyright = [
7171
{ include-group = "numpy" },
7272
{ include-group = "types" },
73-
"basedpyright>=1.31.3",
73+
"basedpyright==1.31.3", # trait broke divmod in 1.1.404
7474
]
7575
mypy = [
7676
{ include-group = "types" },
77-
"mypy[faster-cache]>=1.17.1",
77+
"mypy[faster-cache]>=1.18.1",
7878
]
7979
typecheck = [
8080
{ include-group = "basedpyright" },
8181
{ include-group = "mypy" },
8282
]
8383
docs = [
84-
"mkdocs-material>=9.6.18",
85-
"pydantic>=2.12.0a1; python_version >= '3.14'", # needed for mkdocs-awesome-nav
86-
"mkdocs-awesome-nav>=3.1.2",
84+
"mkdocs-material>=9.6.20",
85+
"mkdocs-awesome-nav>=3.2.0",
8786
"markdown-callouts>=0.4.0",
88-
"mkdocs-include-markdown-plugin>=7.1.6",
87+
"mkdocs-include-markdown-plugin>=7.1.7",
8988
"mkdocs-minify-plugin>=0.8.0",
9089
"mkdocstrings[python]>=0.30.0",
9190
"pygments>=2.19.2",

src/numpy-stubs/@test/static/accept/array_constructors.pyi

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -280,19 +280,19 @@ assert_type(np.atleast_3d(A), _nt.Array[np.float64])
280280
assert_type(np.atleast_3d(A, A), tuple[_nt.Array[np.float64], _nt.Array[np.float64]])
281281
assert_type(np.atleast_3d(A, A, A), tuple[_nt.Array[np.float64], ...])
282282

283-
assert_type(np.vstack([A, A]), _nt.Array[np.float64]) # type: ignore[assert-type] # mypy fail
283+
assert_type(np.vstack([A, A]), _nt.Array[np.float64])
284284
assert_type(np.vstack([A, A], dtype=np.float32), _nt.Array[np.float32])
285285
assert_type(np.vstack([A, C]), _nt.Array)
286286
assert_type(np.vstack([C, C]), _nt.Array)
287287

288-
assert_type(np.hstack([A, A]), _nt.Array[np.float64]) # type: ignore[assert-type] # mypy fail
288+
assert_type(np.hstack([A, A]), _nt.Array[np.float64])
289289
assert_type(np.hstack([A, A], dtype=np.float32), _nt.Array[np.float32])
290290

291-
assert_type(np.stack([A, A]), _nt.Array[np.float64]) # type: ignore[assert-type] # mypy fail
291+
assert_type(np.stack([A, A]), _nt.Array[np.float64])
292292
assert_type(np.stack([A, A], dtype=np.float32), _nt.Array[np.float32])
293293
assert_type(np.stack([A, C]), _nt.Array)
294294
assert_type(np.stack([C, C]), _nt.Array)
295-
assert_type(np.stack([A, A], axis=0), _nt.Array[np.float64]) # type: ignore[assert-type] # mypy fail
295+
assert_type(np.stack([A, A], axis=0), _nt.Array[np.float64])
296296
assert_type(np.stack([A, A], out=B), MyArray[np.float64])
297297

298298
assert_type(np.block([[A, A], [A, A]]), _nt.Array) # pyright: ignore[reportAssertTypeFailure] # _nt.Array[np.float64]

src/numpy-stubs/@test/static/accept/numerictypes.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
from typing import Literal, assert_type
1+
from typing import Any, Literal, assert_type
22

33
import numpy as np
44

55
assert_type(np.ScalarType[0], type[int])
66
assert_type(np.ScalarType[3], type[bool])
77
assert_type(np.ScalarType[8], type[np.csingle])
8-
assert_type(np.ScalarType[10], type[np.clongdouble])
8+
assert_type(np.ScalarType[10], type[np.clongdouble | Any])
99
assert_type(np.bool_(object()), np.bool)
1010

1111
assert_type(np.typecodes["Character"], Literal["c"])

src/numpy-stubs/@test/static/reject/ma.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import numpy as np
22

33
m: np.ma.MaskedArray[tuple[int], np.dtype[np.float64]]
44

5-
m.shape = (3, 1) # type: ignore[assignment]
5+
m.shape = (3, 1) # type: ignore[arg-type, assignment]
66
m.dtype = np.bool # type: ignore[assignment, misc] # pyright: ignore[reportAttributeAccessIssue]
77

88
np.amin(m, axis=1.0) # type: ignore[call-overload] # pyright: ignore[reportArgumentType, reportCallIssue]

src/numpy-stubs/_core/numerictypes.pyi

Lines changed: 40 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
from builtins import bool as py_bool
2-
from typing import Any, Final, Literal as L, TypedDict, type_check_only
3-
4-
import numpy as np
2+
from typing import Any, Final, Literal as L, TypeAlias, TypedDict, type_check_only
53

64
# ruff: noqa: ICN003
75
from numpy import (
@@ -154,41 +152,45 @@ class _TypeCodes(TypedDict):
154152
###
155153

156154
typecodes: Final[_TypeCodes] = ...
157-
ScalarType: Final[
158-
tuple[
159-
type[int],
160-
type[float],
161-
type[complex],
162-
type[py_bool],
163-
type[bytes],
164-
type[str],
165-
type[memoryview[Any]],
166-
type[np.bool],
167-
type[csingle],
168-
type[cdouble],
169-
type[clongdouble],
170-
type[half],
171-
type[single],
172-
type[double],
173-
type[longdouble],
174-
type[byte],
175-
type[short],
176-
type[intc],
177-
type[long],
178-
type[longlong],
179-
type[timedelta64],
180-
type[datetime64],
181-
type[object_],
182-
type[bytes_],
183-
type[str_],
184-
type[ubyte],
185-
type[ushort],
186-
type[uintc],
187-
type[ulong],
188-
type[ulonglong],
189-
type[void],
190-
]
191-
] = ...
155+
156+
# pyright: reportRedeclaration=false
157+
# NOTE: The order of same-kind same-itemsize types are unstable, hence the `| Any` in some places.
158+
# See https://github.com/numpy/numpy/pull/29761 for details
159+
_ScalarTypeTuple: TypeAlias = tuple[
160+
type[int],
161+
type[float],
162+
type[complex],
163+
type[py_bool],
164+
type[bytes],
165+
type[str],
166+
type[memoryview[Any]],
167+
type[bool_[Any]],
168+
type[complex64],
169+
type[complex128 | Any],
170+
type[clongdouble | Any],
171+
type[float16],
172+
type[float32],
173+
type[float64 | Any],
174+
type[longdouble | Any],
175+
type[int8],
176+
type[int16],
177+
type[int32 | Any],
178+
type[long | Any],
179+
type[int64],
180+
type[datetime64[Any] | Any],
181+
type[timedelta64[Any] | Any],
182+
type[object_],
183+
type[bytes_],
184+
type[str_],
185+
type[uint8],
186+
type[uint16],
187+
type[uint32 | Any],
188+
type[ulong | Any],
189+
type[uint64],
190+
type[void],
191+
]
192+
193+
ScalarType: Final[_ScalarTypeTuple] = ...
192194
typeDict: Final = sctypeDict
193195

194196
def isdtype(dtype: dtype | type, kind: DTypeLike | tuple[DTypeLike, ...]) -> py_bool: ...

tool/stubtest.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
# requires-python = ">=3.11"
33
# dependencies = [
44
# "numtype[numpy]",
5-
# "mypy[faster-cache]>=1.17.1", # keep in sync with pyproject.toml
6-
#
5+
# "mypy[faster-cache] >=1.18.1, <1.19", # keep in sync with pyproject.toml
76
# "PyInstaller",
87
# "hypothesis",
98
# "pytest",
@@ -66,7 +65,7 @@ def _allowlists() -> list[str]:
6665

6766

6867
def _stubtest_command() -> list[str]:
69-
cmd = ["stubtest"]
68+
cmd = ["stubtest", "--ignore-disjoint-bases"]
7069
args_extra = sys.argv[1:]
7170

7271
if not any("--mypy-config-file" in arg for arg in args_extra):

0 commit comments

Comments
 (0)