Repository: scipy/scipy

Issue:
DEP: deprecate aliased integration methods that are (close to) slurs
Main discussion was in #12924. At the time the main methods were renamed but the old names left as aliases for backwards compatibility (see #12934). In the interest of code health, we shouldn't keep these around forever, so let's add an explicit deprecation warning to `simps`, `trapz` and `cumtrapz`, so that it can be removed in 2 releases.


Discussion:

Resolving patch:
diff --git a/scipy/integrate/_quadrature.py b/scipy/integrate/_quadrature.py
--- a/scipy/integrate/_quadrature.py
+++ b/scipy/integrate/_quadrature.py
@@ -134,6 +134,9 @@ def trapz(y, x=None, dx=1.0, axis=-1):
     `trapz` is kept for backwards compatibility. For new code, prefer
     `trapezoid` instead.
     """
+    msg = ("'scipy.integrate.trapz' is deprecated in favour of "
+           "'scipy.integrate.trapezoid' and will be removed in SciPy 1.14.0")
+    warnings.warn(msg, DeprecationWarning, stacklevel=2)
     return trapezoid(y, x=x, dx=dx, axis=axis)
 
 
@@ -387,6 +390,10 @@ def cumtrapz(y, x=None, dx=1.0, axis=-1, initial=None):
     `cumtrapz` is kept for backwards compatibility. For new code, prefer
     `cumulative_trapezoid` instead.
     """
+    msg = ("'scipy.integrate.cumtrapz' is deprecated in favour of "
+           "'scipy.integrate.cumulative_trapezoid' and will be removed "
+           "in SciPy 1.14.0")
+    warnings.warn(msg, DeprecationWarning, stacklevel=2)
     return cumulative_trapezoid(y, x=x, dx=dx, axis=axis, initial=initial)
 
 
@@ -528,6 +535,9 @@ def simps(y, x=None, dx=1.0, axis=-1, even=None):
     `simps` is kept for backwards compatibility. For new code, prefer
     `simpson` instead.
     """
+    msg = ("'scipy.integrate.simps' is deprecated in favour of "
+           "'scipy.integrate.simpson' and will be removed in SciPy 1.14.0")
+    warnings.warn(msg, DeprecationWarning, stacklevel=2)
     return simpson(y, x=x, dx=dx, axis=axis, even=even)
 
 


Test patch:
diff --git a/scipy/integrate/tests/test_quadrature.py b/scipy/integrate/tests/test_quadrature.py
--- a/scipy/integrate/tests/test_quadrature.py
+++ b/scipy/integrate/tests/test_quadrature.py
@@ -253,10 +253,11 @@ def test_simps(self):
         # Basic coverage test for the alias
         y = np.arange(5)
         x = 2**y
-        assert_allclose(
-            simpson(y, x=x, dx=0.5),
-            simps(y, x=x, dx=0.5)
-        )
+        with pytest.deprecated_call(match="simpson"):
+            assert_allclose(
+                simpson(y, x=x, dx=0.5),
+                simps(y, x=x, dx=0.5)
+            )
 
 
 class TestCumulative_trapezoid:
@@ -338,9 +339,10 @@ def test_cumtrapz(self):
         # Basic coverage test for the alias
         x = np.arange(3 * 2 * 4).reshape(3, 2, 4)
         y = x
-        assert_allclose(cumulative_trapezoid(y, x, dx=0.5, axis=0, initial=0),
-                        cumtrapz(y, x, dx=0.5, axis=0, initial=0),
-                        rtol=1e-14)
+        with pytest.deprecated_call(match="cumulative_trapezoid"):
+            assert_allclose(cumulative_trapezoid(y, x, dx=0.5, axis=0, initial=0),
+                            cumtrapz(y, x, dx=0.5, axis=0, initial=0),
+                            rtol=1e-14)
 
 
 class TestTrapezoid:
@@ -360,8 +362,9 @@ def test_trapz(self):
         # Basic coverage test for the alias
         y = np.arange(4)
         x = 2**y
-        assert_equal(trapezoid(y, x=x, dx=0.5, axis=0),
-                     trapz(y, x=x, dx=0.5, axis=0))
+        with pytest.deprecated_call(match="trapezoid"):
+            assert_equal(trapezoid(y, x=x, dx=0.5, axis=0),
+                         trapz(y, x=x, dx=0.5, axis=0))
 
 
 class TestQMCQuad:
diff --git a/scipy/stats/tests/test_distributions.py b/scipy/stats/tests/test_distributions.py
--- a/scipy/stats/tests/test_distributions.py
+++ b/scipy/stats/tests/test_distributions.py
@@ -3891,10 +3891,10 @@ def test_sf_small_K(self, x, K, scale, expected):
 
 class TestGenExpon:
     def test_pdf_unity_area(self):
-        from scipy.integrate import simps
+        from scipy.integrate import simpson
         # PDF should integrate to one
         p = stats.genexpon.pdf(numpy.arange(0, 10, 0.01), 0.5, 0.5, 2.0)
-        assert_almost_equal(simps(p, dx=0.01), 1, 1)
+        assert_almost_equal(simpson(p, dx=0.01), 1, 1)
 
     def test_cdf_bounds(self):
         # CDF should always be positive