Integrates manim (animation engine for explanatory math videos) with Jupyter displaying the resulting video when using %%manim cell magic to wrap a scene definition.
Quick preview
The code in the example above comes from the excellent manim tutorial.
Run a live demo in your browser by clicking here.
Installation
pip3 install jupyter-manim
Usage
To enable the manim magic please run import jupyter_manim first. Then, you can use the magic as if it was the manim command: your arguments will be passed to manim, exactly as if these were command line options.
For example, to render scene defined with class Shapes(Scene) use
%%manim Shapes
from manimlib.scene.scene import Scene
from manimlib.mobject.geometry import Circle
from manimlib.animation.creation import ShowCreation
class Shapes(Scene):
def construct(self):
circle = Circle()
self.play(ShowCreation(circle))
Since version 1.0, the code is no longer required to be self-contained - jupyter_manim will attempt to export your variables (and imported objects) from the notebook into the manim script.
Most variables can be easily exported, however there are limitations; in short everything which can be pickled can be exported. Additionally, variables whose names start with an underscore will be ommited.
To display manim help and options use:
%%manim -h pass
The %%manim magic (by default) hides the progress bars as well as other logging messages generated by manim. You can disable this behaviour using --verbose flag
In the latest version of manimlib you can import everything at once using:
from manimlib.imports import *
Video player control options
--no-controls - hides the controls
--no-autoplay - disables the autoplay feature
-r or --resolution - control the height and width of the video player; this option is shared with manim and requires the resolution in following format: height,width, e.g. %%manim Shapes -r 200,1000
--base64 send the video with a data: URL instead of a local path - useful for remote notebooks like Google Colab, or to embed the video in notebook (note: the notebook size may increase rapidly)
Compatibility and testing
This package is continuously tested with Python 3.7 on Ubuntu, Mac OS an Windows.
Tests have to be run with ipython, as the magic relies on IPython instance being available:
python3 setup.py install
ipython -m pytest -- --cov=.
Metadata
Release files for jupyter-manim 1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| jupyter_manim-1.3.tar.gz | 6.5 kB | Details |
Release files / jupyter_manim-1.3.tar.gz
| Download URL | jupyter_manim-1.3.tar.gz |
|---|---|
| Size | 6.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a2613d28d2c7e66e13c1b876b5868907290a48a422048c77b5e0e496178e0d85
|
|
BLAKE2b-256 checksum How to use checksums |
24f9344ff17d9c3f8f63b713da5c5101aadc93f90d120d5b1049340fc3dbae26
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.5
|