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

Plugins are features that extend Manim’s core functionality. This is a template project repository that demonstrates how you can create and upload a manim plugin to PyPI using a PEP 517 compliant build system, Poetry. Feel free to copy the template repository on GitHub so you can generate a project with the same directory structure, branches, and files.

Poetry is NOT required to create plugins, but is recommended because it provides build isolation and ensures users can reliably install your plugin without falling into dependency hell. You may use another build system (e.g. Flit, Setuptools, Pipenv, etc…) if you wish.

Creating Plugins

The only requirement of your preferred build system is that it specifies the manim.plugins entry point.

Installing Poetry

Poetry can be installed on Windows, MacOS and Linux. Please visit the official poetry website for installation instructions. You may want to see the official documentation for a list of all available commands.

Setting Up Your Plugin Directory Structure

To create a Python project suitable for poetry, run:

poetry new --src manim-YourPluginName

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; however, you may wish to update your project directory structure similarly.

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

From now on, when working on your plugin, ensure you are using the virtual environment by running the following at the root of your project:

poetry shell

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 group, "manim.plugins", is REQUIRED and can be specified as follows:

[tool.poetry.plugins."manim.plugins"]
"manim_yourpluginname" = "module:object.attr"

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:*, etc…). Equally important to the dependencies specified here is that they do not directly conflict with Manim’s. If you want to update the dependencies specified in pyproject.toml, use:

poetry update

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

Poetry allows for dependencies that are strictly for project developers. These are not installed by users. To add them to your project, update the pyproject.toml file with the section followed by the dependencies:

The pytest package is a functional testing framework which you can use to run the test within the manim-YourPluginName/tests directory. You should create files which test the behavior and functionality of your plugin here. Test first development is a good practice to ensure your code behaves as intended before packaging and shipping your code publicly. Additionally, you can create Manimations that depend on your plugin which is another great way to ensure functionality.

Uploading Your Project

By default, poetry is set to register the package/plugin to PyPI. You’ll need to register an account there to upload/update your plugin. As soon as your plugin is useful locally, run the following:

poetry publish --build

This will prompt you for your PyPI username and password; however, it is recommended to use a project PyPI API token with the username __token__ instead.

Your project should now be available on PyPI for users to install via pip install manim-YourPluginName and usable within their respective environments. If instead you would like to upload to Test PyPI, you can run:

poetry config repositories.testpypi https://test.pypi.org/simple/
poetry publish -r testpypi --build

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

If you are interested in CI/CD pipelines and using GitHub Actions to automatically publish releases to your PyPI project, you can setup a PyPI API Token, or PyPI Test API Token for your project. Then on your GitHub repository you can setup a secret under the repository’s settings, followed by the appropriate GitHub Action.

See the official Python documentation on publishing Python package distributions using GitHub Actions.

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.4.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

manim_PluginTemplate-0.1.4-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file manim-PluginTemplate-0.1.4.tar.gz.

File metadata

  • Download URL: manim-PluginTemplate-0.1.4.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.4 CPython/3.8.6 Linux/5.4.0-1032-azure

File hashes

Hashes for manim-PluginTemplate-0.1.4.tar.gz
Algorithm Hash digest
SHA256 94336ec606278b61437c3296634e24298cf07d2b5e210eb446d514658b3b5c3c
MD5 d156647c7f48e6b47d47d8229b45e6a8
BLAKE2b-256 c623c76cd4f5ff60c7a72a62f34a0590835403d746a51586cfcc866a4fe5c60b

See more details on using hashes here.

File details

Details for the file manim_PluginTemplate-0.1.4-py3-none-any.whl.

File metadata

File hashes

Hashes for manim_PluginTemplate-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 e92341568183ddfd8a78df592849387dc3a4297e5ff2ec78af7cb26167ef71a3
MD5 a41045eb0161b92355afad518dde3f1b
BLAKE2b-256 173e4af15eae2fb9c7e8a350e7b56cc3442fe80d4d19906736e0a622396ec91a

See more details on using hashes here.

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