Skip to content

Commit e2d8c56

Browse files
fix(lib): Manim fixes, bump to >= 0.18, and tests (#447)
* fix(lib): Manim fixes, bump to >= 0.18, and tests * chore(ci): tests and happy mypy * chore(deps): fix override * fix(tests): correct skipping * fix(ci): coverage * fix(docs): dead links * fix(tests): deps fixes * fix(deps): add missing override * fix(tests): correctly ignore * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * chore(tests): no filterwarning * chore(tests): add a check to see if we can install package * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * chore(ci): typo * fix(ci): typo * oops * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix(ci): double quote instead of single * chore(ci): add OSes requirements * chore(tests): removed `full-gl` extra * chore(ci): automatically cancel jobs * fix(docs): typo --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent e80d1d0 commit e2d8c56

File tree

11 files changed

+600
-281
lines changed

11 files changed

+600
-281
lines changed

.github/workflows/tests.yml

Lines changed: 45 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,52 @@ on:
77

88
name: Tests
99

10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
12+
cancel-in-progress: true
13+
1014
jobs:
15+
pip-install:
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
os: [macos-latest, ubuntu-latest, windows-latest]
20+
pyversion: ['3.9', '3.10', '3.11', '3.12']
21+
extras: [pyside6-full, manimgl]
22+
exclude:
23+
- pyversion: '3.12'
24+
extras: manimgl
25+
runs-on: ${{ matrix.os }}
26+
steps:
27+
- name: Checkout repository
28+
uses: actions/checkout@v4
29+
30+
- name: Install Python
31+
uses: actions/setup-python@v5
32+
with:
33+
python-version: ${{ matrix.pyversion }}
34+
cache: pip
35+
36+
- name: Install manim dependencies on MacOS
37+
if: matrix.os == 'macos-latest'
38+
run: brew install ffmpeg py3cairo pango pkg-config scipy
39+
40+
- name: Install manim dependencies on Ubuntu
41+
if: matrix.os == 'ubuntu-latest'
42+
run: |
43+
sudo apt-get update
44+
sudo apt-get install build-essential python3-dev libcairo2-dev libpango1.0-dev ffmpeg freeglut3-dev xvfb
45+
nohup Xvfb $DISPLAY &
46+
47+
- name: Install Windows dependencies
48+
if: matrix.os == 'windows-latest'
49+
run: choco install ffmpeg
50+
51+
- name: Install package
52+
shell: bash
53+
env:
54+
extras: ${{ matrix.extras }}
55+
run: pip install ".[$extras]"
1156
pytest:
1257
strategy:
1358
fail-fast: false
@@ -74,15 +119,9 @@ jobs:
74119

75120
- name: Run pytest
76121
shell: bash
77-
if: matrix.os != 'ubuntu-latest' || matrix.pyversion != '3.11'
78122
run: rye run pytest
79123

80-
- name: Run pytest and coverage
81-
if: matrix.os == 'ubuntu-latest' && matrix.pyversion == '3.11'
82-
run: rye run pytest --cov-report xml --cov=manim_slides tests/
83-
84124
- name: Upload to codecov.io
85-
if: matrix.os == 'ubuntu-latest' && matrix.pyversion == '3.11'
86125
uses: codecov/codecov-action@v4
87126
env:
88127
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ paper/paper.pdf
4545
paper/media/
4646

4747
# Others
48+
.coverage
4849
coverage.xml
4950

5051
rendering_times.csv

.readthedocs.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,7 @@ sphinx:
1515
fail_on_warning: true
1616
python:
1717
install:
18-
- requirements: requirements-dev.lock
18+
- method: pip
19+
path: .
20+
extra_requirements:
21+
- docs

CHANGELOG.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1919
[samuelcolvin/rtoml#74](https://github.com/samuelcolvin/rtoml/issues/74)
2020
is solved.
2121
[#432](https://github.com/jeertmans/manim-slides/pull/432)
22+
- Removed an old validation check that prevented setting `loop=True` with
23+
`auto_next=True` on `next_slide()`
24+
[#445](https://github.com/jeertmans/manim-slides/pull/445)
25+
- Improved (and fixed) tests for Manim(GL), bumped minimal ManimCE version,
26+
improved coverage, and override dependency conflicts.
27+
[#447](https://github.com/jeertmans/manim-slides/pull/447)
2228

2329
(unreleased-fixed)=
2430
### Fixed
@@ -28,12 +34,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2834
- Fixed whitespace issue in default RevealJS template.
2935
[#442](https://github.com/jeertmans/manim-slides/pull/442)
3036

31-
(unreleased-chore)=
32-
### Chore
37+
(unreleased-removed)=
38+
### Removed
3339

34-
- Removed an old validation check that prevented setting `loop=True` with
35-
`auto_next=True` on `next_slide()`
36-
[#445](https://github.com/jeertmans/manim-slides/pull/445)
40+
- Removed `full-gl` extra, because it does not make sense to ship both
41+
`manimgl` and `manim` together.
42+
[#447](https://github.com/jeertmans/manim-slides/pull/447)
3743

3844
(v5.1.7)=
3945
## [v5.1.7](https://github.com/jeertmans/manim-slides/compare/v5.1.6...v5.1.7)

docs/source/gallery.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ using Manim Slides presentations.
2323

2424
Daniel publishes his presentations on *Cosmology, String Theory and related*
2525
topics on his
26-
[personal website](https://panopepino.github.io/web_page/main_page/slides.html).
26+
[personal website](https://panopepino.github.io/Web_Page/main_page/slides.html).
2727

2828
For example, below are the slides of a seminar he gave titled
29-
[Our Universe on a (Dark) Bubble](https://panopepino.github.io/web_page/main_page/presentations/2023_11_long/LS.html).
29+
[Our Universe on a (Dark) Bubble](https://panopepino.github.io/Web_Page/main_page/presentations/2023_11_long/LS.html).
3030

3131
<div style="position:relative;padding-bottom:56.25%;">
3232
<iframe

docs/source/installation.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,6 @@ using optional dependencies:
108108

109109
- `full`, to include `magic`, `manim`, and
110110
`sphinx-directive` extras (see below);
111-
- `full-gl`, to include `magic`, `manimgl`, and
112-
`sphinx-directive` extras (see below);
113111
- `magic`, to include a Jupyter magic to render
114112
animations inside notebooks. This automatically installs `manim`,
115113
and does not work with ManimGL;

manim_slides/slide/manim.py

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
from typing import Any, Optional
33

44
from manim import Scene, ThreeDScene, config
5+
from manim.renderer.opengl_renderer import OpenGLRenderer
6+
from manim.utils.color import rgba_to_color
57

68
from ..config import BaseSlideConfig
79
from .base import BaseSlide
@@ -13,25 +15,40 @@ class Slide(BaseSlide, Scene): # type: ignore[misc]
1315
for slides rendering.
1416
"""
1517

18+
@property
19+
def _frame_shape(self) -> tuple[float, float]:
20+
if isinstance(self.renderer, OpenGLRenderer):
21+
return self.renderer.camera.frame_shape # type: ignore
22+
else:
23+
return (
24+
self.renderer.camera.frame_height,
25+
self.renderer.camera.frame_width,
26+
)
27+
1628
@property
1729
def _frame_height(self) -> float:
18-
return config["frame_height"] # type: ignore
30+
return self._frame_shape[0]
1931

2032
@property
2133
def _frame_width(self) -> float:
22-
return config["frame_width"] # type: ignore
34+
return self._frame_shape[1]
2335

2436
@property
2537
def _background_color(self) -> str:
26-
color = self.camera.background_color
27-
if hex_color := getattr(color, "hex", None):
28-
return hex_color # type: ignore
29-
else: # manim>=0.18, see https://github.com/ManimCommunity/manim/pull/3020
30-
return color.to_hex() # type: ignore
38+
if isinstance(self.renderer, OpenGLRenderer):
39+
return rgba_to_color(self.renderer.background_color).to_hex() # type: ignore
40+
else:
41+
return self.renderer.camera.background_color.to_hex() # type: ignore
3142

3243
@property
3344
def _resolution(self) -> tuple[int, int]:
34-
return config["pixel_width"], config["pixel_height"]
45+
if isinstance(self.renderer, OpenGLRenderer):
46+
return self.renderer.get_pixel_shape() # type: ignore
47+
else:
48+
return (
49+
self.renderer.camera.pixel_width,
50+
self.renderer.camera.pixel_height,
51+
)
3552

3653
@property
3754
def _partial_movie_files(self) -> list[Path]:

pyproject.toml

Lines changed: 36 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -42,20 +42,35 @@ name = "manim-slides"
4242
requires-python = ">=3.9"
4343

4444
[project.optional-dependencies]
45+
docs = [
46+
"manim-slides[magic,manim,pyqt6,sphinx-directive]",
47+
"furo>=2023.5.20",
48+
"ipykernel>=6.25.1",
49+
"myst-parser>=2.0.0",
50+
"nbsphinx>=0.9.2",
51+
"pandoc>=2.3",
52+
"sphinx>=7.0.1",
53+
"sphinx-click>=4.4.0",
54+
"sphinx-copybutton>=0.5.1",
55+
"sphinxext-opengraph>=0.7.5",
56+
]
4557
full = [
4658
"manim-slides[magic,manim,sphinx-directive]",
4759
]
48-
full-gl = [
49-
"manim-slides[magic,manimgl,sphinx-directive]",
50-
]
5160
magic = ["manim-slides[manim]", "ipython>=8.12.2"]
52-
manim = ["manim>=0.17.3"]
61+
manim = ["manim>=0.18.0"]
5362
manimgl = ["manimgl>=1.6.1;python_version<'3.12'"]
5463
pyqt6 = ["pyqt6>=6.6.1"]
5564
pyqt6-full = ["manim-slides[full,pyqt6]"]
56-
pyside6 = ["pyside6>=6.5.1,<6.5.3;python_version<'3.12'"]
65+
pyside6 = ["pyside6>=6.5.1,<6.5.3;python_version<'3.12'", "pyside6>=6.6.1;python_version>='3.12'"]
5766
pyside6-full = ["manim-slides[full,pyside6]"]
5867
sphinx-directive = ["docutils>=0.20.1", "manim-slides[manim]"]
68+
tests = [
69+
"pytest>=7.4.0",
70+
"pytest-cov>=4.1.0",
71+
"pytest-env>=0.8.2",
72+
"pytest-qt>=4.2.0",
73+
]
5974

6075
[project.scripts]
6176
manim-slides = "manim_slides.__main__:cli"
@@ -161,13 +176,14 @@ python_version = "3.9"
161176
strict = true
162177

163178
[tool.pytest.ini_options]
179+
addopts = [
180+
"--cov-report=xml",
181+
"--cov=manim_slides",
182+
]
164183
env = [
184+
"QT_API=pyside6",
165185
"QT_QPA_PLATFORM=offscreen",
166186
]
167-
filterwarnings = [
168-
"error",
169-
"ignore::DeprecationWarning",
170-
]
171187

172188
[tool.ruff]
173189
extend-exclude = ["manim_slides/resources.py"]
@@ -193,27 +209,20 @@ extend-ignore = [
193209
extend-select = ["B", "C90", "D", "I", "N", "RUF", "UP", "T"]
194210
isort = {known-first-party = ["manim_slides", "tests"]}
195211

212+
[tool.ruff.lint.per-file-ignores]
213+
"tests/test_slide.py" = ["N801"]
214+
196215
[tool.rye]
197216
dev-dependencies = [
198-
"manim-slides[magic,manim,manimgl,pyqt6,sphinx-directive]",
199-
# dev
200217
"bump-my-version>=0.20.3",
201218
"pre-commit>=3.5.0",
202-
# docs
203-
"furo>=2023.5.20",
204-
"ipykernel>=6.25.1",
205-
"myst-parser>=2.0.0",
206-
"nbsphinx>=0.9.2",
207-
"pandoc>=2.3",
208-
"sphinx>=7.0.1",
209-
"sphinx-click>=4.4.0",
210-
"sphinx-copybutton>=0.5.1",
211-
"sphinxext-opengraph>=0.7.5",
212-
# tests
213-
"pytest>=7.4.0",
214-
"pytest-cov>=4.1.0",
215-
"pytest-env>=0.8.2",
216-
"pytest-qt>=4.2.0",
217-
"pytest-xdist>=3.3.1",
218219
]
219220
managed = true
221+
222+
[tool.uv]
223+
override-dependencies = [
224+
# Bypass constraints from ManimGL
225+
"manimpango>=0.5.0,<1.0.0",
226+
"numpy<=1.24;python_version < '3.12'",
227+
"numpy>=1.26;python_version >= '3.12'",
228+
]

0 commit comments

Comments
 (0)