Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Python 3.13 #3967

Merged
merged 52 commits into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
fbbbaec
Allow python 3.13
JasonGrace2282 Oct 20, 2024
85eb9dc
Specify scipy more strictly
JasonGrace2282 Oct 20, 2024
b66deec
try using 3rd-party audioop package
JasonGrace2282 Oct 20, 2024
100a1e8
debug: wrap context generation in try-block
behackl Oct 27, 2024
fe784fd
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 27, 2024
6650e88
remove audioop-lts, update dependencies
behackl Oct 27, 2024
1778c81
Merge branch 'py313' of github.com:JasonGrace2282/manim into py313
behackl Oct 27, 2024
c9af631
add wrapt pre-release (wheels!)
behackl Oct 27, 2024
6ba9168
Merge branch 'main' into py313
behackl Nov 7, 2024
71ca75f
update lockfile
behackl Nov 10, 2024
413a39d
CI, windows: try installing all tinytex packages at once
behackl Nov 10, 2024
b412b51
tmp: verbosity of pytest
behackl Nov 10, 2024
cbabd34
tmp: pass -n 0 for testing
behackl Nov 11, 2024
fe1d399
tmp: disable pytest-xdist
behackl Nov 11, 2024
0aa3530
remove deprecated poetry installer option
behackl Nov 11, 2024
cbdd027
try running tests via uv-provided env
behackl Nov 11, 2024
dbd9ee8
tmp: run -> run --no-project
behackl Nov 11, 2024
d4eff42
try --full-trace
behackl Nov 11, 2024
ea6f588
try running tests via python -v ...
behackl Nov 11, 2024
34f46c6
tmp: test import of suspicious modules
behackl Nov 11, 2024
3224afd
test click/cloup
behackl Nov 11, 2024
8b6a460
ci: back to poetry
behackl Nov 11, 2024
9047cfe
ci: disable pytest plugins altogether
behackl Nov 11, 2024
a47a0f2
update lockfile
behackl Nov 11, 2024
6ae9d4f
ci: upgrade pytest
behackl Nov 11, 2024
736f97c
remove all flags from pytest call
behackl Nov 11, 2024
47f71b3
ci: move conftest, temporarily disable test header
behackl Nov 11, 2024
2cf7a90
fix test fixture
behackl Nov 11, 2024
bd918bd
try with more recent version of pytest-xdist
behackl Nov 11, 2024
cb9599a
loadfile -> loadscope
behackl Nov 11, 2024
5ce2f8c
explicitly test pytest for non-manim module
behackl Nov 11, 2024
95bb707
some proper tests
behackl Nov 11, 2024
a2a605c
only keep fixtures in new conftest.py
behackl Nov 11, 2024
16a6ef9
remove all non-necessary fixtures
behackl Nov 11, 2024
ddcacfb
try a literal try/except in fixture file
behackl Nov 11, 2024
375c28e
simplify tests further
behackl Nov 11, 2024
35b862d
try and explicitly trigger non-silent errors
behackl Nov 12, 2024
71497c0
Revert "try and explicitly trigger non-silent errors"
behackl Nov 13, 2024
1c08ab1
more pytest debug output
behackl Nov 13, 2024
acb65a5
test whether manim can be imported correctly
behackl Nov 14, 2024
e5bd4a8
test with upgraded numpy
behackl Nov 14, 2024
24fa302
revert all sorts of debug changes, attempt clean pytest run
behackl Nov 14, 2024
c9eea18
fix whitespace
behackl Nov 14, 2024
e5fa106
pre-commit hooks
behackl Nov 14, 2024
ddcfc6d
apply config fixture to render tests
behackl Nov 14, 2024
b3a6b6a
let config fixture ensure renderer is set to cairo
behackl Nov 16, 2024
e828212
update doctests for numpy>=2.0
behackl Nov 16, 2024
81b3e2a
missed some
behackl Nov 16, 2024
42bc3cd
upgrade required numpy version, revert separate treatment of numpy in ci
behackl Nov 30, 2024
12d8ffb
Merge remote-tracking branch 'origin/main' into py313
behackl Dec 1, 2024
3ee95fc
upgraded moderngl-window to latest
behackl Dec 1, 2024
e8a7ea8
more delicate versioning of numpy dependency
behackl Dec 1, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-22.04, macos-13, windows-latest]
python: ["3.9", "3.10", "3.11", "3.12"]
python: ["3.9", "3.10", "3.11", "3.12", "3.13"]

