From 3dcfa1bc09e6163aff8aaf01b294bf597334d19a Mon Sep 17 00:00:00 2001 From: Benjamin Hackl Date: Thu, 28 Jan 2021 20:25:21 +0100 Subject: [PATCH 1/8] fix import: move setting __version__ to top of __init__ --- manim/__init__.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/manim/__init__.py b/manim/__init__.py index f9badcf480..02dca98d00 100644 --- a/manim/__init__.py +++ b/manim/__init__.py @@ -1,5 +1,13 @@ #!/usr/bin/env python +try: + import importlib.metadata as importlib_metadata +except ModuleNotFoundError: + import importlib_metadata + +__version__ = importlib_metadata.version(__name__) + + # Importing the config module should be the first thing we do, since other # modules depend on the global config dict for initialization. from ._config import * @@ -100,10 +108,3 @@ ipy.register_magics(ManimMagic) from .plugins import * - -try: - import importlib.metadata as importlib_metadata -except ModuleNotFoundError: - import importlib_metadata - -__version__ = importlib_metadata.version(__name__) From 05251fcd9aaec4f944f03b1cb7c6b5d7b1f6a5c8 Mon Sep 17 00:00:00 2001 From: Benjamin Hackl Date: Thu, 28 Jan 2021 20:26:08 +0100 Subject: [PATCH 2/8] add simple Dockerfile for a manim-jupyterlab container --- docker/Dockerfile.jupyter | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 docker/Dockerfile.jupyter diff --git a/docker/Dockerfile.jupyter b/docker/Dockerfile.jupyter new file mode 100644 index 0000000000..106c01cd94 --- /dev/null +++ b/docker/Dockerfile.jupyter @@ -0,0 +1,6 @@ +FROM manimcommunity/manim:latest + +RUN pip install jupyterlab + +EXPOSE 8888 +CMD [ "jupyter", "lab", "--allow-root", "--ip=0.0.0.0" ] \ No newline at end of file From d382290088d25330b0646492cb5a8215ad8d592f Mon Sep 17 00:00:00 2001 From: Benjamin Hackl Date: Thu, 28 Jan 2021 20:30:28 +0100 Subject: [PATCH 3/8] add section on jupyterlab in docker/readme.md --- docker/readme.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docker/readme.md b/docker/readme.md index 68f8d182f9..a9c2be1b44 100644 --- a/docker/readme.md +++ b/docker/readme.md @@ -35,6 +35,15 @@ Then, to render a scene `CircleToSquare` in a file `test_scenes.py`, call $ docker exec -it --user="$(id -u):$(id -g)" my-manim-container manim test.py CircleToSquare -qm ``` +## Jupyterlab +Another alternative is to use the `manimcommunity/manim:jupyterlab` image, which spins up a local webserver running +JupyterLab in whose Python kernel manim is installed and can be accessed via the `%%manim` cell magic. To use this container, +run +``` +$ docker run -it -p 8888:88888 manimcommunity/manim:jupyterlab +``` +and then follow the instructions in the terminal. + # Important notes When executing `manim` within a Docker container, several command line flags (in particular `-p` (preview file) and `-f` (show output file in the file browser)) are not supported. From af1c01a6cf205a0e14b2ad9913516958050f2284 Mon Sep 17 00:00:00 2001 From: Benjamin Hackl Date: Fri, 29 Jan 2021 22:11:35 +0100 Subject: [PATCH 4/8] improve Dockerfile: separate user, install manim with all extras, upgrade to python 3.8 --- docker/Dockerfile | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 0d9d81c1fb..b2ad80c203 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.7-slim +FROM python:3.8-slim RUN apt-get update -qq \ && apt-get install --no-install-recommends -y \ @@ -24,10 +24,26 @@ RUN wget -O /tmp/install-tl-unx.tar.gz http://mirror.ctan.org/systems/texlive/tl # clone and build manim COPY . /opt/manim WORKDIR /opt/manim -RUN pip install --no-cache . +RUN pip install --no-cache .[jupyterlab,webgl_renderer] +# required due to current incompatibility from latest jedi version +RUN pip install jedi==0.17.2 + +ARG NB_USER=manimuser +ARG NB_UID=1000 +ENV USER ${NB_USER} +ENV NB_UID ${NB_UID} +ENV HOME /manim + +RUN adduser --disabled-password \ + --gecos "Default user" \ + --uid ${NB_UID} \ + ${NB_USER} # create working directory for user to mount local directory into -WORKDIR /manim -RUN chmod 666 /manim +WORKDIR ${HOME} +USER root +RUN chown -R ${NB_USER}:${NB_USER} ${HOME} +RUN chmod 777 ${HOME} +USER ${NB_USER} CMD [ "/bin/bash" ] From b92d4f06511b2bcf95e396afcf4d24327417ba32 Mon Sep 17 00:00:00 2001 From: Benjamin Hackl Date: Fri, 29 Jan 2021 22:14:18 +0100 Subject: [PATCH 5/8] remove separate jupyterlab docker image, adapt readme --- docker/Dockerfile.jupyter | 6 ------ docker/readme.md | 8 ++++---- 2 files changed, 4 insertions(+), 10 deletions(-) delete mode 100644 docker/Dockerfile.jupyter diff --git a/docker/Dockerfile.jupyter b/docker/Dockerfile.jupyter deleted file mode 100644 index 106c01cd94..0000000000 --- a/docker/Dockerfile.jupyter +++ /dev/null @@ -1,6 +0,0 @@ -FROM manimcommunity/manim:latest - -RUN pip install jupyterlab - -EXPOSE 8888 -CMD [ "jupyter", "lab", "--allow-root", "--ip=0.0.0.0" ] \ No newline at end of file diff --git a/docker/readme.md b/docker/readme.md index a9c2be1b44..4931a630bb 100644 --- a/docker/readme.md +++ b/docker/readme.md @@ -36,11 +36,11 @@ $ docker exec -it --user="$(id -u):$(id -g)" my-manim-container manim test.py Ci ``` ## Jupyterlab -Another alternative is to use the `manimcommunity/manim:jupyterlab` image, which spins up a local webserver running -JupyterLab in whose Python kernel manim is installed and can be accessed via the `%%manim` cell magic. To use this container, -run +Another alternative is to use the docker image to spin up a local webserver running +JupyterLab in whose Python kernel manim is installed and can be accessed via the `%%manim` cell magic. +To use JupyterLab, run ``` -$ docker run -it -p 8888:88888 manimcommunity/manim:jupyterlab +$ docker run -it -p 8888:8888 manimcommunity/manim jupyter lab --ip=0.0.0.0 ``` and then follow the instructions in the terminal. From e18ba493f89eef39130b9d9dd5703d5104726b51 Mon Sep 17 00:00:00 2001 From: Benjamin Hackl Date: Fri, 29 Jan 2021 22:36:49 +0100 Subject: [PATCH 6/8] add missing latex package --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index b2ad80c203..2c38a54174 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -17,7 +17,7 @@ RUN wget -O /tmp/install-tl-unx.tar.gz http://mirror.ctan.org/systems/texlive/tl tar -xzf /tmp/install-tl-unx.tar.gz -C /tmp/install-tl --strip-components=1 && \ /tmp/install-tl/install-tl --profile=/tmp/texlive-profile.txt \ && tlmgr install \ - amsmath babel-english cm-super doublestroke dvisvgm fundus-calligra \ + amsmath babel-english cm-super doublestroke dvisvgm everysel fundus-calligra \ jknapltx latex-bin microtype ms physics preview ragged2e relsize rsfs \ setspace standalone tipa wasy wasysym xcolor xkeyval From 44bf553d0fa3fc3c00ca831f0a0126a753f804d7 Mon Sep 17 00:00:00 2001 From: Benjamin Hackl Date: Sat, 30 Jan 2021 12:29:23 +0100 Subject: [PATCH 7/8] include link to interactive worksheet in documentation --- README.md | 11 +++++++++-- docs/source/examples.rst | 4 ++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3e6ad96e85..5ac5aa4a40 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ Docker image Downloads CI +

