Skip to content

Commit

Permalink
Merge branch 'main' into Arrow-3D-put-start-and-end
Browse files Browse the repository at this point in the history
  • Loading branch information
SirJamesClarkMaxwell authored May 16, 2024
2 parents 13e31c2 + 203a536 commit 85941b4
Show file tree
Hide file tree
Showing 93 changed files with 2,130 additions and 1,598 deletions.
9 changes: 0 additions & 9 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,5 @@ PASTE HERE
<!-- output of `tlmgr list --only-installed` for TeX Live or a screenshot of the Packages page for MikTeX -->
</details>

<details><summary>FFMPEG</summary>

Output of `ffmpeg -version`:

```
PASTE HERE
```
</details>

## Additional comments
<!-- Add further context that you think might be relevant for this issue here. -->
9 changes: 0 additions & 9 deletions .github/ISSUE_TEMPLATE/installation_issue.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,5 @@ PASTE HERE
<!-- output of `tlmgr list --only-installed` for TeX Live or a screenshot of the Packages page for MikTeX -->
</details>

<details><summary>FFMPEG</summary>

Output of `ffmpeg -version`:

```
PASTE HERE
```
</details>

## Additional comments
<!-- Add further context that you think might be relevant for this issue here. -->
6 changes: 0 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,6 @@ jobs:
run: |
echo "date=$(/bin/date -u "+%m%w%Y")" >> $GITHUB_OUTPUT
- name: Install and cache ffmpeg (all OS)
uses: FedericoCarboni/setup-ffmpeg@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
id: setup-ffmpeg

- name: Install system dependencies (Linux)
if: runner.os == 'Linux'
uses: awalsh128/cache-apt-pkgs-action@latest
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-publish-documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Install system dependencies
run: |
sudo apt update && sudo apt install -y \
pkg-config libcairo-dev libpango1.0-dev ffmpeg wget fonts-roboto
pkg-config libcairo-dev libpango1.0-dev wget fonts-roboto
wget -qO- "https://yihui.org/tinytex/install-bin-unix.sh" | sh
echo ${HOME}/.TinyTeX/bin/x86_64-linux >> $GITHUB_PATH
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ repos:
hooks:
- id: pyupgrade
name: Update code to new python versions
args: [--py37-plus]
args: [--py39-plus]
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
Expand Down
1 change: 0 additions & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ build:

apt_packages:
- libpango1.0-dev
- ffmpeg
- graphviz

python:
Expand Down
1 change: 0 additions & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ FROM python:3.11-slim

RUN apt-get update -qq \
&& apt-get install --no-install-recommends -y \
ffmpeg \
build-essential \
gcc \
cmake \
Expand Down
4 changes: 2 additions & 2 deletions docs/source/contributing/development.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ For first-time contributors
#. Install Manim:

- Follow the steps in our :doc:`installation instructions
<../installation>` to install **Manim's dependencies**,
primarily ``ffmpeg`` and ``LaTeX``.
<../installation>` to install **Manim's system dependencies**.
We also recommend installing a LaTeX distribution.

- We recommend using `Poetry <https://python-poetry.org>`__ to manage your
developer installation of Manim. Poetry is a tool for dependency
Expand Down
18 changes: 9 additions & 9 deletions docs/source/guides/deep_dive.rst
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ The scene then asks its renderer to initialize the scene by calling

Inspecting both the default Cairo renderer and the OpenGL renderer shows that the ``init_scene``
method effectively makes the renderer instantiate a :class:`.SceneFileWriter` object, which
basically is Manim's interface to ``ffmpeg`` and actually writes the movie file. The Cairo
basically is Manim's interface to ``libav`` (FFMPEG) and actually writes the movie file. The Cairo
renderer (see the implementation `here <https://github.com/ManimCommunity/manim/blob/main/manim/renderer/cairo_renderer.py>`__) does not require any further initialization. The OpenGL renderer
does some additional setup to enable the realtime rendering preview window, which we do not go
into detail further here.
Expand Down Expand Up @@ -310,8 +310,8 @@ the order they are called, these customizable methods are:
After these three methods are run, the animations have been fully rendered,
and Manim calls :meth:`.CairoRenderer.scene_finished` to gracefully
complete the rendering process. This checks whether any animations have been
played -- and if so, it tells the :class:`.SceneFileWriter` to close the pipe
to ``ffmpeg``. If not, Manim assumes that a static image should be output
played -- and if so, it tells the :class:`.SceneFileWriter` to close the output
file. If not, Manim assumes that a static image should be output
which it then renders using the same strategy by calling the render loop
(see below) once.

Expand Down Expand Up @@ -762,10 +762,10 @@ to learn more, the :func:`.get_hash_from_play_call` function in the
mechanism.