steps:
- name: Checkout the repository
uses: actions/checkout@v4

- name: Install Poetry
run: |
pipx install "poetry==1.7.*"
pipx install "poetry==1.8.*"
poetry config virtualenvs.prefer-active-python true

- name: Setup Python ${{ matrix.python }}
Expand Down Expand Up @@ -142,10 +142,7 @@ jobs:
Expand-Archive -LiteralPath "$($env:TMP)\TinyTex.zip" -DestinationPath "$($PWD)\ManimCache\LatexWindows"
$env:Path = "$($PWD)\ManimCache\LatexWindows\TinyTeX\bin\windows;$($env:PATH)"
tlmgr update --self
foreach ($c in $tinyTexPackages){
$c=$c.Trim()
tlmgr install $c
}
tlmgr install $tinyTexPackages
$env:PATH=$OriPath
echo "Completed Latex"

Expand All @@ -156,10 +153,9 @@ jobs:
$env:Path = "$env:USERPROFILE\.poetry\bin;$($env:PATH)"
echo "$env:Path" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append

- name: Install manim
- name: Install dependencies and manim
run: |
poetry config installer.modern-installation false
poetry install
poetry install --all-extras

- name: Run tests
run: |
Expand Down
43 changes: 0 additions & 43 deletions conftest.py

This file was deleted.

2 changes: 1 addition & 1 deletion manim/mobject/geometry/tips.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ def tip_angle(self) -> float:

>>> from manim import Arrow
>>> arrow = Arrow(np.array([0, 0, 0]), np.array([1, 1, 0]), buff=0)
>>> round(arrow.tip.tip_angle, 5) == round(PI/4, 5)
>>> bool(round(arrow.tip.tip_angle, 5) == round(PI/4, 5))
True

"""
Expand Down
4 changes: 2 additions & 2 deletions manim/mobject/graphing/number_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,9 +403,9 @@ def point_to_number(self, point: Sequence[float]) -> float:
>>> from manim import NumberLine
>>> number_line = NumberLine()
>>> number_line.point_to_number((0, 0, 0))
0.0
np.float64(0.0)
>>> number_line.point_to_number((1, 0, 0))
1.0
np.float64(1.0)
>>> number_line.point_to_number([[0.5, 0, 0], [1, 0, 0], [1.5, 0, 0]])
array([0.5, 1. , 1.5])

Expand Down
30 changes: 15 additions & 15 deletions manim/mobject/mobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -1605,13 +1605,13 @@ def scale_to_fit_width(self, width: float, **kwargs) -> Self:
>>> from manim import *
>>> sq = Square()
>>> sq.height
2.0
np.float64(2.0)
>>> sq.scale_to_fit_width(5)
Square
>>> sq.width
5.0
np.float64(5.0)
>>> sq.height
5.0
np.float64(5.0)
"""
return self.rescale_to_fit(width, 0, stretch=False, **kwargs)

Expand All @@ -1630,13 +1630,13 @@ def stretch_to_fit_width(self, width: float, **kwargs) -> Self:
>>> from manim import *
>>> sq = Square()
>>> sq.height
2.0
np.float64(2.0)
>>> sq.stretch_to_fit_width(5)
Square
>>> sq.width
5.0
np.float64(5.0)
>>> sq.height
2.0
np.float64(2.0)
"""
return self.rescale_to_fit(width, 0, stretch=True, **kwargs)

Expand All @@ -1655,13 +1655,13 @@ def scale_to_fit_height(self, height: float, **kwargs) -> Self:
>>> from manim import *
>>> sq = Square()
>>> sq.width
2.0
np.float64(2.0)
>>> sq.scale_to_fit_height(5)
Square
>>> sq.height
5.0
np.float64(5.0)
>>> sq.width
5.0
np.float64(5.0)
"""
return self.rescale_to_fit(height, 1, stretch=False, **kwargs)

