summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntonio Rojas2024-06-28 08:50:50 +0200
committerAntonio Rojas2024-06-28 08:50:50 +0200
commit9cb3e8e3f77028b42248ff4c88e6552d03d095cb (patch)
tree063aeafe17a8a8f9fbcd8eb5c99688799bc2c86a
parenta71e5dfb313cd962a1743e2e462dfb49530c4e0a (diff)
downloadaur-sagemath-git.tar.gz
Drop merged patch, add numpy 2.0 support
-rw-r--r--.SRCINFO8
-rw-r--r--PKGBUILD10
-rw-r--r--sagemath-numpy-2.0.patch705
-rw-r--r--sagemath-tdlib-0.9.patch28
4 files changed, 714 insertions, 37 deletions
diff --git a/.SRCINFO b/.SRCINFO
index d29f5b6ea8db..42c1ebde27da 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,6 +1,6 @@
pkgbase = sagemath-git
pkgdesc = Open Source Mathematics Software, free alternative to Magma, Maple, Mathematica, and Matlab
- pkgver = 10.4.beta8.r0.ge5f42fac703
+ pkgver = 10.4.rc1.r0.gb7dd28d2456
pkgrel = 1
url = http://www.sagemath.org
arch = x86_64
@@ -16,7 +16,7 @@ pkgbase = sagemath-git
makedepends = python-setuptools
makedepends = shared_meataxe
makedepends = sirocco
- makedepends = tdlib
+ makedepends = treedec
depends = brial
depends = cblas
depends = cliquer
@@ -129,9 +129,9 @@ pkgbase = sagemath-git
conflicts = sagemath
source = git+https://github.com/sagemath/sage#branch=develop
source = latte-count.patch
- source = sagemath-tdlib-0.9.patch
+ source = sagemath-numpy-2.0.patch
sha256sums = SKIP
sha256sums = 5cd2f88965d7ebab9dfab6f5c2040d363a4a5ae41230219cc7070b907381da5a
- sha256sums = 56a83abecf2ff5a500442adc7a50abbb70006037dd39c39dcdb04b3ca9fb51e2
+ sha256sums = bed395c2150fa7d812b565021b0b10ce0f8b2b027a594d8f19bb3639bccf9018
pkgname = sagemath-git
diff --git a/PKGBUILD b/PKGBUILD
index 6e8deb762cb5..1ddc411f254d 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -6,7 +6,7 @@
# Contributor: Stefan Husmann <stefan-husmann at t-online dot de>
pkgname=sagemath-git
-pkgver=10.4.beta8.r0.ge5f42fac703
+pkgver=10.4.rc1.r0.gb7dd28d2456
pkgrel=1
pkgdesc='Open Source Mathematics Software, free alternative to Magma, Maple, Mathematica, and Matlab'
arch=(x86_64)
@@ -136,10 +136,10 @@ conflicts=(sagemath)
provides=(sagemath)
source=(git+https://github.com/sagemath/sage#branch=develop
latte-count.patch
- sagemath-tdlib-0.9.patch)
+ sagemath-numpy-2.0.patch)
sha256sums=('SKIP'
'5cd2f88965d7ebab9dfab6f5c2040d363a4a5ae41230219cc7070b907381da5a'
- '56a83abecf2ff5a500442adc7a50abbb70006037dd39c39dcdb04b3ca9fb51e2')
+ 'bed395c2150fa7d812b565021b0b10ce0f8b2b027a594d8f19bb3639bccf9018')
_pkgs=(standard
bliss
coxeter3
@@ -158,8 +158,8 @@ prepare(){
# use correct latte-count binary name
patch -p1 -i ../latte-count.patch
-# update to tdlib 0.9 (Fedora)
- patch -p1 -i ../sagemath-tdlib-0.9.patch
+# fix tests with numpy 2.0
+ patch -p1 -i ../sagemath-numpy-2.0.patch
./bootstrap
}
diff --git a/sagemath-numpy-2.0.patch b/sagemath-numpy-2.0.patch
new file mode 100644
index 000000000000..23cd3c9b228d
--- /dev/null
+++ b/sagemath-numpy-2.0.patch
@@ -0,0 +1,705 @@
+From 9ff008b020c714428d3a9d79b0eeae3976bf76f7 Mon Sep 17 00:00:00 2001
+From: Dima Pasechnik <dimpase@gmail.com>
+Date: Thu, 20 Jun 2024 19:14:01 +0100
+Subject: [PATCH 1/2] provide compatibility with numpy 2.0
+
+---
+ src/doc/en/faq/faq-usage.rst | 2 +-
+ .../Statistics-and-Distributions.rst | 2 ++
+ .../thematic_tutorials/numerical_sage/numpy.rst | 2 ++
+ src/doc/it/faq/faq-usage.rst | 2 +-
+ src/sage/arith/misc.py | 2 +-
+ src/sage/calculus/interpolators.pyx | 3 +++
+ src/sage/calculus/riemann.pyx | 3 +++
+ src/sage/combinat/fully_packed_loop.py | 3 +++
+ src/sage/env.py | 2 +-
+ src/sage/functions/special.py | 3 +++
+ .../graphs/generators/classical_geometries.py | 2 +-
+ src/sage/graphs/generic_graph.py | 3 +++
+ src/sage/graphs/graph_generators_pyx.pyx | 2 +-
+ src/sage/modules/free_module_element.pyx | 8 ++++++++
+ src/sage/numerical/optimize.py | 17 +++++++++++++++++
+ src/sage/plot/arrow.py | 3 +++
+ src/sage/plot/complex_plot.pyx | 6 ++----
+ src/sage/plot/graphics.py | 2 +-
+ src/sage/plot/histogram.py | 2 ++
+ src/sage/plot/multigraphics.py | 6 ++++++
+ src/sage/plot/plot3d/implicit_surface.pyx | 2 ++
+ src/sage/plot/scatter_plot.py | 4 ++--
+ src/sage/plot/streamline_plot.py | 3 +++
+ .../probability/probability_distribution.pyx | 3 +++
+ src/sage/rings/complex_double.pyx | 10 +++++-----
+ src/sage/rings/integer.pyx | 2 ++
+ .../rings/polynomial/polynomial_element.pyx | 2 +-
+ src/sage/rings/real_mpfi.pyx | 2 ++
+ .../elliptic_curves/period_lattice_region.pyx | 10 ++++++++++
+ src/sage/stats/basic_stats.py | 4 ++++
+ src/sage/stats/time_series.pyx | 2 ++
+ src/sage/structure/coerce.pyx | 2 ++
+ src/sage/symbolic/expression.pyx | 2 +-
+ src/sage/symbolic/function.pyx | 3 +++
+ src/sage/symbolic/ring.pyx | 2 ++
+ 35 files changed, 108 insertions(+), 20 deletions(-)
+
+diff --git a/src/doc/en/faq/faq-usage.rst b/src/doc/en/faq/faq-usage.rst
+index 53f225fd729..d03881c36a2 100644
+--- a/src/doc/en/faq/faq-usage.rst
++++ b/src/doc/en/faq/faq-usage.rst
+@@ -324,7 +324,7 @@ ints. For example::
+ sage: RealNumber = float; Integer = int
+ sage: from scipy import stats
+ sage: stats.ttest_ind([1,2,3,4,5], [2,3,4,5,.6])
+- Ttest...Result(statistic=0.0767529..., pvalue=0.940704...)
++ Ttest...Result(statistic=...0.0767529..., pvalue=...0.940704...)
+ sage: stats.uniform(0,15).ppf([0.5,0.7])
+ array([ 7.5, 10.5])
+
+diff --git a/src/doc/en/prep/Quickstarts/Statistics-and-Distributions.rst b/src/doc/en/prep/Quickstarts/Statistics-and-Distributions.rst
+index b5eb3d842a2..958a378f945 100644
+--- a/src/doc/en/prep/Quickstarts/Statistics-and-Distributions.rst
++++ b/src/doc/en/prep/Quickstarts/Statistics-and-Distributions.rst
+@@ -24,6 +24,8 @@ NumPy provides, for example, functions to compute the arithmetic mean and
+ the standard deviation::
+
+ sage: import numpy as np
++ sage: if int(np.version.short_version[0]) > 1:
++ ....: np.set_printoptions(legacy="1.25")
+ sage: np.mean([1, 2, 3, 5])
+ 2.75
+
+diff --git a/src/doc/en/thematic_tutorials/numerical_sage/numpy.rst b/src/doc/en/thematic_tutorials/numerical_sage/numpy.rst
+index dbc2de71d42..925e5312882 100644
+--- a/src/doc/en/thematic_tutorials/numerical_sage/numpy.rst
++++ b/src/doc/en/thematic_tutorials/numerical_sage/numpy.rst
+@@ -7,6 +7,8 @@ import it.
+ ::
+
+ sage: import numpy
++ sage: if int(numpy.version.short_version[0]) > 1:
++ ....: numpy.set_printoptions(legacy="1.25") # to ensure numpy 2.0 compatibility
+
+ The basic object of computation in NumPy is an array. It is simple to
+ create an array.
+diff --git a/src/doc/it/faq/faq-usage.rst b/src/doc/it/faq/faq-usage.rst
+index 37bef7b13c1..5d3183769f7 100644
+--- a/src/doc/it/faq/faq-usage.rst
++++ b/src/doc/it/faq/faq-usage.rst
+@@ -305,7 +305,7 @@ anziché Integer di Sage. Ad esempio::
+ sage: RealNumber = float; Integer = int
+ sage: from scipy import stats
+ sage: stats.ttest_ind([1,2,3,4,5], [2,3,4,5,.6])
+- Ttest...Result(statistic=0.0767529..., pvalue=0.940704...)
++ Ttest...Result(statistic=...0.0767529..., pvalue=...0.940704...)
+ sage: stats.uniform(0,15).ppf([0.5,0.7])
+ array([ 7.5, 10.5])
+
+diff --git a/src/sage/arith/misc.py b/src/sage/arith/misc.py
+index 310f2b0b189..6ffcc95ff8a 100644
+--- a/src/sage/arith/misc.py
++++ b/src/sage/arith/misc.py
+@@ -2277,7 +2277,7 @@ def power_mod(a, n, m):
+
+ sage: from numpy import int32 # needs numpy
+ sage: power_mod(int32(2), int32(390), int32(391)) # needs numpy
+- 285
++ ...285...
+ sage: from gmpy2 import mpz
+ sage: power_mod(mpz(2), mpz(390), mpz(391))
+ mpz(285)
+diff --git a/src/sage/calculus/interpolators.pyx b/src/sage/calculus/interpolators.pyx
+index 221b52369e2..bb0be7bab0c 100644
+--- a/src/sage/calculus/interpolators.pyx
++++ b/src/sage/calculus/interpolators.pyx
+@@ -27,6 +27,9 @@ Development supported by NSF award No. 0702939.
+ import numpy as np
+ cimport numpy as np
+
++if int(np.version.short_version[0]) > 1:
++ np.set_printoptions(legacy="1.25")
++
+ from math import pi
+ cdef double TWOPI = 2*pi
+
+diff --git a/src/sage/calculus/riemann.pyx b/src/sage/calculus/riemann.pyx
+index 6ec80d89aa7..c09d93c4260 100644
+--- a/src/sage/calculus/riemann.pyx
++++ b/src/sage/calculus/riemann.pyx
+@@ -44,6 +44,9 @@ from sage.calculus.integration import numerical_integral
+ import numpy as np
+ cimport numpy as np
+
++if int(np.version.short_version[0]) > 1:
++ np.set_printoptions(legacy="1.25")
++
+ from math import pi
+ from math import sin
+ from math import cos
+diff --git a/src/sage/combinat/fully_packed_loop.py b/src/sage/combinat/fully_packed_loop.py
+index b198fed0c0d..b3ebd206cd2 100644
+--- a/src/sage/combinat/fully_packed_loop.py
++++ b/src/sage/combinat/fully_packed_loop.py
+@@ -66,6 +66,9 @@ def _make_color_list(n, colors=None, color_map=None, randomize=False):
+ r"""
+ TESTS::
+
++ sage: import numpy as np
++ sage: if int(np.version.short_version[0]) > 1:
++ ....: np.set_printoptions(legacy="1.25")
+ sage: from sage.combinat.fully_packed_loop import _make_color_list
+ sage: _make_color_list(5)
+ sage: _make_color_list(5, ['blue', 'red'])
+diff --git a/src/sage/env.py b/src/sage/env.py
+index 722649ab3da..abb9b19f9e3 100644
+--- a/src/sage/env.py
++++ b/src/sage/env.py
+@@ -296,7 +296,7 @@ def sage_include_directories(use_sources=False):
+ sage: import sage.env
+ sage: sage.env.sage_include_directories()
+ ['...',
+- '.../numpy/core/include',
++ '.../numpy/...core/include',
+ '.../include/python...']
+
+ To check that C/C++ files are correctly found, we verify that we can
+diff --git a/src/sage/functions/special.py b/src/sage/functions/special.py
+index e100ba3ee23..2a03bb68f67 100644
+--- a/src/sage/functions/special.py
++++ b/src/sage/functions/special.py
+@@ -217,6 +217,9 @@ class SphericalHarmonic(BuiltinFunction):
+ sage: spherical_harmonic(1, 1, pi/2, pi).n() # abs tol 1e-14 # needs sage.symbolic
+ 0.345494149471335
+ sage: from scipy.special import sph_harm # NB: arguments x and y are swapped # needs scipy
++ sage: import numpy as np # needs scipy
++ sage: if int(np.version.short_version[0]) > 1: # needs scipy
++ ....: np.set_printoptions(legacy="1.25") # needs scipy
+ sage: sph_harm(1, 1, pi.n(), (pi/2).n()) # abs tol 1e-14 # needs scipy sage.symbolic
+ (0.3454941494713355-4.231083042742082e-17j)
+
+diff --git a/src/sage/graphs/generators/classical_geometries.py b/src/sage/graphs/generators/classical_geometries.py
+index da04362eef3..957f88d2061 100644
+--- a/src/sage/graphs/generators/classical_geometries.py
++++ b/src/sage/graphs/generators/classical_geometries.py
+@@ -1315,7 +1315,7 @@ def CossidentePenttilaGraph(q):
+
+ from sage.libs.gap.libgap import libgap
+ adj_list = libgap.function_factory("""function(q)
+- local z, e, so, G, nu, G1, G0, B, T, s, O1, O2, x;
++ local z, e, so, G, nu, G1, G0, B, T, s, O1, O2, x, sqo;
+ LoadPackage("grape");
+ G0:=SO(3,q^2);
+ so:=GeneratorsOfGroup(G0);
+diff --git a/src/sage/graphs/generic_graph.py b/src/sage/graphs/generic_graph.py
+index d3d6a4e8b0c..402cc91107d 100644
+--- a/src/sage/graphs/generic_graph.py
++++ b/src/sage/graphs/generic_graph.py
+@@ -18418,6 +18418,9 @@ def shortest_path_all_pairs(self, by_weight=False, algorithm=None,
+ M = self.adjacency_matrix(vertices=int_to_vertex)
+
+ # We call the Floyd-Warshall method from SciPy
++ import numpy # to ensure numpy 2.0 compatibility
++ if int(numpy.version.short_version[0]) > 1:
++ numpy.set_printoptions(legacy="1.25")
+ from numpy import array as np_array
+ from scipy.sparse.csgraph import floyd_warshall
+ dd, pp = floyd_warshall(np_array(M), directed=self.is_directed(),
+diff --git a/src/sage/graphs/graph_generators_pyx.pyx b/src/sage/graphs/graph_generators_pyx.pyx
+index 033e8b22adc..04b20d3229b 100644
+--- a/src/sage/graphs/graph_generators_pyx.pyx
++++ b/src/sage/graphs/graph_generators_pyx.pyx
+@@ -57,7 +57,7 @@ def RandomGNP(n, p, bint directed=False, bint loops=False, seed=None):
+
+ sage: from numpy import mean # needs numpy
+ sage: abs(mean([RandomGNP(200, .2).density() for i in range(30)]) - .2) < .001 # needs numpy
+- True
++ ...True...
+ sage: RandomGNP(150, .2, loops=True)
+ Traceback (most recent call last):
+ ...
+diff --git a/src/sage/modules/free_module_element.pyx b/src/sage/modules/free_module_element.pyx
+index 4500695e297..649b532b99c 100644
+--- a/src/sage/modules/free_module_element.pyx
++++ b/src/sage/modules/free_module_element.pyx
+@@ -547,7 +547,11 @@ def vector(arg0, arg1=None, arg2=None, sparse=None, immutable=False):
+ R = None
+
+ try:
++ import numpy
+ from numpy import ndarray
++ if int(numpy.version.short_version[0]) > 1:
++ numpy.set_printoptions(legacy="1.25")
++
+ except ImportError:
+ pass
+ else:
+@@ -1180,7 +1184,11 @@ cdef class FreeModuleElement(Vector): # abstract base class
+ over Rational Field to numpy array of type <... 'float'>:
+ setting an array element with a sequence.
+ """
++ import numpy
+ from numpy import array
++ if int(numpy.version.short_version[0]) > 1:
++ numpy.set_printoptions(legacy="1.25")
++
+ try:
+ return array(self, dtype=dtype)
+ except ValueError as e:
+diff --git a/src/sage/numerical/optimize.py b/src/sage/numerical/optimize.py
+index e3d94d1746e..7ae8ca4966f 100644
+--- a/src/sage/numerical/optimize.py
++++ b/src/sage/numerical/optimize.py
+@@ -155,6 +155,10 @@ def find_root(f, a, b, xtol=10e-13, rtol=2.0**-50, maxiter=100, full_output=Fals
+ b = max(s_1, s_2)
+
+ import scipy.optimize
++ import numpy
++ if int(numpy.version.short_version[0]) > 1:
++ numpy.set_printoptions(legacy="1.25")
++
+ g = lambda x: float(f(x))
+ brentqRes = scipy.optimize.brentq(g, a, b,
+ full_output=full_output, xtol=xtol, rtol=rtol, maxiter=maxiter)
+@@ -288,6 +292,10 @@ def find_local_minimum(f, a, b, tol=1.48e-08, maxfun=500):
+ a = float(a)
+ b = float(b)
+ import scipy.optimize
++ import numpy
++ if int(numpy.version.short_version[0]) > 1:
++ numpy.set_printoptions(legacy="1.25")
++
+ xmin, fval, iter, funcalls = scipy.optimize.fminbound(f, a, b, full_output=1, xtol=tol, maxfun=maxfun)
+ return fval, xmin
+
+@@ -376,6 +384,8 @@ def minimize(func, x0, gradient=None, hessian=None, algorithm="default",
+ sage: def rosen(x): # The Rosenbrock function
+ ....: return sum(100.0r*(x[1r:]-x[:-1r]**2.0r)**2.0r + (1r-x[:-1r])**2.0r)
+ sage: import numpy
++ sage: if int(numpy.version.short_version[0]) > 1:
++ ....: numpy.set_printoptions(legacy="1.25")
+ sage: from numpy import zeros
+ sage: def rosen_der(x):
+ ....: xm = x[1r:-1r]
+@@ -393,6 +403,9 @@ def minimize(func, x0, gradient=None, hessian=None, algorithm="default",
+ from sage.structure.element import Expression
+ from sage.ext.fast_callable import fast_callable
+ import numpy
++ if int(numpy.version.short_version[0]) > 1:
++ numpy.set_printoptions(legacy="1.25")
++
+ from scipy import optimize
+ if isinstance(func, Expression):
+ var_list = func.variables()
+@@ -530,6 +543,8 @@ def minimize_constrained(func,cons,x0,gradient=None,algorithm='default', **args)
+ from sage.structure.element import Expression
+ from sage.ext.fast_callable import fast_callable
+ import numpy
++ if int(numpy.version.short_version[0]) > 1:
++ numpy.set_printoptions(legacy="1.25")
+ from scipy import optimize
+ function_type = type(lambda x,y: x+y)
+
+@@ -652,6 +667,8 @@ def find_fit(data, model, initial_guess=None, parameters=None, variables=None, s
+ ``lmdif`` and ``lmder`` algorithms.
+ """
+ import numpy
++ if int(numpy.version.short_version[0]) > 1:
++ numpy.set_printoptions(legacy="1.25")
+
+ if not isinstance(data, numpy.ndarray):
+ try:
+diff --git a/src/sage/plot/arrow.py b/src/sage/plot/arrow.py
+index ac1dc79d802..23e2517ca56 100644
+--- a/src/sage/plot/arrow.py
++++ b/src/sage/plot/arrow.py
+@@ -53,6 +53,9 @@ def get_minmax_data(self):
+
+ EXAMPLES::
+
++ sage: import numpy # to ensure numpy 2.0 compatibility
++ sage: if int(numpy.version.short_version[0]) > 1:
++ ....: numpy.set_printoptions(legacy="1.25")
+ sage: from sage.plot.arrow import CurveArrow
+ sage: b = CurveArrow(path=[[(0,0),(.5,.5),(1,0)],[(.5,1),(0,0)]],
+ ....: options={})
+diff --git a/src/sage/plot/complex_plot.pyx b/src/sage/plot/complex_plot.pyx
+index f1f2671a803..4d71414e1c2 100644
+--- a/src/sage/plot/complex_plot.pyx
++++ b/src/sage/plot/complex_plot.pyx
+@@ -1282,15 +1282,13 @@ def rgb_to_hls(rgb):
+ raise ValueError("Last dimension of input array must be 3; "
+ "shape {} was found.".format(rgb.shape))
+ in_shape = rgb.shape
+- rgb = np.array(
+- rgb, copy=False, dtype=np.dtype(float), ndmin=2
+- )
++ rgb = np.asarray(rgb, dtype=np.dtype(float))
+ rgb_max = rgb.max(-1)
+ rgb_min = rgb.min(-1)
+ l = (rgb_max + rgb_min)/2.0 # lightness
+
+ hls = np.zeros_like(rgb)
+- delta = rgb.ptp(-1)
++ delta = np.ptp(rgb, -1)
+ s = np.zeros_like(delta)
+
+ ipos = delta > 0
+diff --git a/src/sage/plot/graphics.py b/src/sage/plot/graphics.py
+index a5e46d07c2d..83595edab0c 100644
+--- a/src/sage/plot/graphics.py
++++ b/src/sage/plot/graphics.py
+@@ -2746,7 +2746,7 @@ def matplotlib(self, filename=None,
+ sage: xmin, xmax = sub.get_xlim()
+ sage: ymin, ymax = sub.get_ylim()
+ sage: xmin > xmax, ymin > ymax
+- (True, True)
++ (...True..., ...True...)
+ """
+ if not isinstance(ticks, (list, tuple)):
+ ticks = (ticks, None)
+diff --git a/src/sage/plot/histogram.py b/src/sage/plot/histogram.py
+index fa86a44bd0a..a585cacf9cd 100644
+--- a/src/sage/plot/histogram.py
++++ b/src/sage/plot/histogram.py
+@@ -92,6 +92,8 @@ def get_minmax_data(self):
+ {'xmax': 10.0, 'xmin': 3.0, 'ymax': 0.476190476190..., 'ymin': 0}
+ """
+ import numpy
++ if int(numpy.version.short_version[0]) > 1:
++ numpy.set_printoptions(legacy="1.25")
+
+ # Extract these options (if they are not None) and pass them to
+ # histogram()
+diff --git a/src/sage/plot/multigraphics.py b/src/sage/plot/multigraphics.py
+index f657e1d369e..c6c71a72d7e 100644
+--- a/src/sage/plot/multigraphics.py
++++ b/src/sage/plot/multigraphics.py
+@@ -785,6 +785,9 @@ def _add_subplot(self, figure, index, **options):
+ True
+ sage: G.position(1)
+ (0.2, 0.3, 0.4, 0.1)
++ sage: import numpy # to ensure numpy 2.0 compatibility
++ sage: if int(numpy.version.short_version[0]) > 1:
++ ....: numpy.set_printoptions(legacy="1.25")
+ sage: ax1.get_position().bounds # tol 1.0e-13
+ (0.2, 0.3, 0.4000000000000001, 0.10000000000000003)
+
+@@ -1296,6 +1299,9 @@ def position(self, index):
+ sage: g1 = plot(sin(x), (x, -pi, pi))
+ sage: g2 = circle((0,1), 1.)
+ sage: G = graphics_array([g1, g2])
++ sage: import numpy # to ensure numpy 2.0 compatibility
++ sage: if int(numpy.version.short_version[0]) > 1:
++ ....: numpy.set_printoptions(legacy="1.25")
+ sage: G.position(0) # tol 5.0e-3
+ (0.025045451349937315,
+ 0.03415488992713045,
+diff --git a/src/sage/plot/plot3d/implicit_surface.pyx b/src/sage/plot/plot3d/implicit_surface.pyx
+index ce0da48a4e0..f4d5059b620 100644
+--- a/src/sage/plot/plot3d/implicit_surface.pyx
++++ b/src/sage/plot/plot3d/implicit_surface.pyx
+@@ -468,6 +468,7 @@ cdef class MarchingCubesTriangles(MarchingCubes):
+ sage: cube_marcher.y_vertices.tolist()
+ [[[<1.0, 0.5, 0.0>, None]], [[None, None]]]
+ sage: cube_marcher.x_vertices.any() # This shouldn't affect the X vertices.
++ ...
+ """
+ (self.y_vertices, self.y_vertices_swapped) = \
+ (self.y_vertices_swapped, self.y_vertices)
+@@ -574,6 +575,7 @@ cdef class MarchingCubesTriangles(MarchingCubes):
+ sage: cube_marcher.x_vertices.tolist()
+ [[None, None], [None, <1.5, 1.0, 1.0>]]
+ sage: cube_marcher.y_vertices.any() or cube_marcher.z_vertices.any() # This shouldn't affect the Y or Z vertices.
++ ...
+ """
+ cdef bint has_prev = (_prev is not None)
+ cdef bint has_next = (_next is not None)
+diff --git a/src/sage/plot/scatter_plot.py b/src/sage/plot/scatter_plot.py
+index 4ad418f040b..781854d372c 100644
+--- a/src/sage/plot/scatter_plot.py
++++ b/src/sage/plot/scatter_plot.py
+@@ -63,9 +63,9 @@ def get_minmax_data(self):
+ sage: s = scatter_plot([[0,1],[2,4],[3.2,6]])
+ sage: d = s.get_minmax_data()
+ sage: d['xmin']
+- 0.0
++ ...0.0...
+ sage: d['ymin']
+- 1.0
++ ...1.0...
+ """
+ return {'xmin': self.xdata.min(),
+ 'xmax': self.xdata.max(),
+diff --git a/src/sage/plot/streamline_plot.py b/src/sage/plot/streamline_plot.py
+index 663d3aee70b..d2cb11088c7 100644
+--- a/src/sage/plot/streamline_plot.py
++++ b/src/sage/plot/streamline_plot.py
+@@ -71,6 +71,9 @@ def get_minmax_data(self):
+ EXAMPLES::
+
+ sage: x, y = var('x y')
++ sage: import numpy # to ensure numpy 2.0 compatibility
++ sage: if int(numpy.version.short_version[0]) > 1:
++ ....: numpy.set_printoptions(legacy="1.25")
+ sage: d = streamline_plot((.01*x, x+y), (x,10,20), (y,10,20))[0].get_minmax_data()
+ sage: d['xmin']
+ 10.0
+diff --git a/src/sage/probability/probability_distribution.pyx b/src/sage/probability/probability_distribution.pyx
+index e2c71af9c25..59ba4a95ab6 100644
+--- a/src/sage/probability/probability_distribution.pyx
++++ b/src/sage/probability/probability_distribution.pyx
+@@ -140,6 +140,9 @@ cdef class ProbabilityDistribution:
+ 1.8,
+ 2.0]
+ """
++ import numpy as np
++ if int(np.version.short_version[0]) > 1:
++ np.set_printoptions(legacy="1.25")
+ import pylab
+ ell = [float(self.get_random_element()) for _ in range(num_samples)]
+ S = pylab.hist(ell, bins, density=True)
+diff --git a/src/sage/rings/complex_double.pyx b/src/sage/rings/complex_double.pyx
+index 2f85cbd101a..f8c5a474229 100644
+--- a/src/sage/rings/complex_double.pyx
++++ b/src/sage/rings/complex_double.pyx
+@@ -2550,10 +2550,10 @@ cdef class ComplexToCDF(Morphism):
+
+ sage: # needs numpy
+ sage: import numpy
+- sage: f = CDF.coerce_map_from(numpy.complex_)
+- sage: f(numpy.complex_(I))
++ sage: f = CDF.coerce_map_from(numpy.complex128)
++ sage: f(numpy.complex128(I))
+ 1.0*I
+- sage: f(numpy.complex_(I)).parent()
++ sage: f(numpy.complex128(I)).parent()
+ Complex Double Field
+ """
+ def __init__(self, R):
+@@ -2570,7 +2570,7 @@ cdef class ComplexToCDF(Morphism):
+ EXAMPLES::
+
+ sage: import numpy # needs numpy
+- sage: CDF(numpy.complex_(I)) # indirect doctest # needs numpy
++ sage: CDF(numpy.complex128(I)) # indirect doctest # needs numpy
+ 1.0*I
+ """
+ cdef ComplexDoubleElement z = <ComplexDoubleElement>ComplexDoubleElement.__new__(ComplexDoubleElement)
+@@ -2584,7 +2584,7 @@ cdef class ComplexToCDF(Morphism):
+ EXAMPLES::
+
+ sage: import numpy # needs numpy
+- sage: f = sage.rings.complex_double.ComplexToCDF(numpy.complex_) # needs numpy
++ sage: f = sage.rings.complex_double.ComplexToCDF(numpy.complex128) # needs numpy
+ sage: f._repr_type() # needs numpy
+ 'Native'
+ """
+diff --git a/src/sage/rings/integer.pyx b/src/sage/rings/integer.pyx
+index 6d9155b643f..6dc0150ad96 100644
+--- a/src/sage/rings/integer.pyx
++++ b/src/sage/rings/integer.pyx
+@@ -585,6 +585,8 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement):
+ Test comparisons with numpy types (see :issue:`13386` and :issue:`18076`)::
+
+ sage: import numpy # needs numpy
++ sage: if int(numpy.version.short_version[0]) > 1: # needs numpy
++ ....: numpy.set_printoptions(legacy="1.25") # needs numpy
+ sage: numpy.int8('12') == 12 # needs numpy
+ True
+ sage: 12 == numpy.int8('12') # needs numpy
+diff --git a/src/sage/rings/polynomial/polynomial_element.pyx b/src/sage/rings/polynomial/polynomial_element.pyx
+index 1270c42ce2a..78a32005d04 100644
+--- a/src/sage/rings/polynomial/polynomial_element.pyx
++++ b/src/sage/rings/polynomial/polynomial_element.pyx
+@@ -8851,7 +8851,7 @@ cdef class Polynomial(CommutativePolynomial):
+ 'you expect.')
+
+ import numpy
+- from numpy.linalg.linalg import LinAlgError
++ from numpy.linalg import LinAlgError
+ from sage.rings.complex_double import CDF
+
+ numpy_dtype = ('complex' if input_complex else 'double')
+diff --git a/src/sage/rings/real_mpfi.pyx b/src/sage/rings/real_mpfi.pyx
+index 7007f1da8d7..66c6733ee49 100644
+--- a/src/sage/rings/real_mpfi.pyx
++++ b/src/sage/rings/real_mpfi.pyx
+@@ -231,6 +231,8 @@ specified if given a non-interval and an interval::
+ TESTS::
+
+ sage: import numpy # needs numpy
++ sage: if int(numpy.version.short_version[0]) > 1: # needs numpy
++ ....: numpy.set_printoptions(legacy="1.25") # needs numpy
+ sage: RIF(2) == numpy.int8('2') # needs numpy
+ True
+ sage: numpy.int8('2') == RIF(2) # needs numpy
+diff --git a/src/sage/schemes/elliptic_curves/period_lattice_region.pyx b/src/sage/schemes/elliptic_curves/period_lattice_region.pyx
+index 8f240627e77..70ce616f92f 100644
+--- a/src/sage/schemes/elliptic_curves/period_lattice_region.pyx
++++ b/src/sage/schemes/elliptic_curves/period_lattice_region.pyx
+@@ -77,6 +77,8 @@ cdef class PeriodicRegion:
+ EXAMPLES::
+
+ sage: import numpy as np
++ sage: if int(np.version.short_version[0]) > 1:
++ ....: np.set_printoptions(legacy="1.25")
+ sage: from sage.schemes.elliptic_curves.period_lattice_region import PeriodicRegion
+ sage: data = np.zeros((4, 4))
+ sage: PeriodicRegion(CDF(2), CDF(2*I), data).is_empty()
+@@ -295,6 +297,8 @@ cdef class PeriodicRegion:
+ EXAMPLES::
+
+ sage: import numpy as np
++ sage: if int(np.version.short_version[0]) > 1:
++ ....: np.set_printoptions(legacy="1.25")
+ sage: from sage.schemes.elliptic_curves.period_lattice_region import PeriodicRegion
+ sage: data = np.zeros((10, 10))
+ sage: data[1:4,1:4] = True
+@@ -317,6 +321,8 @@ cdef class PeriodicRegion:
+ EXAMPLES::
+
+ sage: import numpy as np
++ sage: if int(np.version.short_version[0]) > 1:
++ ....: np.set_printoptions(legacy="1.25")
+ sage: from sage.schemes.elliptic_curves.period_lattice_region import PeriodicRegion
+ sage: data = np.zeros((4, 4))
+ sage: data[1,1] = True
+@@ -370,6 +376,8 @@ cdef class PeriodicRegion:
+ EXAMPLES::
+
+ sage: import numpy as np
++ sage: if int(np.version.short_version[0]) > 1:
++ ....: np.set_printoptions(legacy="1.25")
+ sage: from sage.schemes.elliptic_curves.period_lattice_region import PeriodicRegion
+
+ sage: data = np.zeros((20, 20))
+@@ -520,6 +528,8 @@ cdef class PeriodicRegion:
+ TESTS::
+
+ sage: import numpy as np
++ sage: if int(np.version.short_version[0]) > 1:
++ ....: np.set_printoptions(legacy="1.25")
+ sage: from sage.schemes.elliptic_curves.period_lattice_region import PeriodicRegion
+ sage: data = np.zeros((4, 4))
+ sage: data[1, 1] = True
+diff --git a/src/sage/stats/basic_stats.py b/src/sage/stats/basic_stats.py
+index b2e6b301bf7..6937f6cb410 100644
+--- a/src/sage/stats/basic_stats.py
++++ b/src/sage/stats/basic_stats.py
+@@ -227,6 +227,8 @@ def std(v, bias=False):
+
+ sage: # needs numpy
+ sage: import numpy
++ sage: if int(numpy.version.short_version[0]) > 1:
++ ....: numpy.set_printoptions(legacy="1.25")
+ sage: x = numpy.array([1,2,3,4,5])
+ sage: std(x, bias=False)
+ 1.5811388300841898
+@@ -304,6 +306,8 @@ def variance(v, bias=False):
+ sage: variance([RIF(1.0103, 1.0103), RIF(2)])
+ 0.4897530450000000?
+ sage: import numpy # needs numpy
++ sage: if int(numpy.version.short_version[0]) > 1: # needs numpy
++ ....: numpy.set_printoptions(legacy="1.25") # needs numpy
+ sage: x = numpy.array([1,2,3,4,5]) # needs numpy
+ sage: variance(x, bias=False) # needs numpy
+ 2.5
+diff --git a/src/sage/stats/time_series.pyx b/src/sage/stats/time_series.pyx
+index d6823f85add..3b17f232d0e 100644
+--- a/src/sage/stats/time_series.pyx
++++ b/src/sage/stats/time_series.pyx
+@@ -1720,6 +1720,8 @@ cdef class TimeSeries:
+ if len(v0) == 1:
+ return v1[0]/v0[0]
+ import numpy
++ if int(numpy.version.short_version[0]) > 1:
++ numpy.set_printoptions(legacy="1.25")
+ coeffs = numpy.polyfit(v0,v1,1)
+ return coeffs[0]
+
+diff --git a/src/sage/structure/coerce.pyx b/src/sage/structure/coerce.pyx
+index dfbd5ff82fa..955a256e9b4 100644
+--- a/src/sage/structure/coerce.pyx
++++ b/src/sage/structure/coerce.pyx
+@@ -520,6 +520,8 @@ cdef class CoercionModel:
+ Check that :issue:`8426` is fixed (see also :issue:`18076`)::
+
+ sage: import numpy # needs numpy
++ sage: if int(numpy.version.short_version[0]) > 1: # needs numpy
++ ....: numpy.set_printoptions(legacy="1.25") # needs numpy
+
+ sage: # needs sage.rings.real_mpfr
+ sage: x = polygen(RR)
+diff --git a/src/sage/symbolic/expression.pyx b/src/sage/symbolic/expression.pyx
+index a92fe241355..7671338feaa 100644
+--- a/src/sage/symbolic/expression.pyx
++++ b/src/sage/symbolic/expression.pyx
+@@ -1167,7 +1167,7 @@ cdef class Expression(Expression_abc):
+ sage: unicode_art(SR(13 - I))
+ 13 - ⅈ
+ sage: unicode_art(SR(1.3 - I))
+- 1.3 - ⅈ
++ 1.3 - ...ⅈ
+ sage: unicode_art(cos(I))
+ cosh(1)
+
+diff --git a/src/sage/symbolic/function.pyx b/src/sage/symbolic/function.pyx
+index 2cb2f09c715..cd89ad2a256 100644
+--- a/src/sage/symbolic/function.pyx
++++ b/src/sage/symbolic/function.pyx
+@@ -964,6 +964,9 @@ cdef class BuiltinFunction(Function):
+ mpc(real='0.83373002513114902', imag='-0.98889770576286506')
+
+ sage: import numpy # needs numpy
++ sage: if int(numpy.version.short_version[0]) > 1: # needs numpy
++ ....: numpy.set_printoptions(legacy="1.25") # needs numpy
++
+ sage: sin(numpy.int32(0)) # needs numpy
+ 0.0
+ sage: type(_) # needs numpy
+diff --git a/src/sage/symbolic/ring.pyx b/src/sage/symbolic/ring.pyx
+index e7a28be127a..18ad0d8f636 100644
+--- a/src/sage/symbolic/ring.pyx
++++ b/src/sage/symbolic/ring.pyx
+@@ -1162,6 +1162,8 @@ cdef class NumpyToSRMorphism(Morphism):
+ We check that :issue:`8949` and :issue:`9769` are fixed (see also :issue:`18076`)::
+
+ sage: import numpy # needs numpy
++ sage: if int(numpy.version.short_version[0]) > 1: # needs numpy
++ ....: numpy.set_printoptions(legacy="1.25") # needs numpy
+ sage: f(x) = x^2
+ sage: f(numpy.int8('2')) # needs numpy
+ 4
+
+From 2092f81092c81c36b7596b701355c279b07fa175 Mon Sep 17 00:00:00 2001
+From: Dima Pasechnik <dimpase@gmail.com>
+Date: Mon, 24 Jun 2024 13:02:30 +0100
+Subject: [PATCH 2/2] rectify the test for numpy.typecodes
+
+---
+ src/sage/matrix/matrix1.pyx | 13 ++++++++-----
+ 1 file changed, 8 insertions(+), 5 deletions(-)
+
+diff --git a/src/sage/matrix/matrix1.pyx b/src/sage/matrix/matrix1.pyx
+index e03d45a212d..9e5844f2416 100644
+--- a/src/sage/matrix/matrix1.pyx
++++ b/src/sage/matrix/matrix1.pyx
+@@ -705,12 +705,15 @@ cdef class Matrix(Matrix0):
+ Type ``numpy.typecodes`` for a list of the possible
+ typecodes::
+
+- sage: import numpy # needs numpy
+- sage: sorted(numpy.typecodes.items()) # needs numpy
++ sage: import numpy # needs numpy
++ sage: numpy.typecodes.items() # needs numpy # random
+ [('All', '?bhilqpBHILQPefdgFDGSUVOMm'), ('AllFloat', 'efdgFDG'),
+- ('AllInteger', 'bBhHiIlLqQpP'), ('Character', 'c'), ('Complex', 'FDG'),
+- ('Datetime', 'Mm'), ('Float', 'efdg'), ('Integer', 'bhilqp'),
+- ('UnsignedInteger', 'BHILQP')]
++ ...
++
++ For instance, you can see possibilities for real floating point numbers::
++
++ sage: numpy.typecodes['Float'] # needs numpy
++ 'efdg'
+
+ Alternatively, numpy automatically calls this function (via
+ the magic :meth:`__array__` method) to convert Sage matrices
diff --git a/sagemath-tdlib-0.9.patch b/sagemath-tdlib-0.9.patch
deleted file mode 100644
index 50e4ed3690a6..000000000000
--- a/sagemath-tdlib-0.9.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-diff -up src/sage/graphs/graph_decompositions/sage_tdlib.cpp.orig src/sage/graphs/graph_decompositions/sage_tdlib.cpp
---- a/src/sage/graphs/graph_decompositions/sage_tdlib.cpp 2021-05-09 16:00:11.000000000 -0600
-+++ b/src/sage/graphs/graph_decompositions/sage_tdlib.cpp 2021-06-16 08:33:47.325415307 -0600
-@@ -2,8 +2,8 @@
- #include <map>
-
- #include <boost/graph/adjacency_list.hpp>
--#include "tdlib/TD_combinations.hpp"
--#include "tdlib/TD_misc.hpp"
-+#include <treedec/combinations.hpp>
-+#include <treedec/misc.hpp>
-
- #ifndef TD_STRUCT_VERTEX
- #define TD_STRUCT_VERTEX
-@@ -16,13 +16,6 @@ struct Vertex{
-
- typedef boost::adjacency_list<boost::setS, boost::vecS, boost::undirectedS, Vertex> TD_graph_t;
-
--struct bag{
-- std::set<unsigned int> bag;
--};
--
--typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, bag> TD_tree_dec_t;
--
--
- void make_tdlib_graph(TD_graph_t &G, std::vector<unsigned int> &V, std::vector<unsigned int> &E){
- unsigned int max = 0;
- for(unsigned int i = 0; i < V.size(); i++)