• Stars
    star
    187
  • Rank 206,464 (Top 5 %)
  • Language
    Python
  • License
    MIT License
  • Created over 5 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

manim cell magic for IPython/Jupyter to show the output video

jupyter-manim

Build Status codecov MIT License Binder Colab

Integrates 3b1b's ManimCairo (cairo-backend branch) with Jupyter displaying the resulting video when using %%manim cell magic to wrap a scene definition.

WARNING: This library only works for ManimCairo (the cairo-backend branch in 3b1b's version). It does not work for ManimCE (which already has Jupyter support by default) or ManimGL (which does not support Jupyter at all, as of time of writing).

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=.

More Repositories

1

complex-upset

A library for creating complex UpSet plots with ggplot2 geoms
R
353
star
2

jupyterlab-go-to-definition

Navigate to variable's definition with a click in JupyterLab (or with a few key strokes)
TypeScript
214
star
3

Anki-Night-Mode

Enabling studying at night with Anki - without eye strain
Python
72
star
4

jupyterlab-citation-manager

Citation Manager for JupyterLab using Zotero Web API
TypeScript
47
star
5

jupyter-helpers

A collection of helpers for Jupyter/IPython
Python
45
star
6

easy-entrez

Retrieve PubMed articles, text-mining annotations, or molecular data from >35 Entrez databases via easy to use Python package - built on top of Entrez E-utilities API.
Python
45
star
7

declarative-parser

Modern, declarative argument parser for Python 3.6+
Python
34
star
8

multi-omics-state-of-the-field

Analyses for "State of the field in multi-omics research: from computational needs to data mining and sharing"
Jupyter Notebook
24
star
9

Anki-TouchScreen

Touchscreen functionality for Anki
Python
22
star
10

nbpipeline

Snakemake-like pipeline manager for reproducible Jupyter Notebooks
Python
15
star
11

drug-disease-profile-matching

Multi-omics disease sub-type specific drug repositioning aided with expression signatures from ConnectivityMap
Jupyter Notebook
14
star
12

data-vault

IPython magic for simple, organized, compressed and encrypted: storage & transfer of files between notebooks.
Python
12
star
13

computational-notebooks-for-biomedical-research

NGSeminar on the use of Jupyter and R notebooks in biomedical research
Jupyter Notebook
11
star
14

anki_testing

A small utility for testing Anki 2.1 addons
Python
10
star
15

jupyterlab-dagitty

JupyterLab renderer of dagitty causal diagrams
TypeScript
10
star
16

gsea-api

Pandas API for multiple Gene Set Enrichment Analysis implementations in Python (GSEApy, cudaGSEA, GSEA)
Python
8
star
17

rpy2-complex-heatmap-grammar

Python heatmap interface using intuitive grammar of graphics, implemented as an rpy2 wrapper around ComplexHeatmap package.
Python
8
star
18

Anki-Zoom

Zoom add-on for Anki 2.1, forked from ospalh/anki-addons
Python
6
star
19

enhanced-multiprocessing

A wrapper around Python's multiprocessing, providing support for tqdm progress bars and shared arguments
Python
3
star
20

plotnine3d

3D geoms for plotnine (grammar of graphics in Python)
Python
3
star
21

jupyterlab-citation-data

Citation data for jupyterlab-citation-manager
Python
2
star
22

jupyterlab-voice-control

Voice control over JupyterLab and Jupyter notebooks
TypeScript
2
star
23

vmd-agr-parser

Simple script for plotting .agr (Grace) files created with VMD (Visual Molecular Dynamics). Allows export to csv/svg/png.
Python
1
star