Expand All @@ -1680,13 +1680,13 @@ def stretch_to_fit_height(self, height: float, **kwargs) -> Self:
>>> from manim import *
>>> sq = Square()
>>> sq.width
2.0
np.float64(2.0)
>>> sq.stretch_to_fit_height(5)
Square
>>> sq.height
5.0
np.float64(5.0)
>>> sq.width
2.0
np.float64(2.0)
"""
return self.rescale_to_fit(height, 1, stretch=True, **kwargs)

Expand Down Expand Up @@ -2869,7 +2869,7 @@ def construct(self):

>>> result = rect.copy().become(circ, stretch=True)
>>> result.height, result.width
(2.0, 4.0)
(np.float64(2.0), np.float64(4.0))
>>> ellipse_points = np.array(result.get_anchors())
>>> ellipse_eq = np.sum(ellipse_points**2 * [1/4, 1, 0], axis=1)
>>> np.allclose(ellipse_eq, 1)
Expand All @@ -2883,14 +2883,14 @@ def construct(self):

>>> result = rect.copy().become(circ, match_height=True)
>>> result.height, result.width
(2.0, 2.0)
(np.float64(2.0), np.float64(2.0))
>>> circle_points = np.array(result.get_anchors())
>>> circle_eq = np.sum(circle_points**2, axis=1)
>>> np.allclose(circle_eq, 1)
True
>>> result = rect.copy().become(circ, match_width=True)
>>> result.height, result.width
(4.0, 4.0)
(np.float64(4.0), np.float64(4.0))
>>> circle_points = np.array(result.get_anchors())
>>> circle_eq = np.sum(circle_points**2, axis=1)
>>> np.allclose(circle_eq, 2**2)
Expand Down
6 changes: 3 additions & 3 deletions manim/utils/bezier.py
Original file line number Diff line number Diff line change
Expand Up @@ -1159,7 +1159,7 @@ def inverse_interpolate(
.. code-block:: pycon

>>> inverse_interpolate(start=2, end=6, value=4)
0.5
np.float64(0.5)

>>> start = np.array([1, 2, 1])
>>> end = np.array([7, 8, 11])
Expand Down Expand Up @@ -1221,7 +1221,7 @@ def match_interpolate(
Examples
--------
>>> match_interpolate(0, 100, 10, 20, 15)
50.0
np.float64(50.0)
"""
old_alpha = inverse_interpolate(old_start, old_end, old_value)
return interpolate(
Expand Down Expand Up @@ -1938,7 +1938,7 @@ def is_closed(points: Point3D_Array) -> bool:
return False
if abs(end[1] - start[1]) > tolerance[1]:
return False
return abs(end[2] - start[2]) <= tolerance[2]
return bool(abs(end[2] - start[2]) <= tolerance[2])


def proportions_along_bezier_curve_for_point(
Expand Down
4 changes: 2 additions & 2 deletions manim/utils/simple_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ def binary_search(
::

>>> solution = binary_search(lambda x: x**2 + 3*x + 1, 11, 0, 5)
>>> abs(solution - 2) < 1e-4
>>> bool(abs(solution - 2) < 1e-4)
True
>>> solution = binary_search(lambda x: x**2 + 3*x + 1, 11, 0, 5, tolerance=0.01)
>>> abs(solution - 2) < 0.01
>>> bool(abs(solution - 2) < 0.01)
True

Searching in the interval :math:`[0, 5]` for a target value of :math:`71`
Expand Down
6 changes: 3 additions & 3 deletions manim/utils/space_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -613,11 +613,11 @@ def get_winding_number(points: Sequence[np.ndarray]) -> float:
>>> from manim import Square, get_winding_number
>>> polygon = Square()
>>> get_winding_number(polygon.get_vertices())
1.0
np.float64(1.0)
>>> polygon.shift(2 * UP)
Square
>>> get_winding_number(polygon.get_vertices())
0.0
np.float64(0.0)
"""
total_angle = 0
for p1, p2 in adjacent_pairs(points):
Expand Down Expand Up @@ -680,7 +680,7 @@ def cross2d(
.. code-block:: pycon

>>> cross2d(np.array([1, 2]), np.array([3, 4]))
-2
np.int64(-2)
>>> cross2d(
... np.array([[1, 2, 0], [1, 0, 0]]),
... np.array([[3, 4, 0], [0, 1, 0]]),
Expand Down
Loading