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

fix(lib): bump Manim and fix OpenGL renderer #522

Merged
merged 3 commits into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
20 changes: 17 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added `skip_animations` compatibility with ManimCE.
[@Rapsssito](https://github.com/Rapsssito) [#516](https://github.com/jeertmans/manim-slides/pull/516)

(unreleased-chore)=
### Chore

- Bumped Manim to `>=0.19`, as it fixed OpenGL renderer issue.
[#522](https://github.com/jeertmans/manim-slides/pull/522)

(unreleased-fixed)=
### Fixed

- Fixed OpenGL renderer having no partial movie files with Manim bindings.
[#522](https://github.com/jeertmans/manim-slides/pull/522)
- Fixed `ConvertExample` example as `manim>=0.19` changed the `Code` class.
[#522](https://github.com/jeertmans/manim-slides/pull/522)

(v5.3.1)=
## [v5.3.1](https://github.com/jeertmans/manim-slides/compare/v5.3.0...v5.3.1)

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

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

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

- Pin `rtoml==0.9.0` on Windows platforms,
- Pinned `rtoml==0.9.0` on Windows platforms,
see [#398](https://github.com/jeertmans/manim-slides/pull/398),
until
[samuelcolvin/rtoml#74](https://github.com/samuelcolvin/rtoml/issues/74)
Expand Down
16 changes: 8 additions & 8 deletions example.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def construct(self):
self.next_slide()

code = Code(
code="""from manim import *
code_string="""from manim import *


class Example(Scene):
Expand All @@ -72,7 +72,7 @@ def construct(self):
)

code_step_1 = Code(
code="""from manim import *
code_string="""from manim import *
from manim_slides import Slide

class Example(Scene):
Expand All @@ -91,7 +91,7 @@ def construct(self):
)

code_step_2 = Code(
code="""from manim import *
code_string="""from manim import *
from manim_slides import Slide

class Example(Slide):
Expand All @@ -110,7 +110,7 @@ def construct(self):
)

code_step_3 = Code(
code="""from manim import *
code_string="""from manim import *
from manim_slides import Slide

class Example(Slide):
Expand All @@ -129,7 +129,7 @@ def construct(self):
)

code_step_4 = Code(
code="""from manim import *
code_string="""from manim import *
from manim_slides import Slide

class Example(Slide):
Expand All @@ -148,19 +148,19 @@ def construct(self):
)

code_step_5 = Code(
code="manim-slide render example.py Example",
code_string="manim-slide render example.py Example",
language="console",
)

code_step_6 = Code(
code="manim-slides Example",
code_string="manim-slides Example",
language="console",
)

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

code_step_7 = Code(
code="manim-slides convert Example slides.html --open",
code_string="manim-slides convert Example slides.html --open",
language="console",
).shift(DOWN)

Expand Down
6 changes: 6 additions & 0 deletions manim_slides/slide/manim.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ class Slide(BaseSlide, Scene): # type: ignore[misc]
for the current slide config.
"""

def __init__(self, *args: Any, **kwargs: Any) -> None:
# OpenGL renderer disables 'write_to_movie' by default
# which is required for saving the animations
config["write_to_movie"] = True
super().__init__(*args, **kwargs)

@property
def _frame_shape(self) -> tuple[float, float]:
if isinstance(self.renderer, OpenGLRenderer):
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ full = [
"manim-slides[magic,manim,sphinx-directive]",
]
magic = ["manim-slides[manim]", "ipython>=8.12.2"]
manim = ["manim>=0.17"]
manim = ["manim>=0.19"]
manimgl = ["manimgl>=1.7.2"]
pyqt6 = ["pyqt6>=6.7.0"]
pyqt6-full = ["manim-slides[full,pyqt6]"]
Expand Down
27 changes: 12 additions & 15 deletions tests/test_slide.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import shutil
import sys
import tempfile
import threading
from collections.abc import Iterator
from pathlib import Path
from typing import Any, Union
Expand Down Expand Up @@ -71,7 +70,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None:
reason="See https://github.com/3b1b/manim/issues/2263.",
),
),
"--CE --renderer=opengl",
],
ids=("CE", "GL", "CE(GL)"),
)
def test_render_basic_slide(
renderer: str,
Expand All @@ -84,7 +85,7 @@ def test_render_basic_slide(
with runner.isolated_filesystem() as tmp_dir:
shutil.copy(manimgl_config, tmp_dir)
results = runner.invoke(
render, [renderer, str(slides_file), "BasicSlide", "-ql"]
render, [*renderer.split(" "), str(slides_file), "BasicSlide", "-ql"]
)

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


_L = (
threading.Lock()
) # We cannot change directory multiple times at once (in the same thread)


@contextlib.contextmanager
def tmp_cwd() -> Iterator[str]:
old_cwd = os.getcwd()

with tempfile.TemporaryDirectory() as tmp_dir, _L:
try:
os.chdir(tmp_dir)
yield tmp_dir
finally:
os.chdir(old_cwd)
cwd = os.getcwd()
tmp_dir = tempfile.mkdtemp()

os.chdir(tmp_dir)

try:
yield tmp_dir
finally:
os.chdir(cwd)


def assert_renders(cls: SlideType) -> None:
Expand Down
Loading
Loading