Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["uv_build>=0.10,<0.11"]
requires = ["uv_build>=0.11,<0.12"]
build-backend = "uv_build"

[tool.uv.build-backend]
Expand Down Expand Up @@ -45,12 +45,12 @@ Changelog = "https://github.com/numpy/numtype/releases"
[dependency-groups]
numpy = ["numtype[numpy]"]
lint = [
"dprint-py>=0.52.0.0",
"ruff>=0.15.5",
"dprint-py>=0.53.1.0",
"ruff>=0.15.11",
]
pytest = [
{ include-group = "numpy" },
"pytest>=9.0.2",
"pytest>=9.0.3",
"typing_extensions>=4.15.0",
]
list_and_test = [
Expand All @@ -59,30 +59,30 @@ list_and_test = [
]
types = [
{ include-group = "pytest" },
"types-setuptools>=82.0.0.20260210",
"types-tabulate>=0.10.0.20260308",
"types-setuptools>=82.0.0.20260408",
"types-tabulate>=0.10.0.20260408",
]
basedpyright = [
{ include-group = "numpy" },
{ include-group = "types" },
"basedpyright==1.38.2",
"basedpyright==1.39.2",
]
mypy = [
{ include-group = "types" },
"mypy[faster-cache]>=1.19.1",
"mypy[faster-cache]>=1.20.1",
]
typecheck = [
{ include-group = "basedpyright" },
{ include-group = "mypy" },
]
docs = [
"mkdocs-material>=9.7.4",
"mkdocs-material>=9.7.6",
"mkdocs-awesome-nav>=3.3.0",
"markdown-callouts>=0.4.0",
"mkdocs-include-markdown-plugin>=7.2.1",
"mkdocs-include-markdown-plugin>=7.2.2",
"mkdocs-minify-plugin>=0.8.0",
"mkdocstrings[python]>=1.0.3",
"pygments>=2.19.2",
"mkdocstrings[python]>=1.0.4",
"pygments>=2.20.0",
]
dev = [
{ include-group = "list_and_test" },
Expand Down
2 changes: 1 addition & 1 deletion src/numpy-stubs/@test/runtime/legacy/comparisons.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
b_ = np.bool()

b = False
c = complex()
c = 0j
f = 0.0
i = 0

Expand Down
2 changes: 1 addition & 1 deletion src/numpy-stubs/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -1765,7 +1765,7 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DTypeT_co]):

#
@overload
def __array__(self, /, *, copy: bool | None = None) -> ndarray[_ShapeT_co, _DTypeT_co]: ...
def __array__(self, dtype: None = None, /, *, copy: bool | None = None) -> ndarray[_ShapeT_co, _DTypeT_co]: ...
@overload
def __array__(self, dtype: _DTypeT, /, *, copy: bool | None = None) -> ndarray[_ShapeT_co, _DTypeT]: ...

Expand Down
2 changes: 1 addition & 1 deletion src/numpy-stubs/lib/_format_impl.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class _HeaderDict_1_0(TypedDict):

EXPECTED_KEYS: Final[set[str]] = ...
MAGIC_PREFIX: Final = b"\x93NUMPY"
MAGIC_LEN: Final = 16
MAGIC_LEN: Final = 8
ARRAY_ALIGN: Final = 64
BUFFER_SIZE: Final = 262_144 # 2**18
GROWTH_AXIS_MAX_DIGITS: Final = 21
Expand Down
2 changes: 1 addition & 1 deletion src/numpy-stubs/testing/_private/utils.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ IS_PYPY: Final[bool] = ...
IS_PYSTON: Final[bool] = ...
IS_WASM: Final[bool] = ...
HAS_REFCOUNT: Final[bool] = ...
BLAS_SUPPORTS_FPE: Final = True
BLAS_SUPPORTS_FPE: Final[bool] = ...
HAS_LAPACK64: Final[bool] = ...
NOGIL_BUILD: Final[bool] = ...

Expand Down
4 changes: 0 additions & 4 deletions tool/allowlists/py312.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,3 @@

numpy\.distutils
numpy\.f2py\._backends\._distutils

# false positive "... is not a Union" errors
numpy\.typing\.ArrayLike
numpy\.typing\.DTypeLike
4 changes: 0 additions & 4 deletions tool/allowlists/py313.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,3 @@

numpy\.distutils
numpy\.f2py\._backends\._distutils

# false positive "... is not a Union" errors
numpy\.typing\.ArrayLike
numpy\.typing\.DTypeLike
4 changes: 0 additions & 4 deletions tool/allowlists/py314.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,3 @@

numpy\.distutils
numpy\.f2py\._backends\._distutils

