Skip to main content

A template project to both illustrate and serve as an example for plugin creations on top of the manim (community edition) engine.

Project description

This is a template project that demonstrates how one can create and upload a manim plugin to PyPI using a PEP 517 compliant build system (in this case poetry). This build system ensures users of your plugin are able to do so reliably without without falling into dependency hell. You may use another build system other than poetry (e.g. Flit, Enscons, etc…) if you wish to.

Creating Plugins

Plugins are features that can be used to extend the core of Manim’s functionality. By convention, plugins should be prefixed by manim- when being named. This allows users to easily search for plugins on organizations like PyPi, but it is not required. Manim discovers user plugins via the metadata specified in the pyproject.toml.

Installing Poetry

Poetry can be installed on any OS that can has curl. Please visit the official poetry website for installation instructions.

Setting Up Your Plugin Directory Structure

To create a Python project suitable for poetry you may want to see the official documentation for a list of all available commands. In short, if you haven’t extended manim’s functionality yet, run:

poetry new --src manim-YourPluginName

Note: --src is both optional and recomended in order to create a src directory where all of your plugin code should live.

This will create the following project structure:

manim-YourPluginName
├── pyproject.toml
├── README.rst
├── src
│   └── manim_yourpluginname
│       └── __init__.py
└── tests
    ├── __init__.py
    └── test_manim_yourpluginname.py

If you have already extended manim’s functionality, you can instead run:

cd path/to/plugin
poetry init

This will prompt you for basic information regarding your plugin and help create and populate a pyproject.toml similar to the one in this template.

See the official documentation for more information on the init command.

Updating Pyproject.toml

The pyproject.toml file is used by poetry and other build systems to manage and configure your project. Manim uses the package’s entry point metadata to discover available plugins. The entry point, "manim.plugins", is REQUIRED and can be specified as follows:

[tool.poetry.plugins."manim.plugins"]
"manim_yourpluginname" = "manim_yourpluginname"

This allows Manim to discover your plugin via manim plugin -u

Testing Your Plugin Locally

poetry install

This command will read the pyproject.toml, install the dependencies of your plugin, and create a poetry.lock file to ensure everyone using your plugin gets the same version of dependencies. It is important that your dependencies are properly annotated with a version constraint (e.g. manim:^0.1.1, numpy:1.19.2, etc…). Equally important to the dependencies specified here is that they do not conflict with manim’s.

See the official documentation for more information on versioning or the install command.

Uploading Your Project

By default, poetry is set to register the package/plugin to pypi. As soon as your plugin is useful locally, run the following:

poetry publish --build

Your project should now be available on PyPI for users to install via pip install manim-YourPluginName and usable within their respective environments.

See the official documentation for more information on the publish command.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

manim-PluginTemplate-0.1.3.tar.gz (4.9 kB view hashes)

Uploaded Source

Built Distribution

manim_PluginTemplate-0.1.3-py2.py3-none-any.whl (4.9 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page