An animation engine for explanatory math videos @@ -34,7 +35,12 @@ Manim is an animation engine for explanatory math videos. It's used to create pr ## Installation -Manim requires a few dependencies that must be installed prior to using it. Please visit the [Documentation](https://docs.manim.community/en/latest/installation.html) and follow the appropriate instructions for your operating system. +Manim requires a few dependencies that must be installed prior to using it. If you +want to try it out first before installing it locally, you can do so +[in our online Jupyter environment](https://mybinder.org/v2/gist/behackl/725d956ec80969226b7bf9b4aef40b78/HEAD?filepath=basic%20example%20scenes.ipynb). + +For the local installation, please visit the [Documentation](https://docs.manim.community/en/latest/installation.html) +and follow the appropriate instructions for your operating system. Once the dependencies have been installed, run the following in a terminal window: @@ -73,7 +79,8 @@ You should see your native video player program pop up and play a simple scene i [GitHub repository](master/example_scenes). You can also visit the [official gallery](https://docs.manim.community/en/latest/examples.html) for more advanced examples. Manim also ships with a `%%manim` IPython magic which allows to use it conveniently in JupyterLab (as well as classic Jupyter) notebooks. See the -[corresponding documentation](https://docs.manim.community/en/latest/reference/manim.utils.ipython_magic.ManimMagic.html) for some guidance. +[corresponding documentation](https://docs.manim.community/en/latest/reference/manim.utils.ipython_magic.ManimMagic.html) for some guidance and +[try it out online](https://mybinder.org/v2/gist/behackl/725d956ec80969226b7bf9b4aef40b78/HEAD?filepath=basic%20example%20scenes.ipynb). ## Command line arguments diff --git a/docs/source/examples.rst b/docs/source/examples.rst index aa43200bb6..762d670627 100644 --- a/docs/source/examples.rst +++ b/docs/source/examples.rst @@ -16,6 +16,10 @@ Enjoy this taste of Manim! the modules :mod:`~.tex_mobject`, :mod:`~.geometry`, :mod:`~.moving_camera_scene`, and many more. + Check out our `interactive Jupyter environment `_ + which allows running the examples online, without requiring a local + installation. + Also, visit our `Twitter `_ for more *manimations*! From 6fe83587e160c9bf23aafeb1168f904bc3edbf05 Mon Sep 17 00:00:00 2001 From: kolibril13 <44469195+kolibril13@users.noreply.github.com> Date: Sat, 30 Jan 2021 17:20:43 +0100 Subject: [PATCH 8/8] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5ac5aa4a40..b98179475c 100644 --- a/README.md +++ b/README.md @@ -3,16 +3,16 @@

PyPI Latest Release + Docker image + MIT License Reddit Twitter Discord Code style: black Documentation Status - Docker image Downloads CI -

An animation engine for explanatory math videos