# false positive "... is not a Union" errors
numpy\.typing\.ArrayLike
numpy\.typing\.DTypeLike
2 changes: 1 addition & 1 deletion tool/stubtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# requires-python = ">=3.11"
# dependencies = [
# "numtype[numpy]",
# "mypy[faster-cache] >=1.19.1", # keep in sync with pyproject.toml
# "mypy[faster-cache] >=1.20.1", # keep in sync with pyproject.toml
# "PyInstaller",
# "hypothesis",
# "pytest",
Expand Down
271 changes: 146 additions & 125 deletions tool/stubtest.py.lock

Large diffs are not rendered by default.

32 changes: 16 additions & 16 deletions tool/testgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -747,12 +747,12 @@ class LiteralBoolOps(TestGen):
"{} > {}": op.__gt__,
"{} >= {}": op.__ge__,
}
BINOPS: ClassVar = {
BINOPS: ClassVar = { # pyright: ignore[reportUnknownVariableType]
"{} + {}": op.__add__,
"{} * {}": op.__mul__,
"{} & {}": op.__and__,
"{} ^ {}": op.__xor__,
"{} | {}": op.__or__,
"{} & {}": op.__and__, # pyright: ignore[reportUnknownMemberType]
"{} ^ {}": op.__xor__, # pyright: ignore[reportUnknownMemberType]
"{} | {}": op.__or__, # pyright: ignore[reportUnknownMemberType]
}

NAMES_NP: ClassVar = [f"np{v}" for v in "01_"]
Expand Down Expand Up @@ -848,14 +848,14 @@ def _gen_comparison(self) -> Generator[str]:
yield _expr_assert_type(tmpl.format(a, b), self.eval2(fn, a, b))

def _gen_binary(self) -> Generator[str]:
for tmpl, fn in self.BINOPS.items():
for tmpl, fn in self.BINOPS.items(): # pyright: ignore[reportUnknownMemberType, reportUnknownVariableType]
opname = fn.__name__.removesuffix("_")
yield from self._generate_section(f"__[r]{opname}__")

# np, np (literals)
deferred: list[str] = []
for a, b in itertools.product(self.NAMES_NP, self.NAMES_NP):
line = _expr_assert_type(tmpl.format(a, b), self.eval2(fn, a, b))
line = _expr_assert_type(tmpl.format(a, b), self.eval2(fn, a, b)) # pyright: ignore[reportUnknownArgumentType]
if "_" in {a[-1], b[-1]}:
deferred.append(line)
else:
Expand All @@ -868,12 +868,12 @@ def _gen_binary(self) -> Generator[str]:
# np, py
yield ""
for a, b in itertools.product(self.NAMES_NP, self.NAMES_PY):
yield _expr_assert_type(tmpl.format(a, b), self.eval2(fn, a, b))
yield _expr_assert_type(tmpl.format(a, b), self.eval2(fn, a, b)) # pyright: ignore[reportUnknownArgumentType]

# py, np
yield ""
for a, b in itertools.product(self.NAMES_PY, self.NAMES_NP):
yield _expr_assert_type(tmpl.format(a, b), self.eval2(fn, a, b))
yield _expr_assert_type(tmpl.format(a, b), self.eval2(fn, a, b)) # pyright: ignore[reportUnknownArgumentType]

@override
def get_testcases(self) -> Iterable[str | None]:
Expand All @@ -891,20 +891,20 @@ class ScalarOps(TestGen):
"{} + {}": op.__add__,
"{} - {}": op.__sub__,
"{} * {}": op.__mul__,
"{}**{}": op.__pow__,
"{} / {}": op.__truediv__,
"{}**{}": op.__pow__, # pyright: ignore[reportUnknownMemberType]
"{} / {}": op.__truediv__, # pyright: ignore[reportUnknownMemberType]
}
OPS_MODULAR: ClassVar[dict[str, _BinOp]] = {
"{} // {}": op.__floordiv__,
"{} // {}": op.__floordiv__, # pyright: ignore[reportUnknownMemberType]
"{} % {}": op.__mod__,
"divmod({}, {})": divmod,
}
OPS_BITWISE: ClassVar[dict[str, _BinOp]] = {
"{} << {}": op.__lshift__,
"{} >> {}": op.__rshift__,
"{} & {}": op.__and__,
"{} ^ {}": op.__xor__,
"{} | {}": op.__or__,
"{} << {}": op.__lshift__, # pyright: ignore[reportUnknownMemberType]
"{} >> {}": op.__rshift__, # pyright: ignore[reportUnknownMemberType]
"{} & {}": op.__and__, # pyright: ignore[reportUnknownMemberType]
"{} ^ {}": op.__xor__, # pyright: ignore[reportUnknownMemberType]
"{} | {}": op.__or__, # pyright: ignore[reportUnknownMemberType]
}
OPS_COMPARISON: ClassVar[dict[str, _BinOp]] = {
"{} < {}": op.__lt__,
Expand Down
74 changes: 37 additions & 37 deletions tool/ufunc.py.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading