Back to Article
Testing Manim for example presentation
Download Notebook

Testing Manim for example presentation

Pip

Most everything in the environments will be installed with pip/poetry for convenience’s sake.

In [1]:
!pip list
Package                   Version
------------------------- ---------
anyio                     4.0.0
argon2-cffi               23.1.0
argon2-cffi-bindings      21.2.0
arrow                     1.3.0
asttokens                 2.4.1
async-lru                 2.0.4
attrs                     23.1.0
Babel                     2.13.1
backcall                  0.2.0
beautifulsoup4            4.12.2
bleach                    6.1.0
certifi                   2023.7.22
cffi                      1.16.0
charset-normalizer        3.3.1
click                     8.1.7
click-default-group       1.2.4
cloup                     0.13.1
comm                      0.1.4
debugpy                   1.8.0
decorator                 5.1.1
defusedxml                0.7.1
executing                 2.0.1
fastjsonschema            2.18.1
fqdn                      1.5.1
glcontext                 2.5.0
idna                      3.4
importlib-metadata        6.8.0
ipykernel                 6.26.0
ipython                   8.16.1
isoduration               20.11.0
isosurfaces               0.1.0
jedi                      0.19.1
Jinja2                    3.1.2
json5                     0.9.14
jsonpointer               2.4
jsonschema                4.19.1
jsonschema-specifications 2023.7.1
jupyter_client            8.5.0
jupyter_core              5.4.0
jupyter-events            0.8.0
jupyter-lsp               2.2.0
jupyter_server            2.9.1
jupyter_server_terminals  0.4.4
jupyterlab                4.0.7
jupyterlab-pygments       0.2.2
jupyterlab_server         2.25.0
manim                     0.17.3
manim-revealjs            1.0.2
ManimPango                0.5.0
mapbox-earcut             1.0.1
markdown-it-py            3.0.0
MarkupSafe                2.1.3
matplotlib-inline         0.1.6
mdurl                     0.1.2
mistune                   3.0.2
moderngl                  5.8.2
moderngl-window           2.4.4
multipledispatch          1.0.0
nbclient                  0.8.0
nbconvert                 7.9.2
nbformat                  5.9.2
nest-asyncio              1.5.8
networkx                  2.8.8
notebook_shim             0.2.3
numpy                     1.26.1
overrides                 7.4.0
packaging                 23.2
pandocfilters             1.5.0
parso                     0.8.3
pexpect                   4.8.0
pickleshare               0.7.5
Pillow                    9.5.0
pip                       23.3.1
platformdirs              3.11.0
prometheus-client         0.17.1
prompt-toolkit            3.0.39
psutil                    5.9.6
ptyprocess                0.7.0
pure-eval                 0.2.2
pycairo                   1.25.1
pycparser                 2.21
pydub                     0.25.1
pyglet                    2.0.9
Pygments                  2.16.1
pyrr                      0.10.3
python-dateutil           2.8.2
python-json-logger        2.0.7
PyYAML                    6.0.1
pyzmq                     25.1.1
referencing               0.30.2
requests                  2.31.0
rfc3339-validator         0.1.4
rfc3986-validator         0.1.1
rich                      13.6.0
rpds-py                   0.10.6
scipy                     1.11.3
screeninfo                0.8.1
Send2Trash                1.8.2
setuptools                68.2.2
six                       1.16.0
skia-pathops              0.7.4
sniffio                   1.3.0
soupsieve                 2.5
srt                       3.5.3
stack-data                0.6.3
svgelements               1.9.6
terminado                 0.17.1
tinycss2                  1.2.1
tornado                   6.3.3
tqdm                      4.66.1
traitlets                 5.12.0
types-python-dateutil     2.8.19.14
typing_extensions         4.8.0
uri-template              1.3.0
urllib3                   2.0.7
watchdog                  2.3.1
watermark                 2.4.3
wcwidth                   0.2.8
webcolors                 1.13
webencodings              0.5.1
websocket-client          1.6.4
wheel                     0.41.2
zipp                      3.17.0

Poetry:

Pip and poetry should show the same things by virtue of poetry environments just being pipenvs under the hood:

In [3]:
!poetry config --list
In [4]:
!poetry env list
In [5]:
!poetry show

I didn’t do this programmatically, but it seems clear that poetry and pip are on the same page, but poetry gives more detailed information.

Container specifics

In [8]:
!cat /proc/cpuinfo
In [9]:
!cat /etc/os-release
In [10]:
!apt list

Watermark

This is a helpful tool in summarising Python environment from what might have been missed in previous output.

TODO: Use options from watermark…

In [12]:
%load_ext watermark
In [13]:
%watermark

Manim

Now that manim is installed, let’s try and configure a test video for our extension.

https://github.com/RickDW/manim-revealjs

In [5]:
# Need to import into Jupyter Kernel before we can call cell magic
# We could do something similar with watermark FWIW
import manim as mn
from manim_revealjs import PresentationScene, COMPLETE_LOOP
Manim Community v0.17.3

In [6]:
%%manim -qm -v WARNING DemoScene

mn.config.video_dir= "./videos"

class DemoScene(PresentationScene):
    def construct(self):
        # TODO find out why end_fragment has the t parameter
        rect = mn.Rectangle(fill_color=mn.BLUE, fill_opacity=1)
        self.play(mn.Create(rect))
        self.end_fragment()

        self.play(rect.animate.shift(mn.UP).rotate(mn.PI / 3))
        self.end_fragment(fragment_type=COMPLETE_LOOP)

        self.play(rect.animate.shift(3*mn.LEFT))
        self.end_fragment()
                                                                                         
In [7]:
%manim --help
Usage: manim [OPTIONS] COMMAND [ARGS]...

  Animation engine for explanatory math videos.

Options:
  --version  Show version and exit.
  --help     Show this message and exit.

Commands:
  cfg          Manages Manim configuration files.
  checkhealth  This subcommand checks whether Manim is installed correctly...
  init         Create a new project or insert a new scene.
  new          (Deprecated) Create a new project or insert a new scene.
  plugins      Manages Manim plugins.
  render       Render SCENE(S) from the input FILE.

See 'manim <command>' to read about a specific subcommand.

Note: the subcommand 'manim render' is called if no other subcommand is
specified. Run 'manim render --help' if you would like to know what the '-ql' or
'-p' flags do, for example.

Made with <3 by Manim Community developers.