In the event that the animation has to be rendered, the renderer asks
its :class:`.SceneFileWriter` to start a writing process. The process
is started by a call to ``ffmpeg`` and opens a pipe to which rendered
raw frames can be written. As long as the pipe is open, the process
can be accessed via the ``writing_process`` attribute of the file writer.
its :class:`.SceneFileWriter` to open an output container. The process
is started by a call to ``libav`` and opens a container to which rendered
raw frames can be written. As long as the output is open, the container
can be accessed via the ``output_container`` attribute of the file writer.
With the writing process in place, the renderer then asks the scene
to "begin" the animations.

Expand Down Expand Up @@ -815,7 +815,7 @@ time is extracted (3 seconds long) and stored in
skip (it should not), then whether the animation is already
cached (it is not). The corresponding animation hash value is
determined and passed to the file writer, which then also calls
``ffmpeg`` to start the writing process which waits for rendered
``libav`` to start the writing process which waits for rendered
frames from the library.

The scene then ``begin``\ s the animation: for the
Expand Down Expand Up @@ -1001,7 +1001,7 @@ and :meth:`.Animation.clean_up_from_scene` methods are called.
In the end, the time progression is closed (which completes the displayed progress bar)
in the terminal. With the closing of the time progression, the
:meth:`.Scene.play_internal` call is completed, and we return to the renderer,
which now orders the :class:`.SceneFileWriter` to close the movie pipe that has
which now orders the :class:`.SceneFileWriter` to close the output container that has
been opened for this animation: a partial movie file is written.

This pretty much concludes the walkthrough of a :class:`.Scene.play` call,
Expand Down
5 changes: 2 additions & 3 deletions docs/source/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ Installing Manim via Conda and related environment managers
Conda is a package manager for Python that allows creating environments
where all your dependencies are stored. Like this, you don't clutter up your PC with
unwanted libraries and you can just delete the environment when you don't need it anymore.
It is a good way to install manim since all dependencies like
``ffmpeg``, ``pycairo``, etc. come with it.
It is a good way to install manim since all dependencies like ``pycairo``, etc. come with it.
Also, the installation steps are the same, no matter if you are
on Windows, Linux, Intel Macs or on Apple Silicon.

Expand Down Expand Up @@ -69,7 +68,7 @@ in order for Manim to work properly, some additional system
dependencies need to be installed first. The following pages have
operating system specific instructions for you to follow.

Manim requires Python version ``3.8`` or above to run.
Manim requires Python version ``3.9`` or above to run.

.. hint::

Expand Down
2 changes: 1 addition & 1 deletion docs/source/installation/jupyter.rst
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ then execute it.
.. code-block::
!sudo apt update
!sudo apt install libcairo2-dev ffmpeg \
!sudo apt install libcairo2-dev \
texlive texlive-latex-extra texlive-fonts-extra \
texlive-latex-recommended texlive-science \
tipa libpango1.0-dev
Expand Down
19 changes: 5 additions & 14 deletions docs/source/installation/linux.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ The installation instructions depend on your particular operating
system and package manager. If you happen to know exactly what you are doing,
you can also simply ensure that your system has:

- a reasonably recent version of Python 3 (3.8 or above),
- a reasonably recent version of Python 3 (3.9 or above),
- with working Cairo bindings in the form of
`pycairo <https://cairographics.org/pycairo/>`__,
- FFmpeg accessible from the command line as ``ffmpeg``,
- and `Pango <https://pango.gnome.org>`__ headers.

Then, installing Manim is just a matter of running:
Expand All @@ -33,13 +32,13 @@ Required Dependencies
apt – Ubuntu / Mint / Debian
****************************

To first update your sources, and then install Cairo, Pango, and FFmpeg
To first update your sources, and then install Cairo and Pango
simply run:

.. code-block:: bash
sudo apt update
sudo apt install build-essential python3-dev libcairo2-dev libpango1.0-dev ffmpeg
sudo apt install build-essential python3-dev libcairo2-dev libpango1.0-dev
If you don't have python3-pip installed, install it via:

Expand Down Expand Up @@ -72,14 +71,6 @@ need the Python development headers:
sudo dnf install python3-devel
FFmpeg is only available via the RPMfusion repository which you have to
configure first – please consult https://rpmfusion.org/Configuration/ for
instructions. Then, install FFmpeg:

.. code-block:: bash
sudo dnf install ffmpeg
At this point you have all required dependencies and can install
Manim by running:

Expand All @@ -100,12 +91,12 @@ pacman – Arch / Manjaro

If you don't want to use the packaged version from AUR, here is what
you need to do manually: Update your package sources, then install
Cairo, Pango, and FFmpeg:
Cairo and Pango:

.. code-block:: bash
sudo pacman -Syu
sudo pacman -S cairo pango ffmpeg
sudo pacman -S cairo pango
If you don't have ``python-pip`` installed, get it by running:

