mirror of
https://github.com/ManimCommunity/manim.git
synced 2026-06-22 10:01:47 +00:00
* Added click dependency and command structure * Refactored code for separation of concerns * Shortened plugins command to plugin, added render options * first draft for render -h * First successful render using click * Cleaned main * Moved flush_cache to option, ran black * Removed argparse logic, scattered print statements * corrected tests, all passing * merge upstream * fixed test with click's clirunner * Fixed doctest configuration.rst * Temporarily add in main_utils * Removed main_utils.parse_args, used ManimConfig.digest_args * fixed progress bar * Fix jupyter * black * Fixed incorrectly merged merge conflict * updated README command.png image * updated configuration.rst expected output * Fixed test_plugins and config_file expected type * Refixed the jupyter fix * Apply 3/5 suggestions Remove stray print Improve readability of test code Added module docs for the subcommands * Updated `main` to `manim` for tests * Forced `file` positional argument to be Path type * Fixed main -> manim * Added libpango to linux dependency * Updated poetry.lock * Changed configuration.rst test * Fixed test_a_flag test minor space issue added media_width to configuration.rst * Fixed fps flag in Cairo rendering * Fixed more outdated rst in sphinx docs Removed default for fps option, always overwrote quality Fixed doctest control_data * Fixed more incorrect rst orderings * Update tests/test_commands.py Co-authored-by: Naveen M K <naveen@syrusdark.website> * Added suggestions * Removed unused imports * Reverted entry point back to main * Update manim/_config/default.cfg Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at> * Adjusted ipython_magic's call to the entry_point * Converted frame_rate to int if integer * run black * Fixed doctest * Fixed issue with command name from CliRunner * Fixed multiple video windows opening from upstream merge * to black or not to black * Added deprecation warning to render subcommand * warning instead of warn * Applied Naveen's suggestions * Made `manim render` show the help page * Update manim/cli/render/commands.py Co-authored-by: Naveen M K <naveen@syrusdark.website> * Update manim/cli/cfg/commands.py Co-authored-by: Naveen M K <naveen@syrusdark.website> * Update manim/cli/cfg/commands.py Co-authored-by: Naveen M K <naveen@syrusdark.website> * Update manim/cli/plugins/commands.py Co-authored-by: Naveen M K <naveen@syrusdark.website> * Addressed some style changes * add back in write_to_movie temporarily for OpenGL support * Removed sound flag, deprecated use_opengl_renderer, added renderer option * revert webgl_renderer_path removal * Fixed cfg export Fixed readme usage of CLI * Flake8/black * Fixed bug in setting renderer choice * Removed log message due to default option Removed default option of background color Fixed write_to_movie flag default * Fix log_to_file tests * Make '-c' option for config_file, not background_color * print colored version always * Remove -v = --version shorthand, conflicts with verbosity * Use subprocess.run instead of Click's CliRunner for stdout * Refactor cli/render to use Cloup instead of click-option-group 1) There's a new file for each option group 2) render is now a cloup.Command, not a Group Fixed issue when an animation is cached, manim can't merge the partial movie files. (#1192) * fixed issue * fixed tests * Update manim/renderer/cairo_renderer.py Co-authored-by: Darylgolden <darylgolden@gmail.com> * added tests * imrpoved test * fixed logic * added new test * check if the file has been outputed * added test when caching is enabled * fixed tests on windows * black * Update manim/renderer/cairo_renderer.py Co-authored-by: Naveen M K <naveen@syrusdark.website> * Update tests/assert_utils.py Co-authored-by: Naveen M K <naveen@syrusdark.website> Co-authored-by: KingWampy <9156604+WampyCakes@users.noreply.github.com> Co-authored-by: Darylgolden <darylgolden@gmail.com> Co-authored-by: Naveen M K <naveen@syrusdark.website> Added :ref_methods: to the manim directive (#1209) * fix manim_directive for methods * added ref_methods to Angle example * black * added new ref_methods references * sort out ref_functions vs ref_methods in examples.rst Co-authored-by: Jason Villanueva <a@jsonvillanueva.com> Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at> Fixed issue when an animation is cached, manim can't merge the partial movie files. (#1192) * fixed issue * fixed tests * Update manim/renderer/cairo_renderer.py Co-authored-by: Darylgolden <darylgolden@gmail.com> * added tests * imrpoved test * fixed logic * added new test * check if the file has been outputed * added test when caching is enabled * fixed tests on windows * black * Update manim/renderer/cairo_renderer.py Co-authored-by: Naveen M K <naveen@syrusdark.website> * Update tests/assert_utils.py Co-authored-by: Naveen M K <naveen@syrusdark.website> Co-authored-by: KingWampy <9156604+WampyCakes@users.noreply.github.com> Co-authored-by: Darylgolden <darylgolden@gmail.com> Co-authored-by: Naveen M K <naveen@syrusdark.website> Added :ref_methods: to the manim directive (#1209) * fix manim_directive for methods * added ref_methods to Angle example * black * added new ref_methods references * sort out ref_functions vs ref_methods in examples.rst Co-authored-by: Jason Villanueva <a@jsonvillanueva.com> Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at> Fixed unnecessary args dict * Fixed bug that changed caching hashing result * Revert doctest logic for fps filename output Co-authored-by: Naveen M K <naveen@syrusdark.website> Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at> Co-authored-by: Gianluca Gippetto <gianluca.gippetto@gmail.com>
147 lines
4.1 KiB
ReStructuredText
147 lines
4.1 KiB
ReStructuredText
.. _plugins:
|
|
|
|
=======
|
|
Plugins
|
|
=======
|
|
|
|
Plugins are features that extend Manim's core functionality. Since Manim is
|
|
extensible and not everything belongs in its core, we'll go over how to
|
|
install, use, and create your own plugins.
|
|
|
|
.. note::
|
|
|
|
The standard naming convention for plugins is to prefix the plugin with
|
|
``manim-``. This makes them easy for users to find on package
|
|
repositories such as PyPI.
|
|
|
|
.. WARNING::
|
|
|
|
The plugin feature is new and under active development. Expect updates
|
|
for the best practices on installing, using, and creating plugins; as
|
|
well as new subcommands/flags for ``manim plugins``
|
|
|
|
.. tip::
|
|
|
|
See https://plugins.manim.community/ for the list of plugins available.
|
|
|
|
Installing Plugins
|
|
******************
|
|
Plugins can be easily installed via the ``pip``
|
|
command:
|
|
|
|
.. code-block:: bash
|
|
|
|
pip install manim-*
|
|
|
|
After installing a plugin, you may use the ``manim plugins`` command to list
|
|
your available plugins, see the following help output:
|
|
|
|
.. code-block:: bash
|
|
|
|
manim plugins -h
|
|
Usage: manim plugins [OPTIONS]
|
|
|
|
Manages Manim plugins.
|
|
|
|
Options:
|
|
-l, --list List available plugins
|
|
-h, --help Show this message and exit.
|
|
|
|
Made with <3 by Manim Community developers.
|
|
|
|
You can list plugins as such:
|
|
|
|
.. code-block:: bash
|
|
|
|
manim plugins -l
|
|
Plugins:
|
|
• manim_plugintemplate
|
|
|
|
Using Plugins in Projects
|
|
*************************
|
|
For enabling a plugin ``manim.cfg`` or command line parameters should be used.
|
|
|
|
.. important::
|
|
|
|
The plugins should be module name of the plugin and not PyPi name.
|
|
|
|
Enabling plugins through ``manim.cfg``
|
|
|
|
.. code-block:: ini
|
|
|
|
[CLI]
|
|
plugins = manim_rubikscube
|
|
|
|
For specifing multiple plugins, command separated values must be used.
|
|
|
|
.. code-block:: ini
|
|
|
|
[CLI]
|
|
plugins = manim_rubikscube, manim_plugintemplate
|
|
|
|
Enabling Plugins through CLI
|
|
|
|
.. code-block:: bash
|
|
|
|
manim basic.py --plugins=manim_plugintemplate
|
|
|
|
For multiple plugins
|
|
|
|
.. code-block:: bash
|
|
|
|
manim basic.py --plugins=manim_rubikscube,manim_plugintemplate
|
|
|
|
Creating Plugins
|
|
****************
|
|
Plugins are intended to extend Manim's core functionality. If you aren't sure
|
|
whether a feature should be included in Manim's core, feel free to ask over
|
|
on the `Discord server <https://discord.gg/mMRrZQW>`_. Visit
|
|
`manim-plugintemplate <https://pypi.org/project/manim-plugintemplate/>`_
|
|
on PyPI.org which serves as an in-depth tutorial for creating plugins.
|
|
|
|
.. code-block:: bash
|
|
|
|
pip install manim-plugintemplate
|
|
|
|
The only requirement of manim plugins is that they specify an entry point
|
|
with the group, ``"manim.plugins"``. This allows Manim to discover plugins
|
|
available in the user's environment. Everything regarding the plugin's
|
|
directory structure, build system, and naming are completely up to your
|
|
discretion as an author. The aforementioned template plugin, is only a model
|
|
using Poetry since this is the build system Manim uses. The plugin's `entry
|
|
point <https://packaging.python.org/specifications/entry-points/>`_ can be
|
|
specified in poetry as:
|
|
|
|
.. code-block:: toml
|
|
|
|
[tool.poetry.plugins."manim.plugins"]
|
|
"name" = "object_reference"
|
|
|
|
Here ``name`` is the name of the module of the plugin.
|
|
|
|
Here ``object_reference`` can point to either a function in a module or a module
|
|
itself. For example,
|
|
|
|
.. code-block:: toml
|
|
|
|
[tool.poetry.plugins."manim.plugins"]
|
|
"manim_plugintemplate" = "manim_plugintemplate"
|
|
|
|
Here a module is used as ``object_reference``, and when this plugin is enabled,
|
|
Manim will look for ``__all__`` keyword defined in ``manim_plugintemplate`` and
|
|
everything as a global variable one by one.
|
|
|
|
If ``object_reference`` is a function, Manim calls the function and expects the
|
|
function returns a list of modules or functions that needs to defined globally and
|
|
it defined it.
|
|
|
|
For example,
|
|
|
|
.. code-block:: toml
|
|
|
|
[tool.poetry.plugins."manim.plugins"]
|
|
"manim_plugintemplate" = "manim_awesomeplugin.imports:setup_things"
|
|
|
|
Here, Manim will call the function ``setup_things`` defined in
|
|
``manim_awesomeplugin.imports`` and calls that. It returns a list of function or
|
|
modules which will be imported globally.
|