mirror of
https://github.com/jeertmans/manim-slides.git
synced 2025-09-17 03:04:26 +08:00
Compare commits
17 Commits
Author | SHA1 | Date | |
---|---|---|---|
4e9cabf5cf | |||
36ac50a9ce | |||
3e07d2925e | |||
ff08345cfd | |||
8c05e84f57 | |||
ba733eeb97 | |||
14813f7af1 | |||
2f62915ad6 | |||
c81e117bb8 | |||
6255f644ab | |||
9e12feb275 | |||
d2d5cc10b7 | |||
3c6e2db7db | |||
04b0eb5685 | |||
0c6cd67038 | |||
a5412a8df2 | |||
e9480c9bc7 |
2
.github/workflows/tests.yml
vendored
2
.github/workflows/tests.yml
vendored
@ -96,7 +96,7 @@ jobs:
|
||||
uses: ssciwr/setup-mesa-dist-win@v2
|
||||
|
||||
- name: Run pytest
|
||||
run: uv run --python ${{ matrix.pyversion }} --frozen --extra tests pytest
|
||||
run: uv run --python ${{ matrix.pyversion }} --frozen --group tests --no-dev pytest
|
||||
|
||||
- name: Upload to codecov.io
|
||||
uses: codecov/codecov-action@v5
|
||||
|
@ -6,14 +6,14 @@ ci:
|
||||
autoupdate_commit_msg: 'chore(deps): pre-commit autoupdate'
|
||||
repos:
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v5.0.0
|
||||
rev: v6.0.0
|
||||
hooks:
|
||||
- id: check-yaml
|
||||
- id: check-toml
|
||||
- id: end-of-file-fixer
|
||||
- id: trailing-whitespace
|
||||
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
|
||||
rev: v2.14.0
|
||||
rev: v2.15.0
|
||||
hooks:
|
||||
- id: pretty-format-yaml
|
||||
args: [--autofix]
|
||||
@ -21,13 +21,13 @@ repos:
|
||||
exclude: poetry.lock
|
||||
args: [--autofix, --trailing-commas]
|
||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||
rev: v0.11.2
|
||||
rev: v0.12.10
|
||||
hooks:
|
||||
- id: ruff
|
||||
args: [--fix]
|
||||
- id: ruff-format
|
||||
- repo: https://github.com/pre-commit/mirrors-mypy
|
||||
rev: v1.15.0
|
||||
rev: v1.17.1
|
||||
hooks:
|
||||
- id: mypy
|
||||
additional_dependencies: [types-requests, types-setuptools]
|
||||
|
@ -6,13 +6,13 @@ build:
|
||||
apt_packages:
|
||||
- libpango1.0-dev
|
||||
- ffmpeg
|
||||
jobs:
|
||||
post_create_environment:
|
||||
- asdf plugin add uv
|
||||
- asdf install uv latest
|
||||
- asdf global uv latest
|
||||
- UV_PROJECT_ENVIRONMENT=$READTHEDOCS_VIRTUALENV_PATH uv sync --group docs --no-dev --no-cache
|
||||
sphinx:
|
||||
builder: html
|
||||
configuration: docs/source/conf.py
|
||||
fail_on_warning: true
|
||||
python:
|
||||
install:
|
||||
- method: pip
|
||||
path: .
|
||||
extra_requirements:
|
||||
- docs
|
||||
|
39
CHANGELOG.md
39
CHANGELOG.md
@ -8,7 +8,44 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
<!-- start changelog -->
|
||||
|
||||
(unreleased)=
|
||||
## [Unreleased](https://github.com/jeertmans/manim-slides/compare/v5.5.1...HEAD)
|
||||
## [Unreleased](https://github.com/jeertmans/manim-slides/compare/v5.5.2...HEAD)
|
||||
|
||||
(v5.5.2)=
|
||||
## [v5.5.2](https://github.com/jeertmans/manim-slides/compare/v5.5.1...v5.5.2)
|
||||
|
||||
(v5.5.2-added)=
|
||||
### Added
|
||||
|
||||
- `manim-slides render` now exits with the same return code as the one returned by `manim render` or `manimgl`.
|
||||
[@chrjabs](https://github.com/chrjabs) [#545](https://github.com/jeertmans/manim-slides/pull/545)
|
||||
|
||||
(v5.5.2-chore)=
|
||||
### Chore
|
||||
|
||||
- Moved `docs` and `tests` extras, as well as `dev-dependencies`,
|
||||
inside groups in `dependency-groups`. This could break existing code
|
||||
when using one of those extras, but as they were not part of the public API,
|
||||
we do not consider this to be a **breaking change**.
|
||||
[#542](https://github.com/jeertmans/manim-slides/pull/542)
|
||||
- Added example in the research section of the gallery.
|
||||
[@mmcilree](https://github.com/mmcilree) [#552](https://github.com/jeertmans/manim-slides/pull/552)
|
||||
- Added example in the school work section of the gallery.
|
||||
[@casperalgera](https://github.com/casperalgera) [#556](https://github.com/jeertmans/manim-slides/pull/556)
|
||||
- Added example in the school work section of the gallery.
|
||||
[@amstrdm](https://github.com/amstrdm) [#557](https://github.com/jeertmans/manim-slides/pull/557)
|
||||
- Fixed some tests that were failing.
|
||||
[#550](https://github.com/jeertmans/manim-slides/pull/550)
|
||||
- Pinned `setuptools<81` for `manimgl` extra, as `setuptools>=81`
|
||||
dropped support for its API.
|
||||
[#550](https://github.com/jeertmans/manim-slides/pull/550)
|
||||
|
||||
(v5.5.2-fixed)=
|
||||
### Fixed
|
||||
|
||||
- Fixed potential import issue of ManimGL, importing `manimlib` will parse `sys.argv`
|
||||
to initialize the config, which can lead to surprising behavior when using the library with
|
||||
different command line arguments that are not meant to be used by ManimGL.
|
||||
[#550](https://github.com/jeertmans/manim-slides/pull/550)
|
||||
|
||||
(v5.5.1)=
|
||||
## [v5.5.1](https://github.com/jeertmans/manim-slides/compare/v5.5.0...v5.5.1)
|
||||
|
@ -27,7 +27,7 @@ keywords:
|
||||
- PowerPoint
|
||||
- Python
|
||||
license: MIT
|
||||
version: v5.5.1
|
||||
version: v5.5.2
|
||||
preferred-citation:
|
||||
publisher:
|
||||
name: The Open Journal
|
||||
|
20
README.md
20
README.md
@ -154,21 +154,23 @@ Below is a comparison of the most used ones with Manim Slides:
|
||||
|
||||
## Citing
|
||||
|
||||
If you use this project, please cite it using the following reference:
|
||||
If you use this software, please cite it using as:
|
||||
|
||||
```bibtex
|
||||
@article{Jerome_Eertmans_Manim_Slides_A_2023,
|
||||
title = {{Manim Slides: A Python package for presenting Manim content anywhere}},
|
||||
author = {{Jérome Eertmans}},
|
||||
year = 2023,
|
||||
month = aug,
|
||||
journal = {Journal of Open Source Education},
|
||||
volume = 6,
|
||||
doi = {10.21105/jose.00206}
|
||||
title = {{Manim Slides: A Python package for presenting Manim content anywhere}},
|
||||
author = {{Jérome Eertmans}},
|
||||
year = 2023,
|
||||
month = aug,
|
||||
journal = {Journal of Open Source Education},
|
||||
volume = 6,
|
||||
doi = {10.21105/jose.00206}
|
||||
}
|
||||
```
|
||||
|
||||
or by linking this GitHub repository at the end of the presentation.
|
||||
or by linking this GitHub repository at the end of your presentation.
|
||||
|
||||
Other citation formats can be obtained by clicking on the *Cite this repository* button on this page.
|
||||
|
||||
## Contributing
|
||||
|
||||
|
@ -32,7 +32,7 @@ and development dependencies. If not already, please install this tool.
|
||||
With uv, installation becomes straightforward:
|
||||
|
||||
```bash
|
||||
uv sync --all-extras
|
||||
uv sync
|
||||
```
|
||||
|
||||
:::{note}
|
||||
|
@ -10,20 +10,22 @@ The following summarizes the different presentation features Manim Slides offers
|
||||
| :--- | :---: | :---: | :---: | :---: |
|
||||
| Basic navigation through slides | Yes | Yes | Yes | Yes (static image) |
|
||||
| Replay slide | Yes | No | No | N/A |
|
||||
| Pause animation | Yes | No | No | N/A |
|
||||
| Pause animation | Yes | Yes | No | N/A |
|
||||
| Play slide in reverse | Yes | No | No | N/A |
|
||||
| Slide count | Yes | Yes (optional) | Yes (optional) | N/A |
|
||||
| Needs Python with Manim Slides installed | Yes | No | No | No
|
||||
| Requires internet access | No | Yes | No | No |
|
||||
| Requires internet access | No | Depends[^1] | No | No |
|
||||
| Auto. play slides | Yes | Yes | Yes | N/A |
|
||||
| Loops support | Yes | Yes | Yes | N/A |
|
||||
| Fully customizable | No | Yes (`--use-template` option) | No | No |
|
||||
| Other dependencies | None | A modern web browser | PowerPoint or LibreOffice Impress[^1] | None |
|
||||
| Works cross-platforms | Yes | Yes | Partly[^1][^2] | Yes |
|
||||
| Other dependencies | None | A modern web browser | PowerPoint or LibreOffice Impress[^2] | None |
|
||||
| Works cross-platforms | Yes | Yes | Partly[^2][^3] | Yes |
|
||||
:::
|
||||
|
||||
[^1]: If you encounter a problem where slides do not automatically play or loops do not work,
|
||||
[^1]: By default, HTML assets are loaded from the internet, but they can be
|
||||
pre-downloaded and embedded in the HTML file at conversion time.
|
||||
[^2]: If you encounter a problem where slides do not automatically play or loops do not work,
|
||||
please
|
||||
[file an issue on GitHub](https://github.com/jeertmans/manim-slides/issues/new/choose).
|
||||
[^2]: PowerPoint online does not seem to support automatic playing of videos,
|
||||
[^3]: PowerPoint online does not seem to support automatic playing of videos,
|
||||
so you need LibreOffice Impress on Linux platforms.
|
||||
|
@ -14,7 +14,7 @@ If you too have created content with Manim Slides that is available online
|
||||
(e.g., a YouTube video or website),
|
||||
don't hesitate to contact us so that we can share your content on this page!
|
||||
|
||||
## Scientif Research
|
||||
## Scientific Research
|
||||
|
||||
Below are people that dissimenate their research results
|
||||
using Manim Slides presentations.
|
||||
@ -23,7 +23,7 @@ using Manim Slides presentations.
|
||||
|
||||
Daniel publishes his presentations on *Cosmology, String Theory and related*
|
||||
topics on his
|
||||
[personal website](https://panopepino.github.io/web_page/main_page/slides.html). https://panopepino.github.io/web_page/main_page/slides.html
|
||||
[personal website](https://panopepino.github.io/web_page/main_page/slides.html).
|
||||
|
||||
For example, below are the slides of a seminar he gave titled
|
||||
[Our Universe on a (Dark) Bubble](https://panopepino.github.io/web_page/main_page/presentations/2023_11_long/LS.html).
|
||||
@ -67,9 +67,66 @@ For example, below are the slides of his
|
||||
</iframe>
|
||||
</div>
|
||||
|
||||
### Matthew McIlree
|
||||
|
||||
Matthew is a Computer Science researcher from Scotland and has used Manim Slides
|
||||
to present his work on *Proof Logging for Constraint Programming*. He also publishes
|
||||
his presentation slides on his [personal website](https://matthewmcilree.com).
|
||||
|
||||
Here are the slides from a 25-minute talk he presented at the 39th Annual AAAI Conference on Artificial Intelligence titled
|
||||
[Certifying Bounds Propagation for Integer Multiplication Constraints](https://matthewmcilree.com/files/slides/mcilree_aaai2025.html).
|
||||
|
||||
<div style="position:relative;padding-bottom:56.25%;">
|
||||
<iframe
|
||||
loading="lazy"
|
||||
style="width:100%;height:100%;position:absolute;left:0px;top:0px;"
|
||||
frameborder="1"
|
||||
width="100%"
|
||||
height="100%"
|
||||
allowfullscreen
|
||||
allow="autoplay"
|
||||
src="https://matthewmcilree.com/files/slides/mcilree_aaai2025.html">
|
||||
</iframe>
|
||||
</div>
|
||||
|
||||
## School Work
|
||||
|
||||
Below are people that used Manim Slides for school presentations.
|
||||
|
||||
*This list is currently empty. Please reach out to us if you have examples
|
||||
to share!*
|
||||
### Antonio Caserta
|
||||
|
||||
Antonio is a 17-year-old high school student from Germany who used Manim Slides to present his final project, *Episteme*, an AI financial terminal that uses crowdsourced data from social networks to gather stock insights.
|
||||
|
||||
The slides from his 30-minute presentation to the school board can be found below and on his [Github repository](https://github.com/amstrdm/episteme-manim-slides)
|
||||
|
||||
<div style="position:relative;padding-bottom:56.25%;">
|
||||
<iframe
|
||||
loading="lazy"
|
||||
style="width:100%;height:100%;position:absolute;left:0px;top:0px;"
|
||||
frameborder="1"
|
||||
width="100%"
|
||||
height="100%"
|
||||
allowfullscreen
|
||||
allow="autoplay"
|
||||
src="https://amstrdm.github.io/episteme-manim-slides/">
|
||||
</iframe>
|
||||
</div>
|
||||
|
||||
### Casper Algera
|
||||
|
||||
Casper, a mathematics student from the Netherlands, used Manim Slides to present his bachelor's thesis.
|
||||
In his presentation, he illustrates a probabilistic coupling argument related to the [contact process](https://en.wikipedia.org/wiki/Contact_process_(mathematics)).
|
||||
His slides are available below, and his full presentation can be viewed on [YouTube](https://www.youtube.com/watch?v=ZJhvfCL5MWE).
|
||||
|
||||
<div style="position:relative;padding-bottom:56.25%;">
|
||||
<iframe
|
||||
loading="lazy"
|
||||
style="width:100%;height:100%;position:absolute;left:0px;top:0px;"
|
||||
frameborder="1"
|
||||
width="100%"
|
||||
height="100%"
|
||||
allowfullscreen
|
||||
allow="autoplay"
|
||||
src="https://casperalgera.github.io/criticalvalueCP/">
|
||||
</iframe>
|
||||
</div>
|
||||
|
@ -1 +1 @@
|
||||
__version__ = "5.5.1"
|
||||
__version__ = "5.5.2"
|
||||
|
@ -20,8 +20,13 @@ def checkhealth() -> None:
|
||||
click.secho("\tmanim not found", bold=True)
|
||||
|
||||
try:
|
||||
# Manimlib parses sys.argv on import, so we clear it temporarily.
|
||||
old_argv = sys.argv
|
||||
sys.argv = [__file__]
|
||||
from manimlib import __version__ as manimlib_version
|
||||
|
||||
sys.argv = old_argv
|
||||
|
||||
click.echo(f"\tmanimgl (version: {manimlib_version})")
|
||||
except ImportError:
|
||||
click.secho("\tmanimgl not found", bold=True)
|
||||
|
@ -48,6 +48,7 @@ def render(ce: bool, gl: bool, args: tuple[str, ...]) -> None:
|
||||
if ce and gl:
|
||||
raise click.UsageError("You cannot specify both --CE and --GL renderers.")
|
||||
if gl:
|
||||
subprocess.run([sys.executable, "-m", "manimlib", "-w", *args])
|
||||
completed = subprocess.run([sys.executable, "-m", "manimlib", "-w", *args])
|
||||
else:
|
||||
subprocess.run([sys.executable, "-m", "manim", "render", *args])
|
||||
completed = subprocess.run([sys.executable, "-m", "manim", "render", *args])
|
||||
sys.exit(completed.returncode)
|
||||
|
@ -22,8 +22,17 @@ if MANIM:
|
||||
from manim import LEFT, AnimationGroup, FadeIn, FadeOut
|
||||
from manim.mobject.mobject import Mobject
|
||||
else:
|
||||
import sys
|
||||
|
||||
# Manimlib parses sys.argv on import, so we clear it temporarily.
|
||||
old_argv = sys.argv
|
||||
sys.argv = [__file__]
|
||||
from manimlib import LEFT, AnimationGroup, FadeIn, FadeOut
|
||||
|
||||
sys.argv = old_argv
|
||||
|
||||
del sys
|
||||
|
||||
Mobject = Any
|
||||
|
||||
|
||||
|
@ -1,9 +1,15 @@
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from typing import Any, ClassVar, Optional
|
||||
|
||||
from manimlib import Scene, ThreeDCamera
|
||||
# Manimlib parses sys.argv on import, so we clear it temporarily.
|
||||
old_argv = sys.argv
|
||||
sys.argv = [__file__]
|
||||
from manimlib import Scene, ThreeDCamera # noqa: E402
|
||||
|
||||
from .base import BaseSlide
|
||||
sys.argv = old_argv
|
||||
|
||||
from .base import BaseSlide # noqa: E402
|
||||
|
||||
|
||||
class Slide(BaseSlide, Scene): # type: ignore[misc]
|
||||
|
@ -2,6 +2,39 @@
|
||||
build-backend = "hatchling.build"
|
||||
requires = ["hatchling", "hatch-fancy-pypi-readme"]
|
||||
|
||||
[dependency-groups]
|
||||
dev = [
|
||||
{include-group = "docs"},
|
||||
{include-group = "tests"},
|
||||
"bump-my-version>=0.20.3",
|
||||
"pre-commit>=3.5.0",
|
||||
]
|
||||
docs = [
|
||||
"manim-slides[magic,manim,pyqt6,sphinx-directive]",
|
||||
"furo>=2023.5.20",
|
||||
"ipykernel>=6.25.1",
|
||||
"myst-parser>=2.0.0",
|
||||
"nbsphinx>=0.9.2",
|
||||
"pandoc>=2.3",
|
||||
"pygments<2.19", # See: https://github.com/ManimCommunity/manim/issues/4104
|
||||
"sphinx>=7.0.1",
|
||||
"sphinxcontrib-programoutput>=0.18",
|
||||
"sphinx-design>=0.6.1",
|
||||
"sphinx-click>=4.4.0",
|
||||
"sphinx-copybutton>=0.5.1",
|
||||
"sphinxext-opengraph>=0.7.5",
|
||||
]
|
||||
tests = [
|
||||
"importlib-metadata>=8.6.1;python_version<'3.10'",
|
||||
"manim-slides[full,manim,manimgl,pyqt6,pyside6,sphinx-directive]",
|
||||
"pytest>=7.4.0",
|
||||
"pytest-cov>=4.1.0",
|
||||
"pytest-env>=0.8.2",
|
||||
"pytest-missing-modules>=0.1.0",
|
||||
"pytest-qt>=4.2.0",
|
||||
"setuptools>=73.0.1",
|
||||
]
|
||||
|
||||
[project]
|
||||
authors = [{name = "Jérome Eertmans", email = "jeertmans@icloud.com"}]
|
||||
classifiers = [
|
||||
@ -42,41 +75,17 @@ name = "manim-slides"
|
||||
requires-python = ">=3.9"
|
||||
|
||||
[project.optional-dependencies]
|
||||
docs = [
|
||||
"manim-slides[magic,manim,pyqt6,sphinx-directive]",
|
||||
"furo>=2023.5.20",
|
||||
"ipykernel>=6.25.1",
|
||||
"myst-parser>=2.0.0",
|
||||
"nbsphinx>=0.9.2",
|
||||
"pandoc>=2.3",
|
||||
"pygments<2.19", # See: https://github.com/ManimCommunity/manim/issues/4104
|
||||
"sphinx>=7.0.1",
|
||||
"sphinxcontrib-programoutput>=0.18",
|
||||
"sphinx-design>=0.6.1",
|
||||
"sphinx-click>=4.4.0",
|
||||
"sphinx-copybutton>=0.5.1",
|
||||
"sphinxext-opengraph>=0.7.5",
|
||||
]
|
||||
full = [
|
||||
"manim-slides[magic,manim,sphinx-directive]",
|
||||
]
|
||||
magic = ["manim-slides[manim]", "ipython>=8.12.2"]
|
||||
manim = ["manim>=0.19"]
|
||||
manimgl = ["manimgl>=1.7.2"]
|
||||
manimgl = ["manimgl>=1.7.2", "setuptools<81"]
|
||||
pyqt6 = ["pyqt6>=6.7.0"]
|
||||
pyqt6-full = ["manim-slides[full,pyqt6]"]
|
||||
pyside6 = ["pyside6>=6.6.1,!=6.8.1.1"]
|
||||
pyside6-full = ["manim-slides[full,pyside6]"]
|
||||
sphinx-directive = ["docutils>=0.20.1", "manim-slides[manim]"]
|
||||
tests = [
|
||||
"importlib-metadata>=8.6.1;python_version<'3.10'",
|
||||
"manim-slides[full,manimgl,pyqt6,pyside6,sphinx-directive]",
|
||||
"pytest>=7.4.0",
|
||||
"pytest-cov>=4.1.0",
|
||||
"pytest-env>=0.8.2",
|
||||
"pytest-missing-modules>=0.1.0",
|
||||
"pytest-qt>=4.2.0",
|
||||
]
|
||||
|
||||
[project.scripts]
|
||||
manim-slides = "manim_slides.__main__:cli"
|
||||
@ -92,7 +101,7 @@ Repository = "https://github.com/jeertmans/manim-slides"
|
||||
allow_dirty = false
|
||||
commit = true
|
||||
commit_args = ""
|
||||
current_version = "5.5.1"
|
||||
current_version = "5.5.2"
|
||||
ignore_missing_version = false
|
||||
message = "chore(deps): bump version from {current_version} to {new_version}"
|
||||
parse = '(?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(-rc(?P<release>\d+))?'
|
||||
@ -196,13 +205,13 @@ filterwarnings = [
|
||||
'ignore::DeprecationWarning:pkg_resources.*:',
|
||||
'ignore:invalid escape sequence.*:DeprecationWarning',
|
||||
'ignore:invalid escape sequence.*:SyntaxWarning',
|
||||
'ignore:urllib3 v2 only supports OpenSSL.*:urllib3.exceptions.NotOpenSSLWarning',
|
||||
]
|
||||
|
||||
[tool.ruff]
|
||||
extend-exclude = ["manim_slides/resources.py"]
|
||||
extend-include = ["*.ipynb"]
|
||||
line-length = 88
|
||||
target-version = "py39"
|
||||
|
||||
[tool.ruff.lint]
|
||||
extend-ignore = [
|
||||
@ -225,10 +234,3 @@ isort = {known-first-party = ["manim_slides", "tests"]}
|
||||
[tool.ruff.lint.per-file-ignores]
|
||||
"docs/source/reference/magic_example.ipynb" = ["F403", "F405"]
|
||||
"tests/test_slide.py" = ["N801"]
|
||||
|
||||
[tool.uv]
|
||||
dev-dependencies = [
|
||||
"bump-my-version>=0.20.3",
|
||||
"pre-commit>=3.5.0",
|
||||
"setuptools>=73.0.1",
|
||||
]
|
||||
|
@ -42,3 +42,8 @@ class BasicSlide(Slide):
|
||||
|
||||
class BasicSlideSkipReversing(BasicSlide):
|
||||
skip_reversing = True
|
||||
|
||||
|
||||
class FailingSlide(Slide):
|
||||
def construct(self):
|
||||
self.play("this fails to render")
|
||||
|
@ -20,7 +20,7 @@ PYSIDE6_NOT_INSTALLED = importlib.util.find_spec("PySide6") is None
|
||||
"names",
|
||||
list(
|
||||
chain.from_iterable(
|
||||
combinations(("manim", "manimlib", "PyQt6", "PySide6"), r=r)
|
||||
combinations(("manim", "manimlib", "pyqt6", "pyside6"), r=r)
|
||||
for r in range(0, 5)
|
||||
)
|
||||
),
|
||||
|
@ -67,7 +67,7 @@ def test_convert(slides_folder: Path, extension: str) -> None:
|
||||
|
||||
@pytest.mark.parametrize(("extension",), [("html",)])
|
||||
def test_convert_data_uri_deprecated(slides_folder: Path, extension: str) -> None:
|
||||
runner = CliRunner(mix_stderr=False)
|
||||
runner = CliRunner()
|
||||
|
||||
with runner.isolated_filesystem():
|
||||
with warnings.catch_warnings(record=True) as w:
|
||||
|
@ -27,7 +27,11 @@ def assert_import(
|
||||
|
||||
@skip_if_py39
|
||||
def test_force_api() -> None:
|
||||
# Manimlib parses sys.argv on import, so we clear it temporarily.
|
||||
old_argv = sys.argv
|
||||
sys.argv = [__file__]
|
||||
pytest.importorskip("manimlib")
|
||||
sys.argv = old_argv
|
||||
import manim # noqa: F401
|
||||
|
||||
if "manimlib" in sys.modules:
|
||||
@ -62,9 +66,12 @@ def test_invalid_api() -> None:
|
||||
@skip_if_py39
|
||||
@pytest.mark.filterwarnings("ignore:assert_import")
|
||||
def test_manim_and_manimgl_imported() -> None:
|
||||
# Manimlib parses sys.argv on import, so we clear it temporarily.
|
||||
old_argv = sys.argv
|
||||
sys.argv = [__file__]
|
||||
pytest.importorskip("manimlib")
|
||||
sys.argv = old_argv
|
||||
import manim # noqa: F401
|
||||
import manimlib # noqa: F401
|
||||
|
||||
assert_import(
|
||||
api_name="manim",
|
||||
@ -88,8 +95,11 @@ def test_manim_imported() -> None:
|
||||
|
||||
@skip_if_py39
|
||||
def test_manimgl_imported() -> None:
|
||||
# Manimlib parses sys.argv on import, so we clear it temporarily.
|
||||
old_argv = sys.argv
|
||||
sys.argv = [__file__]
|
||||
pytest.importorskip("manimlib")
|
||||
import manimlib # noqa: F401
|
||||
sys.argv = old_argv
|
||||
|
||||
if "manim" in sys.modules:
|
||||
del sys.modules["manim"]
|
||||
|
@ -41,7 +41,7 @@ def test_present_unexisting_slide(args: tuple[str, ...]) -> None:
|
||||
results = runner.invoke(present, ["UnexistingSlide", *args])
|
||||
|
||||
assert results.exit_code != 0
|
||||
assert "UnexistingSlide.json does not exist" in results.stdout
|
||||
assert "UnexistingSlide.json does not exist" in results.output
|
||||
|
||||
|
||||
def test_present_full_screen(args: tuple[str, ...]) -> None:
|
||||
|
@ -113,6 +113,37 @@ def test_render_basic_slide(
|
||||
assert local_presentation_config.resolution == presentation_config.resolution
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"renderer",
|
||||
[
|
||||
"--CE",
|
||||
pytest.param(
|
||||
"--GL",
|
||||
marks=pytest.mark.skipif(
|
||||
sys.version_info < (3, 10),
|
||||
reason="See https://github.com/3b1b/manim/issues/2263.",
|
||||
),
|
||||
),
|
||||
"--CE --renderer=opengl",
|
||||
],
|
||||
ids=("CE", "GL", "CE(GL)"),
|
||||
)
|
||||
def test_render_failing_slide(
|
||||
renderer: str,
|
||||
slides_file: Path,
|
||||
manimgl_config: Path,
|
||||
) -> None:
|
||||
runner = CliRunner()
|
||||
|
||||
with runner.isolated_filesystem() as tmp_dir:
|
||||
shutil.copy(manimgl_config, tmp_dir)
|
||||
results = runner.invoke(
|
||||
render, [*renderer.split(" "), str(slides_file), "FailingSlide", "-ql"]
|
||||
)
|
||||
|
||||
assert results.exit_code != 0, results
|
||||
|
||||
|
||||
def test_clear_cache(
|
||||
slides_file: Path,
|
||||
) -> None:
|
||||
@ -219,9 +250,13 @@ def init_slide(cls: SlideType) -> Slide:
|
||||
if issubclass(cls, CESlide):
|
||||
return cls()
|
||||
elif issubclass(cls, GLSlide):
|
||||
# Manimlib parses sys.argv on import, so we clear it temporarily.
|
||||
old_argv = sys.argv
|
||||
sys.argv = [__file__]
|
||||
from manimlib.config import parse_cli
|
||||
|
||||
_args = parse_cli()
|
||||
sys.argv = old_argv
|
||||
return cls()
|
||||
|
||||
raise ValueError(f"Unsupported class {cls}")
|
||||
|
Reference in New Issue
Block a user