Expand Down
4 changes: 2 additions & 2 deletions docs/source/installation/macos.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ follow `Homebrew's installation instructions <https://docs.brew.sh/Installation>
Required Dependencies
---------------------

To install all required dependencies for installing Manim (namely: ffmpeg, Python,
To install all required dependencies for installing Manim (namely: Python,
and some required Python packages), run:

.. code-block:: bash
brew install py3cairo ffmpeg
brew install py3cairo
On *Apple Silicon* based machines (i.e., devices with the M1 chip or similar; if
you are unsure which processor you have check by opening the Apple menu, select
Expand Down
86 changes: 11 additions & 75 deletions docs/source/installation/windows.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@ Windows

The easiest way of installing Manim and its dependencies is by using a
package manager like `Chocolatey <https://chocolatey.org/>`__
or `Scoop <https://scoop.sh>`__. If you are not afraid of editing
your System's ``PATH``, a manual installation is also possible.
In fact, if you already have an existing Python
installation (3.8 or above), it might be the easiest way to get
everything up and running.
or `Scoop <https://scoop.sh>`__, especially if you need optional dependencies
like LaTeX support.

If you choose to use one of the package managers, please follow
their installation instructions
Expand All @@ -19,7 +16,7 @@ to make one of them available on your system.
Required Dependencies
---------------------

Manim requires a recent version of Python (3.8 or above) and ``ffmpeg``
Manim requires a recent version of Python (3.9 or above)
in order to work.

Chocolatey
Expand All @@ -34,53 +31,11 @@ Manim can be installed via Chocolatey simply by running:
That's it, no further steps required. You can continue with installing
the :ref:`optional dependencies <win-optional-dependencies>` below.

Scoop
*****

While there is no recipe for installing Manim with Scoop directly,
you can install all requirements by running:

.. code-block:: powershell
scoop install python ffmpeg
and then Manim can be installed by running:

.. code-block:: powershell
python -m pip install manim
Manim should now be installed on your system. Continue reading
the :ref:`optional dependencies <win-optional-dependencies>` section
below.

Winget
******

While there is no recipe for installing Manim with Winget directly,
you can install all requirements by running:

.. code-block:: powershell
winget install python
winget install ffmpeg
and then Manim can be installed by running:

.. code-block:: powershell
python -m pip install manim
Manim should now be installed on your system. Continue reading
the :ref:`optional dependencies <win-optional-dependencies>` section
below.


Manual Installation
*******************
Pip
***

As mentioned above, Manim needs a reasonably recent version of
Python 3 (3.8 or above) and FFmpeg.
Python 3 (3.9 or above).

**Python:** Head over to https://www.python.org, download an installer
for a recent version of Python, and follow its instructions to get Python
Expand All @@ -94,35 +49,16 @@ installed on your system.
install Python directly from the
`official website <https://www.python.org>`__.

**FFmpeg:** In order to install FFmpeg, you can get a
pre-compiled and ready-to-use version from one of the resources
linked at https://ffmpeg.org/download.html#build-windows, such as
`the version available here
<https://www.gyan.dev/ffmpeg/builds/ffmpeg-release-essentials.7z>`__
(recommended), or if you know exactly what you are doing
you can alternatively get the source code
from https://ffmpeg.org/download.html and compile it yourself.


After downloading the pre-compiled archive,
`unzip it <https://www.7-zip.org>`__ and, if you like, move the
extracted directory to some more permanent place (e.g.,
``C:\Program Files\``). Next, edit the ``PATH`` environment variable:
first, visit ``Control Panel`` > ``System`` > ``System settings`` >
``Environment Variables``, then add the full path to the ``bin``
directory inside of the (moved) ffmpeg directory to the
``PATH`` variable. Finally, save your changes and exit.

If you now open a new command line prompt (or PowerShell) and
run ``ffmpeg``, the command should be recognized.

At this point, you have all the required dependencies and can now
install Manim via
Then, Manim can be installed via Pip simply by running:

.. code-block:: powershell
python -m pip install manim
Manim should now be installed on your system. Continue reading
the :ref:`optional dependencies <win-optional-dependencies>` section
below.


.. _win-optional-dependencies:

Expand Down
3 changes: 2 additions & 1 deletion manim/_config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
from __future__ import annotations

import logging
from collections.abc import Generator
from contextlib import contextmanager
from typing import Any, Generator
from typing import Any

from .cli_colors import parse_cli_ctx
from .logger_utils import make_logger
Expand Down
2 changes: 0 additions & 2 deletions manim/_config/default.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,6 @@ repr_number = green
# Uncomment the following line to manually set the loglevel for ffmpeg. See
# ffmpeg manpage for accepted values
loglevel = ERROR
# defaults to the one present in path
ffmpeg_executable = ffmpeg

[jupyter]
media_embed = False
Expand Down
4 changes: 4 additions & 0 deletions manim/_config/logger_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ def make_logger(
logger.addHandler(rich_handler)
logger.setLevel(verbosity)

if not (libav_logger := logging.getLogger()).hasHandlers():
libav_logger.addHandler(rich_handler)
libav_logger.setLevel(verbosity)

return logger, console, error_console


Expand Down
Loading

0 comments on commit 85941b4

Please sign in to comment.