Skip to content

Commit adce58e

Browse files
authored
fix(lib): bump Manim and fix OpenGL renderer (#522)
* fix(lib): bump Manim and fix OpenGL renderer * fix(tests): correctly change cwd
1 parent 32ab690 commit adce58e

File tree

6 files changed

+421
-172
lines changed

6 files changed

+421
-172
lines changed

CHANGELOG.md

+17-3
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1616
- Added `skip_animations` compatibility with ManimCE.
1717
[@Rapsssito](https://github.com/Rapsssito) [#516](https://github.com/jeertmans/manim-slides/pull/516)
1818

19+
(unreleased-chore)=
20+
### Chore
21+
22+
- Bumped Manim to `>=0.19`, as it fixed OpenGL renderer issue.
23+
[#522](https://github.com/jeertmans/manim-slides/pull/522)
24+
25+
(unreleased-fixed)=
26+
### Fixed
27+
28+
- Fixed OpenGL renderer having no partial movie files with Manim bindings.
29+
[#522](https://github.com/jeertmans/manim-slides/pull/522)
30+
- Fixed `ConvertExample` example as `manim>=0.19` changed the `Code` class.
31+
[#522](https://github.com/jeertmans/manim-slides/pull/522)
32+
1933
(v5.3.1)=
2034
## [v5.3.1](https://github.com/jeertmans/manim-slides/compare/v5.3.0...v5.3.1)
2135

@@ -60,11 +74,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6074
(v5.2.0-chore)=
6175
### Chore
6276

63-
- Bump ManimGL to `>=1.7.1`, to remove conflicting dependencies
77+
- Bumped ManimGL to `>=1.7.1`, to remove conflicting dependencies
6478
with Manim's.
6579
[#499](https://github.com/jeertmans/manim-slides/pull/499)
6680

67-
- Bump ManimGL to `>=1.7.2`, to remove `pyrr` from dependencies,
81+
- Bumped ManimGL to `>=1.7.2`, to remove `pyrr` from dependencies,
6882
and to avoid complex code for supporting both `1.7.1` and `>=1.7.2`,
6983
as the latter includes many breaking changes.
7084
[#506](https://github.com/jeertmans/manim-slides/pull/506)
@@ -127,7 +141,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
127141
(v5.1.8-chore)=
128142
### Chore
129143

130-
- Pin `rtoml==0.9.0` on Windows platforms,
144+
- Pinned `rtoml==0.9.0` on Windows platforms,
131145
see [#398](https://github.com/jeertmans/manim-slides/pull/398),
132146
until
133147
[samuelcolvin/rtoml#74](https://github.com/samuelcolvin/rtoml/issues/74)

example.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def construct(self):
5353
self.next_slide()
5454

5555
code = Code(
56-
code="""from manim import *
56+
code_string="""from manim import *
5757
5858
5959
class Example(Scene):
@@ -72,7 +72,7 @@ def construct(self):
7272
)
7373

7474
code_step_1 = Code(
75-
code="""from manim import *
75+
code_string="""from manim import *
7676
from manim_slides import Slide
7777
7878
class Example(Scene):
@@ -91,7 +91,7 @@ def construct(self):
9191
)
9292

9393
code_step_2 = Code(
94-
code="""from manim import *
94+
code_string="""from manim import *
9595
from manim_slides import Slide
9696
9797
class Example(Slide):
@@ -110,7 +110,7 @@ def construct(self):
110110
)
111111

112112
code_step_3 = Code(
113-
code="""from manim import *
113+
code_string="""from manim import *
114114
from manim_slides import Slide
115115
116116
class Example(Slide):
@@ -129,7 +129,7 @@ def construct(self):
129129
)
130130

131131
code_step_4 = Code(
132-
code="""from manim import *
132+
code_string="""from manim import *
133133
from manim_slides import Slide
134134
135135
class Example(Slide):
@@ -148,19 +148,19 @@ def construct(self):
148148
)
149149

150150
code_step_5 = Code(
151-
code="manim-slide render example.py Example",
151+
code_string="manim-slide render example.py Example",
152152
language="console",
153153
)
154154

155155
code_step_6 = Code(
156-
code="manim-slides Example",
156+
code_string="manim-slides Example",
157157
language="console",
158158
)
159159

160160
or_text = Text("or generate HTML presentation").scale(0.5)
161161

162162
code_step_7 = Code(
163-
code="manim-slides convert Example slides.html --open",
163+
code_string="manim-slides convert Example slides.html --open",
164164
language="console",
165165
).shift(DOWN)
166166

manim_slides/slide/manim.py

+6
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ class Slide(BaseSlide, Scene): # type: ignore[misc]
3131
for the current slide config.
3232
"""
3333

34+
def __init__(self, *args: Any, **kwargs: Any) -> None:
35+
# OpenGL renderer disables 'write_to_movie' by default
36+
# which is required for saving the animations
37+
config["write_to_movie"] = True
38+
super().__init__(*args, **kwargs)
39+
3440
@property
3541
def _frame_shape(self) -> tuple[float, float]:
3642
if isinstance(self.renderer, OpenGLRenderer):

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ full = [
6161
"manim-slides[magic,manim,sphinx-directive]",
6262
]
6363
magic = ["manim-slides[manim]", "ipython>=8.12.2"]
64-
manim = ["manim>=0.17"]
64+
manim = ["manim>=0.19"]
6565
manimgl = ["manimgl>=1.7.2"]
6666
pyqt6 = ["pyqt6>=6.7.0"]
6767
pyqt6-full = ["manim-slides[full,pyqt6]"]

tests/test_slide.py

+12-15
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import shutil
55
import sys
66
import tempfile
7-
import threading
87
from collections.abc import Iterator
98
from pathlib import Path
109
from typing import Any, Union
@@ -71,7 +70,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None:
7170
reason="See https://github.com/3b1b/manim/issues/2263.",
7271
),
7372
),
73+
"--CE --renderer=opengl",
7474
],
75+
ids=("CE", "GL", "CE(GL)"),
7576
)
7677
def test_render_basic_slide(
7778
renderer: str,
@@ -84,7 +85,7 @@ def test_render_basic_slide(
8485
with runner.isolated_filesystem() as tmp_dir:
8586
shutil.copy(manimgl_config, tmp_dir)
8687
results = runner.invoke(
87-
render, [renderer, str(slides_file), "BasicSlide", "-ql"]
88+
render, [*renderer.split(" "), str(slides_file), "BasicSlide", "-ql"]
8889
)
8990

9091
assert results.exit_code == 0, results
@@ -235,21 +236,17 @@ def assert_constructs(cls: SlideType) -> None:
235236
init_slide(cls).construct()
236237

237238

238-
_L = (
239-
threading.Lock()
240-
) # We cannot change directory multiple times at once (in the same thread)
241-
242-
243239
@contextlib.contextmanager
244240
def tmp_cwd() -> Iterator[str]:
245-
old_cwd = os.getcwd()
246-
247-
with tempfile.TemporaryDirectory() as tmp_dir, _L:
248-
try:
249-
os.chdir(tmp_dir)
250-
yield tmp_dir
251-
finally:
252-
os.chdir(old_cwd)
241+
cwd = os.getcwd()
242+
tmp_dir = tempfile.mkdtemp()
243+
244+
os.chdir(tmp_dir)
245+
246+
try:
247+
yield tmp_dir
248+
finally:
249+
os.chdir(cwd)
253250

254251

255252
def assert_renders(cls: SlideType) -> None:

0 commit comments

Comments
 (0)