Skip to content

Commit 5b02691

Browse files
chore(deps): bump ManimGL to 1.7.1 (#499)
* chore(deps): bump ManimGL to 1.7.1 Bump ManimGL's minimal version, so relax constraints on other deps and remove compatibility issues with Manim * fix(docs): correct PR number * fix(lib): update ManimGL's init See 3b1b/manim#2261 * fix(lib): force float * chore(tests): correctly ignore warning * fix(tests) * fix(tests): add skips * chore(fmt): auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix(tests) * oops * fix on 3.12 * fix(lib): correctly patch ManimGL * fix(deps): pyrr issue * fix: version --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 05c1a16 commit 5b02691

File tree

9 files changed

+1314
-1154
lines changed

9 files changed

+1314
-1154
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2121
[@PeculiarProgrammer](https://github.com/PeculiarProgrammer)
2222
[#482](https://github.com/jeertmans/manim-slides/pull/482)
2323

24+
(unreleased-chore)=
25+
### Chore
26+
27+
- Bump ManimGL to `>=1.7.1`, to remove conflicting dependencies
28+
with Manim's.
29+
[#499](https://github.com/jeertmans/manim-slides/pull/499)
30+
2431
(v5.1.10)=
2532
## [v5.1.10](https://github.com/jeertmans/manim-slides/compare/v5.1.9...v5.1.10)
2633

docs/source/faq.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,8 @@ ManimGL support is only guaranteed to work
2929
on a very minimal set of versions, because it differs quite a lot from ManimCE,
3030
and its development is not very active.
3131

32-
The typical issues are that (1) ManimGL needs an outdated NumPy version
33-
and (2) ManimGL **should not** be installed from the GitHub repository,
34-
at least not from the `main` branch, but from a version released to PyPI.
35-
36-
To solve the NumPy issue, you can safely downgrade NumPy to a version supported
37-
by ManimGL,
38-
while ignoring the possible *conflicting dependencies* messages from `pip` (or else).
32+
The typical issue is that ManimGL `<1.7.1` needs an outdated NumPy version, but
33+
can be resolved by manually downgrading NumPy, or upgrading ManimGL (**recommended**).
3934

4035
### Presenting
4136

docs/source/installation.md

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,6 @@ please refer to their specific installation guidelines:
2929
- [Manim](https://docs.manim.community/en/stable/installation.html)
3030
- [ManimGL](https://3b1b.github.io/manim/getting_started/installation.html)
3131

32-
:::{warning}
33-
If you install Manim from its git repository, as suggested by ManimGL,
34-
make sure to first check out a supported version (e.g., `git checkout tags/v1.6.1`
35-
for ManimGL), otherwise it might install an unsupported version of Manim!
36-
See [#314](https://github.com/jeertmans/manim-slides/issues/314).
37-
38-
Also, note that ManimGL uses outdated dependencies, and may
39-
not work out-of-the-box. One example is NumPy: ManimGL
40-
does not specify any restriction on this package, but
41-
only `numpy<1.25` will work, see
42-
[#2053](https://github.com/3b1b/manim/issues/2053).
43-
:::
44-
4532
<!-- end deps -->
4633

4734
## Pip Install

manim_slides/slide/manimlib.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,29 +10,39 @@
1010
class Slide(BaseSlide, Scene): # type: ignore[misc]
1111
def __init__(self, *args: Any, **kwargs: Any) -> None:
1212
kwargs.setdefault("file_writer_config", {}).update(
13-
skip_animations=True,
1413
break_into_partial_movies=True,
1514
write_to_movie=True,
1615
)
16+
# See: https://github.com/3b1b/manim/issues/2261
17+
if kwargs["file_writer_config"].setdefault("output_directory", ".") == "":
18+
kwargs["file_writer_config"]["output_directory"] = "."
1719

1820
kwargs["preview"] = False # Avoid opening a preview window
1921
super().__init__(*args, **kwargs)
2022

2123
@property
2224
def _frame_height(self) -> float:
23-
return self.camera.frame.get_height() # type: ignore
25+
return float(self.camera.get_frame_height())
2426

2527
@property
2628
def _frame_width(self) -> float:
27-
return self.camera.frame.get_width() # type: ignore
29+
return float(self.camera.get_frame_width())
2830

2931
@property
3032
def _background_color(self) -> str:
31-
return self.camera_config["background_color"].hex # type: ignore
33+
rgba = self.camera.background_rgba
34+
r = int(255 * rgba[0])
35+
g = int(255 * rgba[1])
36+
b = int(255 * rgba[2])
37+
if rgba[3] == 1.0:
38+
return f"#{r:02x}{g:02x}{b:02x}"
39+
40+
a = int(255 * rgba[3])
41+
return f"#{r:02x}{g:02x}{b:02x}{a:02x}"
3242

3343
@property
3444
def _resolution(self) -> tuple[int, int]:
35-
return self.camera_config["pixel_width"], self.camera_config["pixel_height"]
45+
return self.camera.get_pixel_width(), self.camera.get_pixel_height()
3646

3747
@property
3848
def _partial_movie_files(self) -> list[Path]:

pyproject.toml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ full = [
5959
]
6060
magic = ["manim-slides[manim]", "ipython>=8.12.2"]
6161
manim = ["manim>=0.18.0"]
62-
manimgl = ["manimgl>=1.6.1;python_version<'3.12'"]
62+
manimgl = ["manimgl>=1.7.1", "pyrr"]
6363
pyqt6 = ["pyqt6>=6.7.0"]
6464
pyqt6-full = ["manim-slides[full,pyqt6]"]
6565
pyside6 = ["pyside6>=6.6.1"]
@@ -190,7 +190,8 @@ filterwarnings = [
190190
'''ignore:'audioop' is deprecated:DeprecationWarning''',
191191
'ignore:pkg_resources is deprecated as an API:DeprecationWarning',
192192
'ignore::DeprecationWarning:pkg_resources.*:',
193-
'ignore::DeprecationWarning:pydub.*:',
193+
'ignore:invalid escape sequence.*:DeprecationWarning',
194+
'ignore:invalid escape sequence.*:SyntaxWarning',
194195
]
195196

196197
[tool.ruff]
@@ -227,9 +228,3 @@ dev-dependencies = [
227228
"pre-commit>=3.5.0",
228229
"setuptools>=73.0.1",
229230
]
230-
override-dependencies = [
231-
# Bypass constraints from ManimGL
232-
"manimpango>=0.5.0,<1.0.0",
233-
"numpy<=1.24;python_version < '3.12'",
234-
"numpy>=1.26;python_version >= '3.12'",
235-
]

tests/test_checkhealth.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,13 @@ def test_checkhealth(
3939
del sys.modules["qtpy"] # Avoid using cached module
4040

4141
with missing_modules(*names):
42+
if (
43+
not manimlib_missing
44+
and not MANIMGL_NOT_INSTALLED
45+
and sys.version_info < (3, 10)
46+
):
47+
pytest.skip("See https://github.com/3b1b/manim/issues/2263")
48+
4249
result = runner.invoke(
4350
checkhealth,
4451
env={"QT_API": "pyqt6", "FORCE_QT_API": "1"},

tests/test_manim.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66

77
import manim_slides.slide as slide
88

9+
skip_if_py39 = pytest.mark.skipif(
10+
sys.version_info < (3, 10),
11+
reason="See https://github.com/3b1b/manim/issues/2263",
12+
)
13+
914

1015
def assert_import(
1116
*,
@@ -20,6 +25,7 @@ def assert_import(
2025
assert slide.MANIMGL == manimgl
2126

2227

28+
@skip_if_py39
2329
def test_force_api() -> None:
2430
pytest.importorskip("manimlib")
2531
import manim # noqa: F401
@@ -53,6 +59,7 @@ def test_invalid_api() -> None:
5359
del os.environ[slide.MANIM_API]
5460

5561

62+
@skip_if_py39
5663
@pytest.mark.filterwarnings("ignore:assert_import")
5764
def test_manim_and_manimgl_imported() -> None:
5865
pytest.importorskip("manimlib")
@@ -79,6 +86,7 @@ def test_manim_imported() -> None:
7986
)
8087

8188

89+
@skip_if_py39
8290
def test_manimgl_imported() -> None:
8391
pytest.importorskip("manimlib")
8492
import manimlib # noqa: F401

tests/test_slide.py

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,23 +26,32 @@
2626
from manim_slides.render import render
2727
from manim_slides.slide.manim import Slide as CESlide
2828

29-
30-
class CEGLSlide(CESlide):
31-
def __init__(self, *args: Any, **kwargs: Any) -> None:
32-
super().__init__(*args, renderer=OpenGLRenderer(), **kwargs)
33-
34-
35-
if sys.version_info >= (3, 12):
29+
if sys.version_info < (3, 10):
3630

3731
class _GLSlide:
38-
pass
32+
def construct(self) -> None:
33+
pass
34+
35+
def render(self) -> None:
36+
pass
3937

40-
GLSlide = pytest.param(_GLSlide, marks=pytest.mark.skip())
38+
GLSlide = pytest.param(
39+
_GLSlide,
40+
marks=pytest.mark.skip(reason="See https://github.com/3b1b/manim/issues/2263"),
41+
)
4142
else:
4243
from manim_slides.slide.manimlib import Slide as GLSlide
4344

44-
SlideType = Union[type[CESlide], type[GLSlide], type[CEGLSlide]]
45-
Slide = Union[CESlide, GLSlide, CEGLSlide]
45+
_GLSlide = GLSlide
46+
47+
48+
class CEGLSlide(CESlide):
49+
def __init__(self, *args: Any, **kwargs: Any) -> None:
50+
super().__init__(*args, renderer=OpenGLRenderer(), **kwargs)
51+
52+
53+
SlideType = Union[type[CESlide], type[_GLSlide], type[CEGLSlide]]
54+
Slide = Union[CESlide, _GLSlide, CEGLSlide]
4655

4756

4857
@pytest.mark.parametrize(
@@ -52,8 +61,8 @@ class _GLSlide:
5261
pytest.param(
5362
"--GL",
5463
marks=pytest.mark.skipif(
55-
sys.version_info >= (3, 12),
56-
reason="ManimGL requires numpy<1.25, which is outdated and Python < 3.12",
64+
sys.version_info < (3, 10),
65+
reason="See https://github.com/3b1b/manim/issues/2263.",
5766
),
5867
),
5968
],
@@ -161,8 +170,8 @@ def test_clear_cache(
161170
pytest.param(
162171
"--GL",
163172
marks=pytest.mark.skipif(
164-
sys.version_info >= (3, 12),
165-
reason="ManimGL requires numpy<1.25, which is outdated and Python < 3.12",
173+
sys.version_info < (3, 10),
174+
reason="See https://github.com/3b1b/manim/issues/2263.",
166175
),
167176
),
168177
],

0 commit comments

Comments
 (0)