Skip to content

Commit 24d0f57

Browse files
authored
👽️ SciPy 1.16.1 support (#792)
2 parents db37b93 + c14f222 commit 24d0f57

File tree

10 files changed

+119
-107
lines changed

10 files changed

+119
-107
lines changed

.mypyignore

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -12,34 +12,6 @@ scipy\.((_|\w)+\.)+(__test__|test|tests(\..+)?)
1212
scipy\._lib\.(array_api_(compat|extra)|cobyqa|pyprima).*
1313
scipy\.fft\._pocketfft\..*
1414

15-
# https://github.com/scipy/scipy/issues/23216
16-
scipy\.cluster\._?vq\.kmeans
17-
scipy\.cluster\._?vq\.kmeans2
18-
scipy\.interpolate(\._?polyint)?\.BarycentricInterpolator\.__init__
19-
scipy\.linalg(\._sketches)?\.clarkson_woodruff_transform
20-
scipy\.optimize(\._basinhopping)?\.basinhopping
21-
scipy\.optimize(\._differentialevolution)?\.differential_evolution
22-
scipy\.optimize(\._dual_annealing)?\.dual_annealing
23-
scipy\.optimize(\._optimize)?\.check_grad
24-
scipy\.sparse(\._construct)?\.random_array
25-
scipy\.sparse(\._construct)?\.random
26-
scipy\.sparse(\._construct)?\.rand
27-
scipy\.sparse\.linalg(\._eigen(\._svds)?)?\.svds
28-
scipy\.spatial\.distance\.directed_hausdorff
29-
scipy\.spatial\.transform(\._?rotation|\._rigid_transform)?\.Rotation\.random
30-
scipy\.stats(\._fit)?\.goodness_of_fit
31-
scipy\.stats(\._multicomp)?\.dunnett
32-
scipy\.stats(\._resampling)?\.bootstrap
33-
scipy\.stats(\._resampling)?\.permutation_test
34-
scipy\.stats(\._sensitivity_analysis)?\.sobol_indices
35-
scipy\.stats\._?qmc\.QMCEngine\.__init__
36-
scipy\.stats\._?qmc\.Halton\.__init__
37-
scipy\.stats\._?qmc\.LatinHypercube\.__init__
38-
scipy\.stats\._?qmc\.Sobol\.__init__
39-
scipy\.stats\._?qmc\.PoissonDisk\.__init__
40-
scipy\.stats\._?qmc\.MultivariateNormalQMC\.__init__
41-
scipy\.stats\._?qmc\.MultinomialQMC\.__init__
42-
4315
# https://github.com/scipy/scipy/pull/23115
4416
# https://github.com/scipy/scipy/pull/23117
4517
scipy\.linalg\._decomp_interpolative\.__all__
@@ -54,7 +26,7 @@ scipy\.special\._precompute\..*
5426
# useless __new__
5527
scipy\.stats\.(_new_distributions\.)?Normal\.__new__
5628

57-
# these require numpy/numtype to be released
29+
# these require numtype to be released
5830
scipy\.stats\._qmvnt\.phi(nv)?
5931
scipy\.special\._basic\.digamma
6032
scipy\.special\._support_alternative_backends\.betaincc?

pyproject.toml

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
44

55
[project]
66
name = "scipy-stubs"
7-
version = "1.16.0.3.dev0"
7+
version = "1.16.1.0.dev0"
88
description = "Type annotations for SciPy"
99
readme = "README.md"
1010
authors = [
@@ -33,7 +33,7 @@ requires-python = ">=3.11"
3333
dependencies = ["optype[numpy]>=0.13.1,<0.14"]
3434

3535
[project.optional-dependencies]
36-
scipy = ["scipy>=1.16.0,<1.17"]
36+
scipy = ["scipy>=1.16.1,<1.17"]
3737

3838
[project.urls]
3939
Homepage = "https://scipy.org/"
@@ -73,16 +73,12 @@ force-include = { ".mypyignore" = ".mypyignore" } # for scipy-stubs-feedstock
7373
[tool.poe.tasks.clean]
7474
cmd = """
7575
rm -rf
76-
scipy-stubs/**/*.pyc
77-
scipy-stubs/**/__pycache__
78-
scripts/*.pyc
79-
scripts/__pycache__
80-
tests/**/*.pyc
81-
tests/**/__pycache__
82-
./**/.cache
83-
./**/.mypy_cache
84-
./**/.ruff_cache
85-
./**/.tox
76+
**/*.pyc
77+
**/__pycache__
78+
**/.cache
79+
**/.mypy_cache
80+
**/.ruff_cache
81+
**/.tox
8682
"""
8783

8884
[tool.poe.tasks.stubtest]

scipy-stubs/interpolate/_polyint.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,8 @@ class BarycentricInterpolator(_Interpolator1DWithDerivatives[_YT_co], Generic[_Y
177177
axis: int = 0,
178178
*,
179179
wi: onp.ArrayND[npc.floating] | None = None,
180-
seed: onp.random.ToRNG | None = None,
181180
rng: onp.random.ToRNG | None = None,
181+
random_state: onp.random.ToRNG | None = None, # legacy
182182
) -> None: ...
183183
@overload # yi: c128
184184
def __init__(
@@ -189,8 +189,8 @@ class BarycentricInterpolator(_Interpolator1DWithDerivatives[_YT_co], Generic[_Y
189189
axis: int = 0,
190190
*,
191191
wi: onp.ArrayND[npc.floating] | None = None,
192-
seed: onp.random.ToRNG | None = None,
193192
rng: onp.random.ToRNG | None = None,
193+
random_state: onp.random.ToRNG | None = None, # legacy
194194
) -> None: ...
195195

196196
#

scipy-stubs/optimize/_shgo_lib/_complex.pyi

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from collections.abc import Callable, Generator, Sequence
2-
from typing import Concatenate, Final, Generic, TypeAlias
2+
from typing import Concatenate, Final, Generic, Protocol, TypeAlias, type_check_only
33
from typing_extensions import TypeVar
44

55
import numpy as np
@@ -23,6 +23,10 @@ _Symmetry: TypeAlias = onp.ArrayND[npc.integer] | op.CanGetitem[int, op.CanIndex
2323

2424
_HT = TypeVar("_HT", bound=VertexCacheBase, default=VertexCacheBase)
2525

26+
@type_check_only
27+
class SplitEdgeFunction(Protocol):
28+
def __call__(self, /, v1: VertexBase, v2: VertexBase) -> VertexBase: ...
29+
2630
###
2731

2832
class Complex(Generic[_HT]): # undocumented
@@ -49,6 +53,9 @@ class Complex(Generic[_HT]): # undocumented
4953
cp: Generator[_Floats, None, _Floats]
5054
rls: Generator[VertexBase | _Floats]
5155

56+
# awkward annotation for `self.split_edge = functools.cache(self._split_edge)`
57+
split_edge: Final[SplitEdgeFunction]
58+
5259
def __init__(
5360
self,
5461
/,
@@ -78,7 +85,7 @@ class Complex(Generic[_HT]): # undocumented
7885
self, /, origin: _Location, supremum: _Location, bounds: _Bounds, centroid: onp.ToBool = 1
7986
) -> Generator[VertexBase | _Floats]: ...
8087
def refine_star(self, /, v: VertexBase) -> None: ...
81-
def split_edge(self, /, v1: VertexBase, v2: VertexBase) -> VertexBase: ...
88+
def _split_edge(self, /, v1: VertexBase, v2: VertexBase) -> VertexBase: ...
8289
def vpool(self, /, origin: _Location, supremum: _Location) -> set[VertexBase]: ...
8390
def vf_to_vv(self, /, vertices: Sequence[VertexBase], simplices: Sequence[tuple[onp.ToFloat1D, onp.ToFloat1D]]) -> None: ...
8491
def connect_vertex_non_symm(

scipy-stubs/optimize/optimize.pyi

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,14 @@ def brute(
5959
) -> object: ...
6060
@deprecated("will be removed in SciPy v2.0.0")
6161
def check_grad(
62-
func: object, grad: object, x0: object, *args: object, epsilon: object = ..., direction: object = ..., rng: object = ...
62+
func: object,
63+
grad: object,
64+
x0: object,
65+
*args: object,
66+
epsilon: object = ...,
67+
direction: object = ...,
68+
rng: object = None,
69+
seed: object = None,
6370
) -> object: ...
6471
@deprecated("will be removed in SciPy v2.0.0")
6572
def fmin(
@@ -95,6 +102,7 @@ def fmin_bfgs(
95102
c2: object = ...,
96103
hess_inv0: object = ...,
97104
) -> object: ...
105+
@deprecated("will be removed in SciPy v2.0.0")
98106
def fmin_cg(
99107
f: object,
100108
x0: object,

scipy-stubs/sparse/construct.pyi

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,23 @@ def random(
5454
n: object,
5555
density: object = ...,
5656
format: object = ...,
57-
dtype: object = ...,
58-
rng: object = ...,
59-
data_rvs: object = ...,
57+
dtype: object = None,
58+
rng: object = None,
59+
data_rvs: object = None,
60+
*,
61+
random_state: object = None,
6062
) -> Any: ...
6163
@deprecated("will be removed in SciPy v2.0.0")
62-
def rand(m: object, n: object, density: object = ..., format: object = ..., dtype: object = ..., rng: object = ...) -> Any: ...
64+
def rand(
65+
m: object,
66+
n: object,
67+
density: object = ...,
68+
format: object = ...,
69+
dtype: object = None,
70+
rng: object = None,
71+
*,
72+
random_state: object = None,
73+
) -> Any: ...
6374
@deprecated("will be removed in SciPy v2.0.0")
6475
def kron(A: object, B: object, format: object = ...) -> Any: ...
6576
@deprecated("will be removed in SciPy v2.0.0")

scipy-stubs/sparse/linalg/eigen.pyi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,6 @@ def svds(
7575
solver: object = ...,
7676
rng: object = None,
7777
options: object = None,
78+
*,
79+
random_state: object = None,
7880
) -> object: ...

scipy-stubs/version.pyi

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import typing as _t
22

3-
version: _t.Final = "1.16.0"
4-
full_version: _t.Final = "1.16.0"
5-
short_version: _t.Final = "1.16.0"
3+
version: _t.Final = "1.16.1"
4+
full_version: _t.Final = "1.16.1"
5+
short_version: _t.Final = "1.16.1"
66
release: _t.Final = True
77
git_revision: _t.Final[_t.LiteralString] = ...

tests/stats/test_make_distribution.pyi

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from typing import Literal
2-
31
import numpy as np
42

53
from scipy.stats import distributions, make_distribution
@@ -9,7 +7,7 @@ LogUniform: type[ContinuousDistribution] = make_distribution(distributions.logun
97

108
class _DuckRV:
119
@property
12-
def __make_distribution_version__(self) -> Literal["1.16.0"]: ...
10+
def __make_distribution_version__(self) -> str: ...
1311
@property
1412
def parameters(self) -> dict[str, tuple[float, float]]: ...
1513
@property
@@ -18,7 +16,7 @@ class _DuckRV:
1816

1917
class _MultiDuckRV:
2018
@property
21-
def __make_distribution_version__(self) -> Literal["1.16.0"]: ...
19+
def __make_distribution_version__(self) -> str: ...
2220
@property
2321
def parameters(self) -> tuple[dict[str, tuple[float, float]], dict[str, tuple[float, float]]]: ...
2422
def process_parameters(self, quack: float | None = None, swim: float | None = None) -> dict[str, float]: ...

0 commit comments

Comments
 (0)