Skip to content

Commit

Permalink
Merge pull request #61 from jorenham/stubtest/scipy.integrate
Browse files Browse the repository at this point in the history
deal with deprecated `scipy.integrate` modules
  • Loading branch information
jorenham authored Oct 9, 2024
2 parents 40754ae + aa0d2de commit 09b7e1b
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 48 deletions.
34 changes: 27 additions & 7 deletions scipy-stubs/integrate/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from . import _ode, _odepack_py, _quadpack_py, _quadrature, dop, lsoda, odepack, quadpack, vode
from . import dop, lsoda, odepack, quadpack, vode # deprecated namespaces
from ._bvp import solve_bvp
from ._ivp import (
BDF,
Expand All @@ -18,22 +18,42 @@ from ._quad_vec import quad_vec
from ._quadpack_py import *
from ._quadrature import *

__all__ = ["dop", "lsoda", "odepack", "quadpack", "vode"]
__all__ += [
__all__ = [
"BDF",
"DOP853",
"LSODA",
"RK23",
"RK45",
"AccuracyWarning",
"DenseOutput",
"IntegrationWarning",
"ODEintWarning",
"OdeSolution",
"OdeSolver",
"Radau",
"complex_ode",
"cumulative_simpson",
"cumulative_trapezoid",
"dblquad",
"dop",
"fixed_quad",
"lsoda",
"newton_cotes",
"nquad",
"ode",
"odeint",
"odepack",
"qmc_quad",
"quad",
"quad_vec",
"quadpack",
"quadrature",
"romb",
"romberg",
"simpson",
"solve_bvp",
"solve_ivp",
"tplquad",
"trapezoid",
"vode",
]
__all__ += _ode.__all__
__all__ += _odepack_py.__all__
__all__ += _quadpack_py.__all__
__all__ += _quadrature.__all__
17 changes: 8 additions & 9 deletions scipy-stubs/integrate/_ivp/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
from .base import DenseOutput, OdeSolver
from .bdf import BDF
from .common import OdeSolution
from .ivp import solve_ivp
from .lsoda import LSODA
from .radau import Radau
from .rk import DOP853, RK23, RK45
from .base import DenseOutput as DenseOutput, OdeSolver as OdeSolver
from .bdf import BDF as BDF
from .common import OdeSolution as OdeSolution
from .ivp import solve_ivp as solve_ivp
from .lsoda import LSODA as LSODA
from .radau import Radau as Radau
from .rk import DOP853 as DOP853, RK23 as RK23, RK45 as RK45

# NOTE: this __all__ does not exist at runtime
__all__ = ["BDF", "DOP853", "LSODA", "RK23", "RK45", "DenseOutput", "OdeSolution", "OdeSolver", "Radau", "solve_ivp"]
# NOTE: There is no `__all__` at runtime
24 changes: 22 additions & 2 deletions scipy-stubs/integrate/_quadrature.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,29 @@ def qmc_quad(
log: bool = False,
) -> QMCQuadResult: ...
@deprecated("deprecated as of SciPy 1.12.0 and will be removed in SciPy 1.15.0")
def quadrature(*args: object, **kwargs: object) -> tuple[float, float]: ...
def quadrature(
func: object,
a: object,
b: object,
args: tuple[object, ...] = (),
tol: float = ...,
rtol: float = ...,
maxiter: int = ...,
vec_func: bool = ...,
miniter: int = ...,
) -> tuple[float, float]: ...
@deprecated("deprecated as of SciPy 1.12.0 and will be removed in SciPy 1.15.0")
def romberg(*args: object, **kwargs: object) -> float: ...
def romberg(
function: object,
a: object,
b: object,
args: tuple[object, ...] = (),
tol: float = ...,
rtol: float = ...,
show: bool = ...,
divmax: int = ...,
vec_func: bool = ...,
) -> float: ...

# low-level
def newton_cotes(rn: int, equal: int = 0) -> tuple[onpt.Array[tuple[int], np.float64], float]: ...
9 changes: 2 additions & 7 deletions scipy-stubs/integrate/lsoda.pyi
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
# This file is not meant for public use and will be removed in SciPy v2.0.0.
from typing_extensions import Never, deprecated
__all__ = ["lsoda"]

__all__: list[Never] = []

@deprecated("will be removed in SciPy 2.0.0.")
def __dir__() -> list[Never]: ...
@deprecated("will be removed in SciPy 2.0.0.")
def __getattr__(name: str) -> Never: ... # pyright: ignore[reportIncompleteStub]
lsoda: object
10 changes: 5 additions & 5 deletions scipy-stubs/integrate/odepack.pyi
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# This file is not meant for public use and will be removed in SciPy v2.0.0.
from typing_extensions import Never, deprecated
from typing_extensions import deprecated

__all__: list[Never] = []
from ._odepack_py import odeint

__all__ = ["ODEintWarning", "odeint"]

@deprecated("will be removed in SciPy 2.0.0.")
def __dir__() -> list[Never]: ...
@deprecated("will be removed in SciPy 2.0.0.")
def __getattr__(name: str) -> Never: ... # pyright: ignore[reportIncompleteStub]
class ODEintWarning(Warning): ...
12 changes: 6 additions & 6 deletions scipy-stubs/integrate/quadpack.pyi
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# This file is not meant for public use and will be removed in SciPy v2.0.0.
from typing_extensions import Never, deprecated
from typing_extensions import deprecated

__all__: list[Never] = []
from ._quadpack_py import dblquad, nquad, quad, tplquad

@deprecated("will be removed in SciPy 2.0.0.")
def __dir__() -> list[Never]: ...
@deprecated("will be removed in SciPy 2.0.0.")
def __getattr__(name: str) -> Never: ... # pyright: ignore[reportIncompleteStub]
__all__ = ["IntegrationWarning", "dblquad", "nquad", "quad", "tplquad"]

@deprecated("will be removed in SciPy v2.0.0")
class IntegrationWarning(UserWarning): ...
15 changes: 3 additions & 12 deletions tests/stubtest/allowlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,6 @@ scipy.stats._unuran.unuran_wrapper
# deprecated public api (will be removed in scipy 2.0.0)
scipy.constants.codata
scipy.constants.constants
scipy.integrate.lsoda.*
scipy.integrate.odepack.*
scipy.integrate.quadpack.*
scipy.integrate.quadrature
scipy.integrate.romberg
scipy.integrate._quadrature.quadrature
scipy.integrate._quadrature.romberg
scipy.linalg.basic.*
scipy.linalg.decomp.*
scipy.linalg.matfuncs.*
Expand All @@ -108,19 +101,14 @@ scipy.interpolate._interpnd_info

# deprecated submodules are removed from these `__all__`
scipy.constants.__all__
scipy.integrate.__all__
scipy.linalg.__all__
scipy.stats.__all__

# TODO
scipy._lib._ccallback.__all__
scipy._lib.array_api_compat.__all__
scipy._lib.array_api_compat.common.__all__
scipy.integrate._ivp.__all__
scipy.signal._signaltools.__all__
scipy.spatial.ckdtree.__all__
scipy.spatial.kdtree.__all__
scipy.spatial.qhull.__all__
scipy.sparse._matrix.__all__
scipy.sparse.csgraph.__all__
scipy.sparse.csgraph._flow.__all__
Expand All @@ -133,6 +121,9 @@ scipy.sparse.csgraph._tools.__all__
scipy.sparse.csgraph._traversal.__all__
scipy.sparse.linalg._dsolve.__all__
scipy.sparse.linalg._dsolve._superlu.__all__
scipy.spatial.ckdtree.__all__
scipy.spatial.kdtree.__all__
scipy.spatial.qhull.__all__
scipy.spatial.transform._rotation.__all__
scipy.spatial.transform._rotation_spline.__all__
scipy.stats._binomtest.__all__
Expand Down

0 comments on commit 09b7e1b

Please sign in to comment.