Skip to content

Commit e749330

Browse files
JasonGrace2282behacklpre-commit-ci[bot]
authored
Add support for Python 3.13 (#3967)
* Allow python 3.13 * Specify scipy more strictly * try using 3rd-party audioop package * debug: wrap context generation in try-block * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * remove audioop-lts, update dependencies * add wrapt pre-release (wheels!) * update lockfile * CI, windows: try installing all tinytex packages at once * tmp: verbosity of pytest * tmp: pass -n 0 for testing * tmp: disable pytest-xdist * remove deprecated poetry installer option * try running tests via uv-provided env * tmp: run -> run --no-project * try --full-trace * try running tests via python -v ... * tmp: test import of suspicious modules * test click/cloup * ci: back to poetry * ci: disable pytest plugins altogether * update lockfile * ci: upgrade pytest * remove all flags from pytest call * ci: move conftest, temporarily disable test header * fix test fixture * try with more recent version of pytest-xdist * loadfile -> loadscope * explicitly test pytest for non-manim module * some proper tests * only keep fixtures in new conftest.py * remove all non-necessary fixtures * try a literal try/except in fixture file * simplify tests further * try and explicitly trigger non-silent errors * Revert "try and explicitly trigger non-silent errors" This reverts commit 35b862d. * more pytest debug output * test whether manim can be imported correctly * test with upgraded numpy * revert all sorts of debug changes, attempt clean pytest run * fix whitespace * pre-commit hooks * apply config fixture to render tests * let config fixture ensure renderer is set to cairo * update doctests for numpy>=2.0 * missed some * upgrade required numpy version, revert separate treatment of numpy in ci * upgraded moderngl-window to latest * more delicate versioning of numpy dependency --------- Co-authored-by: Benjamin Hackl <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent f81d571 commit e749330

File tree

12 files changed

+1721
-1458
lines changed

12 files changed

+1721
-1458
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ jobs:
2323
fail-fast: false
2424
matrix:
2525
os: [ubuntu-22.04, macos-13, windows-latest]
26-
python: ["3.9", "3.10", "3.11", "3.12"]
26+
python: ["3.9", "3.10", "3.11", "3.12", "3.13"]
2727

2828
steps:
2929
- name: Checkout the repository
3030
uses: actions/checkout@v4
3131

3232
- name: Install Poetry
3333
run: |
34-
pipx install "poetry==1.7.*"
34+
pipx install "poetry==1.8.*"
3535
poetry config virtualenvs.prefer-active-python true
3636
3737
- name: Setup Python ${{ matrix.python }}
@@ -142,10 +142,7 @@ jobs:
142142
Expand-Archive -LiteralPath "$($env:TMP)\TinyTex.zip" -DestinationPath "$($PWD)\ManimCache\LatexWindows"
143143
$env:Path = "$($PWD)\ManimCache\LatexWindows\TinyTeX\bin\windows;$($env:PATH)"
144144
tlmgr update --self
145-
foreach ($c in $tinyTexPackages){
146-
$c=$c.Trim()
147-
tlmgr install $c
148-
}
145+
tlmgr install $tinyTexPackages
149146
$env:PATH=$OriPath
150147
echo "Completed Latex"
151148
@@ -156,10 +153,9 @@ jobs:
156153
$env:Path = "$env:USERPROFILE\.poetry\bin;$($env:PATH)"
157154
echo "$env:Path" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
158155
159-
- name: Install manim
156+
- name: Install dependencies and manim
160157
run: |
161-
poetry config installer.modern-installation false
162-
poetry install
158+
poetry install --all-extras
163159
164160
- name: Run tests
165161
run: |

conftest.py

Lines changed: 0 additions & 43 deletions
This file was deleted.

manim/mobject/geometry/tips.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ def tip_angle(self) -> float:
180180
181181
>>> from manim import Arrow
182182
>>> arrow = Arrow(np.array([0, 0, 0]), np.array([1, 1, 0]), buff=0)
183-
>>> round(arrow.tip.tip_angle, 5) == round(PI/4, 5)
183+
>>> bool(round(arrow.tip.tip_angle, 5) == round(PI/4, 5))
184184
True
185185
186186
"""

manim/mobject/graphing/number_line.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -403,9 +403,9 @@ def point_to_number(self, point: Sequence[float]) -> float:
403403
>>> from manim import NumberLine
404404
>>> number_line = NumberLine()
405405
>>> number_line.point_to_number((0, 0, 0))
406-
0.0
406+
np.float64(0.0)
407407
>>> number_line.point_to_number((1, 0, 0))
408-
1.0
408+
np.float64(1.0)
409409
>>> number_line.point_to_number([[0.5, 0, 0], [1, 0, 0], [1.5, 0, 0]])
410410
array([0.5, 1. , 1.5])
411411

manim/mobject/mobject.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1605,13 +1605,13 @@ def scale_to_fit_width(self, width: float, **kwargs) -> Self:
16051605
>>> from manim import *
16061606
>>> sq = Square()
16071607
>>> sq.height
1608-
2.0
1608+
np.float64(2.0)
16091609
>>> sq.scale_to_fit_width(5)
16101610
Square
16111611
>>> sq.width
1612-
5.0
1612+
np.float64(5.0)
16131613
>>> sq.height
1614-
5.0
1614+
np.float64(5.0)
16151615
"""
16161616
return self.rescale_to_fit(width, 0, stretch=False, **kwargs)
16171617

@@ -1630,13 +1630,13 @@ def stretch_to_fit_width(self, width: float, **kwargs) -> Self:
16301630
>>> from manim import *
16311631
>>> sq = Square()
16321632
>>> sq.height
1633-
2.0
1633+
np.float64(2.0)
16341634
>>> sq.stretch_to_fit_width(5)
16351635
Square
16361636
>>> sq.width
1637-
5.0
1637+
np.float64(5.0)
16381638
>>> sq.height
1639-
2.0
1639+
np.float64(2.0)
16401640
"""
16411641
return self.rescale_to_fit(width, 0, stretch=True, **kwargs)
16421642

@@ -1655,13 +1655,13 @@ def scale_to_fit_height(self, height: float, **kwargs) -> Self:
16551655
>>> from manim import *
16561656
>>> sq = Square()
16571657
>>> sq.width
1658-
2.0
1658+
np.float64(2.0)
16591659
>>> sq.scale_to_fit_height(5)
16601660
Square
16611661
>>> sq.height
1662-
5.0
1662+
np.float64(5.0)
16631663
>>> sq.width
1664-
5.0
1664+
np.float64(5.0)
16651665
"""
16661666
return self.rescale_to_fit(height, 1, stretch=False, **kwargs)
16671667

@@ -1680,13 +1680,13 @@ def stretch_to_fit_height(self, height: float, **kwargs) -> Self:
16801680
>>> from manim import *
16811681
>>> sq = Square()
16821682
>>> sq.width
1683-
2.0
1683+
np.float64(2.0)
16841684
>>> sq.stretch_to_fit_height(5)
16851685
Square
16861686
>>> sq.height
1687-
5.0
1687+
np.float64(5.0)
16881688
>>> sq.width
1689-
2.0
1689+
np.float64(2.0)
16901690
"""
16911691
return self.rescale_to_fit(height, 1, stretch=True, **kwargs)
16921692

@@ -2869,7 +2869,7 @@ def construct(self):
28692869
28702870
>>> result = rect.copy().become(circ, stretch=True)
28712871
>>> result.height, result.width
2872-
(2.0, 4.0)
2872+
(np.float64(2.0), np.float64(4.0))
28732873
>>> ellipse_points = np.array(result.get_anchors())
28742874
>>> ellipse_eq = np.sum(ellipse_points**2 * [1/4, 1, 0], axis=1)
28752875
>>> np.allclose(ellipse_eq, 1)
@@ -2883,14 +2883,14 @@ def construct(self):
28832883
28842884
>>> result = rect.copy().become(circ, match_height=True)
28852885
>>> result.height, result.width
2886-
(2.0, 2.0)
2886+
(np.float64(2.0), np.float64(2.0))
28872887
>>> circle_points = np.array(result.get_anchors())
28882888
>>> circle_eq = np.sum(circle_points**2, axis=1)
28892889
>>> np.allclose(circle_eq, 1)
28902890
True
28912891
>>> result = rect.copy().become(circ, match_width=True)
28922892
>>> result.height, result.width
2893-
(4.0, 4.0)
2893+
(np.float64(4.0), np.float64(4.0))
28942894
>>> circle_points = np.array(result.get_anchors())
28952895
>>> circle_eq = np.sum(circle_points**2, axis=1)
28962896
>>> np.allclose(circle_eq, 2**2)

manim/utils/bezier.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1159,7 +1159,7 @@ def inverse_interpolate(
11591159
.. code-block:: pycon
11601160
11611161
>>> inverse_interpolate(start=2, end=6, value=4)
1162-
0.5
1162+
np.float64(0.5)
11631163
11641164
>>> start = np.array([1, 2, 1])
11651165
>>> end = np.array([7, 8, 11])
@@ -1221,7 +1221,7 @@ def match_interpolate(
12211221
Examples
12221222
--------
12231223
>>> match_interpolate(0, 100, 10, 20, 15)
1224-
50.0
1224+
np.float64(50.0)
12251225
"""
12261226
old_alpha = inverse_interpolate(old_start, old_end, old_value)
12271227
return interpolate(
@@ -1938,7 +1938,7 @@ def is_closed(points: Point3D_Array) -> bool:
19381938
return False
19391939
if abs(end[1] - start[1]) > tolerance[1]:
19401940
return False
1941-
return abs(end[2] - start[2]) <= tolerance[2]
1941+
return bool(abs(end[2] - start[2]) <= tolerance[2])
19421942

19431943

19441944
def proportions_along_bezier_curve_for_point(

manim/utils/simple_functions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ def binary_search(
4040
::
4141
4242
>>> solution = binary_search(lambda x: x**2 + 3*x + 1, 11, 0, 5)
43-
>>> abs(solution - 2) < 1e-4
43+
>>> bool(abs(solution - 2) < 1e-4)
4444
True
4545
>>> solution = binary_search(lambda x: x**2 + 3*x + 1, 11, 0, 5, tolerance=0.01)
46-
>>> abs(solution - 2) < 0.01
46+
>>> bool(abs(solution - 2) < 0.01)
4747
True
4848
4949
Searching in the interval :math:`[0, 5]` for a target value of :math:`71`

manim/utils/space_ops.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -613,11 +613,11 @@ def get_winding_number(points: Sequence[np.ndarray]) -> float:
613613
>>> from manim import Square, get_winding_number
614614
>>> polygon = Square()
615615
>>> get_winding_number(polygon.get_vertices())
616-
1.0
616+
np.float64(1.0)
617617
>>> polygon.shift(2 * UP)
618618
Square
619619
>>> get_winding_number(polygon.get_vertices())
620-
0.0
620+
np.float64(0.0)
621621
"""
622622
total_angle = 0
623623
for p1, p2 in adjacent_pairs(points):
@@ -680,7 +680,7 @@ def cross2d(
680680
.. code-block:: pycon
681681
682682
>>> cross2d(np.array([1, 2]), np.array([3, 4]))
683-
-2
683+
np.int64(-2)
684684
>>> cross2d(
685685
... np.array([[1, 2, 0], [1, 0, 0]]),
686686
... np.array([[3, 4, 0], [0, 1, 0]]),

0 commit comments

Comments
 (0)