chore(deps): use PDM instead of Poetry (#354)

* chore(deps): use PDM instead of Poetry

* chore(git): move to top

* chore(lint): fixes

* fix(pdm): dynamic version did not work

* chore(ci): fix syntax for Windows

* fix(ci): typo

* wip(docs): updates

* chore(docs): add changelog entry

* chore(docs): admonitions

* chore(docs): update to use manim-slides render

* chore(docs): make it better
This commit is contained in:
Jérome Eertmans
2024-01-18 22:02:53 +01:00
committed by GitHub
parent 62560ea41f
commit be227bbdea
20 changed files with 3829 additions and 4440 deletions

View File

@ -33,53 +33,64 @@ jobs:
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Install Poetry
run: pipx install poetry - name: Install PDM
- name: Install Python uses: pdm-project/setup-pdm@v3
uses: actions/setup-python@v5
with: with:
python-version: '3.10' python-version: '3.10'
cache: poetry cache: true
- name: Setup Pages - name: Setup Pages
uses: actions/configure-pages@v4 uses: actions/configure-pages@v4
- name: Install Linux Dependencies - name: Install Linux Dependencies
run: | run: |
sudo apt-get update sudo apt-get update
sudo apt-get install libcairo2-dev libpango1.0-dev ffmpeg freeglut3-dev sudo apt-get install libcairo2-dev libpango1.0-dev ffmpeg freeglut3-dev
- name: Setup Pandoc - name: Setup Pandoc
uses: nikeee/setup-pandoc@v1 uses: nikeee/setup-pandoc@v1
- name: Install local Python package - name: Install local Python package
run: poetry install --with docs run: pdm install -dGdocs -dGgithub-action
- name: Install IPython kernel - name: Install IPython kernel
run: poetry run ipython kernel install --name "manim-slides" --user run: pdm run ipython kernel install --name "manim-slides" --user
- name: Restore cached media - name: Restore cached media
id: cache-media-restore id: cache-media-restore
uses: actions/cache/restore@v4 uses: actions/cache/restore@v4
with: with:
path: docs/media path: docs/media
key: ${{ runner.os }}-docs-media key: ${{ runner.os }}-docs-media
- name: Clear cache - name: Clear cache
run: | run: |
gh extension install actions/gh-actions-cache gh extension install actions/gh-actions-cache
gh actions-cache delete ${{ steps.cache-media-restore.outputs.cache-primary-key }} --confirm || true gh actions-cache delete ${{ steps.cache-media-restore.outputs.cache-primary-key }} --confirm || true
env: env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Save media to cache - name: Save media to cache
id: cache-media-save id: cache-media-save
uses: actions/cache/save@v4 uses: actions/cache/save@v4
with: with:
path: docs/media path: docs/media
key: ${{ steps.cache-media-restore.outputs.cache-primary-key }} key: ${{ steps.cache-media-restore.outputs.cache-primary-key }}
- name: Build docs - name: Build docs
run: cd docs && poetry run make html run: cd docs && pdm run make html
- name: Upload artifact - name: Upload artifact
if: github.event_name != 'pull_request' if: github.event_name != 'pull_request'
uses: actions/upload-pages-artifact@v3 uses: actions/upload-pages-artifact@v3
with: with:
# Upload docs/build/html dir # Upload docs/build/html dir
path: docs/build/html/ path: docs/build/html/
- name: Show docs/build/html/_static/ dir content (video only) - name: Show docs/build/html/_static/ dir content (video only)
run: tree -L 3 docs/build/html/_static/ -P '*.mp4' run: tree -L 3 docs/build/html/_static/ -P '*.mp4'
- name: Deploy to GitHub Pages - name: Deploy to GitHub Pages
id: deployment id: deployment
if: github.event_name != 'pull_request' if: github.event_name != 'pull_request'

View File

@ -1,4 +1,4 @@
name: Upload Python Package name: Upload Packages
on: on:
push: push:
@ -7,31 +7,23 @@ on:
types: [published] types: [published]
jobs: jobs:
build_and_release: publish-python:
name: Build and release name: Build and release
runs-on: ubuntu-latest runs-on: ubuntu-latest
environment: release
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Install Poetry - name: Install PDM
run: pipx install poetry uses: pdm-project/setup-pdm@v3
- name: Install Python
uses: actions/setup-python@v5
with: with:
python-version: '3.10' python-version: '3.10'
cache: poetry cache: true
- name: Build wheels
run: poetry build
- name: Publish to PyPI - name: Publish to PyPI
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
env: run: pdm publish
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN }}
run: poetry publish
publish-docker: publish-docker:
name: Publish Docker image name: Publish Docker image

View File

@ -25,14 +25,11 @@ jobs:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Install Poetry - name: Install PDM
run: pipx install poetry uses: pdm-project/setup-pdm@v3
- name: Install Python
uses: actions/setup-python@v5
with: with:
python-version: ${{ matrix.pyversion }} python-version: ${{ matrix.pyversion }}
cache: poetry cache: true
# Path related stuff # Path related stuff
- name: Append to Path on MacOS - name: Append to Path on MacOS
@ -72,15 +69,15 @@ jobs:
- name: Install Manim Slides - name: Install Manim Slides
run: | run: |
poetry install --with test --all-extras pdm install -dGgithub-action -dGtest
- name: Run pytest - name: Run pytest
if: matrix.os != 'ubuntu-latest' || matrix.pyversion != '3.11' if: matrix.os != 'ubuntu-latest' || matrix.pyversion != '3.11'
run: poetry run pytest run: pdm run pytest
- name: Run pytest and coverage - name: Run pytest and coverage
if: matrix.os == 'ubuntu-latest' && matrix.pyversion == '3.11' if: matrix.os == 'ubuntu-latest' && matrix.pyversion == '3.11'
run: poetry run pytest --cov-report xml --cov=manim_slides tests/ run: pdm run pytest --cov-report xml --cov=manim_slides tests/
- name: Upload to codecov.io - name: Upload to codecov.io
if: matrix.os == 'ubuntu-latest' && matrix.pyversion == '3.11' if: matrix.os == 'ubuntu-latest' && matrix.pyversion == '3.11'

1
.gitignore vendored
View File

@ -4,6 +4,7 @@ __pycache__/
/build /build
/dist /dist
*.egg-info/ *.egg-info/
.pdm-python
# Manim files # Manim files
images/ images/

View File

@ -13,12 +13,11 @@ repos:
args: [--autofix] args: [--autofix]
- id: pretty-format-toml - id: pretty-format-toml
exclude: poetry.lock exclude: poetry.lock
args: [--autofix] args: [--autofix, --trailing-commas]
- repo: https://github.com/keewis/blackdoc - repo: https://github.com/keewis/blackdoc
rev: v0.3.9 rev: v0.3.9
hooks: hooks:
- id: blackdoc - id: blackdoc
additional_dependencies: [black==23.10.1]
- repo: https://github.com/astral-sh/ruff-pre-commit - repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.13 rev: v0.1.13
hooks: hooks:

View File

@ -31,7 +31,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
and `self.zoom`. and `self.zoom`.
[#331](https://github.com/jeertmans/manim-slides/pull/331) [#331](https://github.com/jeertmans/manim-slides/pull/331)
- Created a Docker image, published on GitHub. - Created a Docker image, published on GitHub.
[#331](https://github.com/jeertmans/manim-slides/pull/355) [#355](https://github.com/jeertmans/manim-slides/pull/355)
(v5.1-modified)= (v5.1-modified)=
### Modified ### Modified
@ -47,6 +47,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Removed subrocess calls to FFMPEG with direct `libav` bindings using - Removed subrocess calls to FFMPEG with direct `libav` bindings using
the `av` Python module. This should enhance rendering speed and security. the `av` Python module. This should enhance rendering speed and security.
[#335](https://github.com/jeertmans/manim-slides/pull/335) [#335](https://github.com/jeertmans/manim-slides/pull/335)
- Changed build backend to PDM and reflected on docs.
[#354](https://github.com/jeertmans/manim-slides/pull/354)
## [v5](https://github.com/jeertmans/manim-slides/compare/v4.16.0...v5.0.0) ## [v5](https://github.com/jeertmans/manim-slides/compare/v4.16.0...v5.0.0)

145
README.md
View File

@ -14,19 +14,18 @@
# Manim Slides # Manim Slides
Tool for live presentations using either [Manim (community edition)](https://www.manim.community/) or [ManimGL](https://3b1b.github.io/manim/). Manim Slides will *automatically* detect the one you are using! Tool for live presentations using either
[Manim (community edition)](https://www.manim.community/)
or [ManimGL](https://3b1b.github.io/manim/).
Manim Slides will *automatically* detect the one you are using!
> **NOTE:** this project extends the work of [`manim-presentation`](https://github.com/galatolofederico/manim-presentation), with a lot more features! > [!NOTE]
> This project extends the work of
> [`manim-presentation`](https://github.com/galatolofederico/manim-presentation),
> with a lot more features!
- [Installation](#installation) - [Installation](#installation)
* [Dependencies](#dependencies)
* [Pip install](#pip-install)
* [Install From Repository](#install-from-repository)
- [Usage](#usage) - [Usage](#usage)
* [Basic Example](#basic-example)
* [Key Bindings](#key-bindings)
* [Interactive Tutorial](#interactive-tutorial)
* [Other Examples](#other-examples)
- [Comparison with Similar Tools](#comparison-with-similar-tools) - [Comparison with Similar Tools](#comparison-with-similar-tools)
- [F.A.Q](#faq) - [F.A.Q](#faq)
* [How to increase quality on Windows](#how-to-increase-quality-on-windows) * [How to increase quality on Windows](#how-to-increase-quality-on-windows)
@ -37,58 +36,21 @@ Tool for live presentations using either [Manim (community edition)](https://www
## Installation ## Installation
<!-- start install --> Manim Slides requires either Manim or ManimGL to be installed, along
with their dependencies. Please checkout the
While installing Manim Slides and its dependencies on your global Python is fine, I recommend using a virtual environment (e.g., [venv](https://docs.python.org/3/tutorial/venv.html)) for a local installation. [documentation](https://eertmans.be/manim-slides/installation.html)
for detailed install instructions.
### Dependencies
<!-- start deps -->
Manim Slides requires either Manim or ManimGL to be installed. Having both packages installed is fine too.
If none of those packages are installed, please refer to their specific installation guidelines:
- [Manim](https://docs.manim.community/en/stable/installation.html)
- [ManimGL](https://3b1b.github.io/manim/getting_started/installation.html)
> **NOTE**: if you install Manim from its git repository, as suggested by ManimGL,
make sure to first check out a supported version (e.g., `git checkout tags/v1.6.1`
for ManimGL), otherwise it might install an unsupported version of Manim!
See [#314](https://github.com/jeertmans/manim-slides/issues/314) for an example.
<!-- end deps -->
### Pip Install
The recommended way to install the latest release is to use pip:
```bash
pip install manim-slides
```
Optionally, you can also install Manim or ManimGL using extras[^1]:
```bash
pip install manim-slides[manim] # For Manim
# or
pip install manim-slides[manimgl] # For ManimGL
```
[^1]: NOTE: you still need to have Manim or ManimGL platform-specific dependencies installed on your computer.
### Install From Repository
An alternative way to install Manim Slides is to clone the git repository, and install from there: read the [contributing guide](https://eertmans.be/manim-slides/contributing/workflow.html) to know how.
<!-- end install -->
## Usage ## Usage
<!-- start usage --> <!-- start usage -->
Using Manim Slides is a two-step process: Using Manim Slides is a two-step process:
1. Render animations using `Slide` (resp. `ThreeDSlide`) as a base class instead of `Scene` (resp. `ThreeDScene`), and add calls to `self.next_slide()` everytime you want to create a new slide. 1. Render animations using `Slide` (resp. `ThreeDSlide`) as a base class instead
2. Run `manim-slides` on rendered animations and display them like a *Power Point* presentation. of `Scene` (resp. `ThreeDScene`), and add calls to `self.next_slide()`
everytime you want to create a new slide.
2. Run `manim-slides` on rendered animations and display them like a
*PowerPoint* presentation.
The documentation is available [online](https://eertmans.be/manim-slides/). The documentation is available [online](https://eertmans.be/manim-slides/).
@ -99,8 +61,6 @@ animations, and `self.next_slide(loop=True)` if you want the next slide to loop
over animations until the user presses continue: over animations until the user presses continue:
```python ```python
# example.py
from manim import * # or: from manimlib import * from manim import * # or: from manimlib import *
from manim_slides import Slide from manim_slides import Slide
@ -124,18 +84,23 @@ class BasicExample(Slide):
First, render the animation files: First, render the animation files:
```bash ```bash
manim example.py BasicExample manim-slides render example.py BasicExample
# or # or use ManimGL
manimgl example.py BasicExample manim-slides render --GL example.py BasicExample
``` ```
To start the presentation using `Scene1`, `Scene2` and so on simply run: > [!NOTE]
> Using `manim-slides render` makes sure the use the `manim`
> (or `manimlib`) library that was installed in the Python same environment.
> Put simply, this is a wrapper of `manim render [ARGS]...` (or `manimgl [ARGS]...`).
To start the presentation using `Scene1`, `Scene2` and so on, run:
```bash ```bash
manim-slides [OPTIONS] Scene1 Scene2... manim-slides [OPTIONS] Scene1 Scene2...
``` ```
Or in this example: In our example:
```bash ```bash
manim-slides BasicExample manim-slides BasicExample
@ -143,49 +108,30 @@ manim-slides BasicExample
<!-- end usage --> <!-- end usage -->
## Key Bindings <p align="center">
<img alt="Manim Slides Logo" src="https://raw.githubusercontent.com/jeertmans/manim-slides/main/static/example.gif">
</p>
The default key bindings to control the presentation are: For detailed usage documentation, run `manim-slides --help`, or go to the
[documentation](https://eertmans.be/manim-slides/reference/cli.html).
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/jeertmans/manim-slides/main/static/wizard_dark.png">
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/jeertmans/manim-slides/main/static/wizard_light.png">
<img alt="Manim Slides Wizard" src="https://raw.githubusercontent.com/jeertmans/manim-slides/main/static/wizard_light.png">
</picture>
You can run the **configuration wizard** to change those key bindings:
```bash
manim-slides wizard
```
A default file can be created with:
```bash
manim-slides init
```
> **_NOTE:_** `manim-slides` uses key codes, which are platform dependent. Using the configuration wizard is therefore highly recommended.
## Interactive Tutorial ## Interactive Tutorial
Click on the image to watch a slides presentation that explains you how to use Manim Slides. Click on the image to watch a slides presentation that explains to you how
to use Manim Slides.
[![Manim Slides Docs](https://raw.githubusercontent.com/jeertmans/manim-slides/main/static/docs.png)](https://eertmans.be/manim-slides/) [![Manim Slides Docs](https://raw.githubusercontent.com/jeertmans/manim-slides/main/static/docs.png)](https://eertmans.be/manim-slides/)
## Other Examples ## More Examples
Other examples are available in the [`example.py`](https://github.com/jeertmans/manim-slides/blob/main/example.py) file, if you downloaded the git repository.
Below is a small recording of me playing with the slides back and forth.
![](https://raw.githubusercontent.com/jeertmans/manim-slides/main/static/example.gif)
More examples are available in the
[`example.py`](https://github.com/jeertmans/manim-slides/blob/main/example.py)
file, if you downloaded the git repository.
## Comparison with Similar Tools ## Comparison with Similar Tools
There exists are variety of tools that allows to create slides presentations containing Manim animations. There exists a variety of tools that allows to create slides presentations
containing Manim animations.
Below is a comparison of the most used ones with Manim Slides: Below is a comparison of the most used ones with Manim Slides:
@ -203,8 +149,12 @@ Below is a comparison of the most used ones with Manim Slides:
### How to increase quality on Windows ### How to increase quality on Windows
On Windows platform, one may encounter a lower image resolution than expected. Usually, this is observed because Windows rescales every application to fit the screen. On Windows platform, one may encounter a lower image resolution than expected.
As found by [@arashash](https://github.com/arashash), in [#20](https://github.com/jeertmans/manim-slides/issues/20), the problem can be addressed by changing the scaling factor to 100%: Usually, this is observed because Windows rescales every application to
fit the screen.
As found by [@arashash](https://github.com/arashash),
in [#20](https://github.com/jeertmans/manim-slides/issues/20),
the problem can be addressed by changing the scaling factor to 100%:
![Windows Fix Scaling](https://raw.githubusercontent.com/jeertmans/manim-slides/main/static/windows_quality_fix.png) ![Windows Fix Scaling](https://raw.githubusercontent.com/jeertmans/manim-slides/main/static/windows_quality_fix.png)
@ -212,7 +162,8 @@ in *Settings*->*Display*.
## Contributing ## Contributing
Contributions are more than welcome! Please read through [our contributing section](https://eertmans.be/manim-slides/contributing/index.html). Contributions are more than welcome! Please read through
[our contributing section](https://eertmans.be/manim-slides/contributing/index.html).
### Reporting an Issue ### Reporting an Issue

View File

@ -5,6 +5,9 @@
# https://www.sphinx-doc.org/en/master/usage/configuration.html # https://www.sphinx-doc.org/en/master/usage/configuration.html
import sys import sys
from datetime import date
from manim_slides import __version__
assert sys.version_info >= (3, 10), "Building docs requires Python 3.10" assert sys.version_info >= (3, 10), "Building docs requires Python 3.10"
@ -12,8 +15,9 @@ assert sys.version_info >= (3, 10), "Building docs requires Python 3.10"
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information # https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
project = "Manim Slides" project = "Manim Slides"
copyright = "2023, Jérome Eertmans" copyright = f"2024-{date.today().year}, Jérome Eertmans"
author = "Jérome Eertmans" author = "Jérome Eertmans"
version = __version__
# -- General configuration --------------------------------------------------- # -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

View File

@ -4,7 +4,7 @@ This document is there to help you recreate a working environment for Manim Slid
## Dependencies ## Dependencies
```{include} ../../../README.md ```{include} ../quickstart.md
:start-after: <!-- start deps --> :start-after: <!-- start deps -->
:end-before: <!-- end deps --> :end-before: <!-- end deps -->
``` ```
@ -20,64 +20,110 @@ Useful links:
Once you feel comfortable with git and GitHub, [fork](https://github.com/jeertmans/manim-slides/fork) the repository, and clone it locally. Once you feel comfortable with git and GitHub, [fork](https://github.com/jeertmans/manim-slides/fork) the repository, and clone it locally.
As for every Python project, using virtual environment is recommended to avoid conflicts between modules. For Manim Slides, we use [Poetry](https://python-poetry.org/docs/#installing-with-the-official-installer). If not already, please install it. As for every Python project, using virtual environment is recommended to avoid
conflicts between modules.
For this project, we use [PDM](https://pdm-project.org/) to easily manage project
and development dependencies. If not already, please install this tool.
## Installing Python modules ## Installing Python modules
With Poetry, installation becomes straightforward: With PDM, installation becomes straightforward:
```bash ```bash
poetry install pdm install
``` ```
This, however, only installs the minimal set of dependencies to run the package. This, however, only installs the minimal set of dependencies to run the package.
If you would like to install Manim or ManimGL, as documented in the [quickstart](../quickstart), If you would like to install Manim or ManimGL,
you can use the `--extras` option: as documented in the [quickstart](../quickstart),
you can use the `-G|--group` option:
```bash ```bash
poetry install --extras manim # For Manim pdm install -Gmanim # For Manim
# or # or
poetry install --extras manimgl # For ManimGL pdm install -Gmanimgl # For ManimGL
``` ```
Additionnally, Manim Slides comes with group dependencies for development purposes: Additionnally, Manim Slides comes with groups of dependencies for development purposes:
```bash ```bash
poetry install --with dev # For linters and formatters pdm install -dGdev # For linters and formatters
# or # or
poetry install --with docs # To build the documentation locally pdm install --dGdocs # To build the documentation locally
# or
pdm install --dGtests # To run tests
``` ```
Another group is `test`, but it is only used for
[GitHub actions](https://github.com/jeertmans/manim-slides/blob/main/.github/workflows/test_examples.yml).
:::{note} :::{note}
You can combine any number of groups or extras when installing the package locally. You can combine any number of groups or extras when installing the package locally.
You can also install everything with `pdm install -G:all`.
::: :::
## Running commands ## Running commands
As modules were installed in a new Python environment, you cannot use them directly in the shell. Because modules are installed in a new Python environment,
Instead, you either need to prepend `poetry run` to any command, e.g.: you cannot use them directly in the shell.
Instead, you either need to prepend `pdm run` to any command, e.g.:
```bash ```bash
poetry run manim-slides wizard pdm run manim-slides wizard
``` ```
or enter a new shell that uses this new Python environment: or [enter a new shell](https://pdm-project.org/latest/usage/venv/#activate-a-virtualenv)
that uses this new Python environment:
``` ```bash
poetry shell eval $(pdm venv activate) # Click on the link above to see shell-specific command
manim-slides wizard manim-slides wizard
``` ```
## Testing your code ## Testing your code
Most of the tests are done with GitHub actions, thus not on your computer. The only command you should run locally is `pre-commit run --all-files`: this runs a few linter and formatter to make sure the code quality and style stay constant across time. If a warning or an error is displayed, please fix it before going to next step. Most of the tests are done with GitHub actions, thus not on your computer.
The only command you should run locally is:
```bash
pdm run pre-commit run --all-files
```
This runs a few linter and formatter to make sure the code quality and style stay
constant across time.
If a warning or an error is displayed, please fix it before going to next step.
For testing your code, simply run:
```bash
pdm run pytest
```
## Building the documentation
The documentation is generated using Sphinx, based on the content
in `docs/source` and in the `manim_slides` Python package.
To generate the documentation, run the following:
```bash
cd docs
pdm run make html
```
Then, the output index file is located at `docs/build/html/index.html` and
can be opened with any modern browser.
:::{warning}
Building the documentation can take quite some time, especially
the first time as it needs to render all the animations.
Further builds should run faster.
:::
## Proposing changes ## Proposing changes
Once you feel ready and think your contribution is ready to be reviewed, create a [pull request](https://github.com/jeertmans/manim-slides/pulls) and wait for a reviewer to check your work! Once you feel ready and think your contribution is ready to be reviewed,
create a [pull request](https://github.com/jeertmans/manim-slides/pulls)
and wait for a reviewer to check your work!
Many thanks to you! Many thanks to you!

View File

@ -26,7 +26,6 @@ Manim Slides makes creating slides with Manim super easy!
In a [very few steps](./quickstart), In a [very few steps](./quickstart),
you can create slides and present them either using the GUI, or your browser. you can create slides and present them either using the GUI, or your browser.
Slide through the demo below to get a quick glimpse on what you can do with Slide through the demo below to get a quick glimpse on what you can do with
Manim Slides. Manim Slides.
@ -40,6 +39,7 @@ Manim Slides.
:hidden: :hidden:
quickstart quickstart
installation
reference/index reference/index
features_table features_table
manim_or_manimgl manim_or_manimgl

104
docs/source/installation.md Normal file
View File

@ -0,0 +1,104 @@
# Installation
While installing Manim Slides and its dependencies on your global Python is fine,
we recommend using a virtual environment
(e.g., [venv](https://docs.python.org/3/tutorial/venv.html)) for a local installation.
Therefore, the following documentation will install Manim Slides using
[pipx](https://pipx.pypa.io/). This tool is a drop-in replacement
for installing Python packages that ship with one or more executable.
The benefit of using pipx is that it will automatically create a new virtual
environment for every package you install.
:::{note}
Everytime you read `pipx install`, you can use `pip install` instead,
if you are working in a virtual environment or else.
:::
## Dependencies
Manim Slides requires either Manim or ManimGL to be installed, along
with their dependencies.
Having both packages installed is fine too.
If none of those packages are installed,
please refer to their specific installation guidelines:
- [Manim](https://docs.manim.community/en/stable/installation.html)
- [ManimGL](https://3b1b.github.io/manim/getting_started/installation.html)
:::{warning}
If you install Manim from its git repository, as suggested by ManimGL,
make sure to first check out a supported version (e.g., `git checkout tags/v1.6.1`
for ManimGL), otherwise it might install an unsupported version of Manim!
See [#314](https://github.com/jeertmans/manim-slides/issues/314).
:::
## Pip Install
The recommended way to install the latest release is to use pip:
```bash
pipx install -U manim-slides
```
:::{tip}
While not necessary, the `-U` indicates that we would
like to upgrade to the latest version available,
if Manim Slides is already installed.
:::
Optionally, you can also install Manim or ManimGL using extras[^1]:
```bash
pipx install -U "manim-slides[manim]" # For Manim
# or
pipx install -U "manim-slides[manimgl]" # For ManimGL
```
You can check that Manim Slides was correctly installed with:
```bash
manim-slides --version
```
:::{warning}
If you are installing with pipx, this is mandatory to at least include
either `manim` or `manimgl`.
:::
[^1]: You still need to have Manim or ManimGL platform-specific dependencies
installed on your computer.
## Optional Dependencies
Along with the optional dependencies for Manim and ManimGL,
Manim Slides offers additional *extras*, that can be activated
using optional dependencies:
- `magic`, to include a Jupyter magic to render
animations inside notebooks. This automatically installs `manim`,
and does not work with ManimGL;
- `manim` and `manimgl`, for installing the corresponding
dependencies;
- `sphinx-directive`, to generate presentation inside your Sphinx
documentation. This automatically installs `manim`,
and does not work with ManimGL;
Installing those extras can be done with the following syntax:
```bash
pipx install -U "manim-slides[extra1,extra2]"
```
:::{note}
The quotes `"` are added because not all shell support unquoted
brackets (e.g., zsh) or commas (e.g., Windows).
:::
## Install From Repository
An alternative way to install Manim Slides is to clone the git repository,
and install from there: read the
[contributing guide](./contributing/workflow)
to know how to process.

View File

@ -1,11 +1,7 @@
# Quickstart # Quickstart
## Installation If not already, install Manim Slides, along with either Manim or ManimGL,
see [installation](./installation).
```{include} ../../README.md
:start-after: <!-- start install -->
:end-before: <!-- end install -->
```
## Creating your first slides ## Creating your first slides

View File

@ -9,8 +9,10 @@ We will go from the *most restrictive* method, to the least restrictive one.
If you need to present on a computer without prior knowledge on what will be If you need to present on a computer without prior knowledge on what will be
installed on it, please directly refer to the last sections. installed on it, please directly refer to the last sections.
> **NOTES:** in the next sections, we will assume your animations are described :::{note}
In the next sections, we will assume your animations are described
in `example.py`, and you have one presentation called `BasicExample`. in `example.py`, and you have one presentation called `BasicExample`.
:::
## With Manim Slides installed on the target machine ## With Manim Slides installed on the target machine
@ -32,8 +34,8 @@ the key bindings might not be the same.
Example: Example:
```bash ```bash
# If you use ManimGl, replace `manim` with `manimgl` # If you use ManimGl, add `--GL` after `render`
manim example.py BasicExample manim-slides render example.py BasicExample
# This or `manim-slides BasicExample` works since # This or `manim-slides BasicExample` works since
# `present` is implied by default # `present` is implied by default
@ -128,7 +130,6 @@ The additional code comes from
[this article](https://faq.dailymotion.com/hc/en-us/articles/360022841393-How-to-preserve-the-player-aspect-ratio-on-a-responsive-page) [this article](https://faq.dailymotion.com/hc/en-us/articles/360022841393-How-to-preserve-the-player-aspect-ratio-on-a-responsive-page)
and it there to preserve the original aspect ratio (16:9). and it there to preserve the original aspect ratio (16:9).
### Sharing ONE HTML file ### Sharing ONE HTML file
If you set the `data_uri` option to `true` (with `-cdata_uri=true`), If you set the `data_uri` option to `true` (with `-cdata_uri=true`),
@ -144,10 +145,11 @@ This is how your are able to watch all the examples on this website. If you want
to know how to share your slide with GitHub pages, see the to know how to share your slide with GitHub pages, see the
[workflow file](https://github.com/jeertmans/manim-slides/blob/main/.github/workflows/pages.yml). [workflow file](https://github.com/jeertmans/manim-slides/blob/main/.github/workflows/pages.yml).
> **WARNING:** keep in mind that playing large video files over the internet :::{warning}
Keep in mind that playing large video files over the internet network
can take some time, and *glitches* may occur between slide transitions for this can take some time, and *glitches* may occur between slide transitions for this
reason. reason.
:::
### Using the Github starter template ### Using the Github starter template

View File

@ -21,7 +21,9 @@ This directive requires three additional dependencies:
with Sphinx. with Sphinx.
You can install them manually, or with the extra keyword: You can install them manually, or with the extra keyword:
pip install manim-slides[sphinx-directive] .. code-block:: bash
pip install "manim-slides[sphinx-directive]"
Note that you will still need to install Manim's platform-specific dependencies, Note that you will still need to install Manim's platform-specific dependencies,
see see

View File

@ -16,7 +16,9 @@ Utilities for using Manim Slides with IPython (in particular: Jupyter notebooks)
This magic requires two additional dependencies: ``manim`` and ``IPython``. This magic requires two additional dependencies: ``manim`` and ``IPython``.
You can install them manually, or with the extra keyword: You can install them manually, or with the extra keyword:
pip install manim-slides[magic] .. code-block:: bash
pip install "manim-slides[magic]"
Note that you will still need to install Manim's platform-specific dependencies, Note that you will still need to install Manim's platform-specific dependencies,
see see

View File

@ -44,7 +44,7 @@ def render(ce: bool, gl: bool, args: Tuple[str, ...]) -> None:
Render SCENE(s) from the input FILE, using the specified renderer. Render SCENE(s) from the input FILE, using the specified renderer.
Use ``manim-slides render --help`` to see help information for Use ``manim-slides render --help`` to see help information for
a the specified renderer. a specific renderer.
""" """
if ce and gl: if ce and gl:
raise click.UsageError("You cannot specify both --CE and --GL renderers.") raise click.UsageError("You cannot specify both --CE and --GL renderers.")

3458
pdm.lock generated Normal file

File diff suppressed because it is too large Load Diff

4171
poetry.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -1,20 +1,9 @@
[build-system] [build-system]
build-backend = "poetry.core.masonry.api" build-backend = "pdm.backend"
requires = ["setuptools", "poetry-core>=1.0.0"] requires = ["pdm-backend", "setuptools"]
[tool.black] [project]
target-version = ["py38"] authors = [{name = "Jérome Eertmans", email = "jeertmans@icloud.com"}]
[tool.mypy]
disallow_untyped_decorators = false
install_types = true
python_version = "3.8"
strict = true
[tool.poetry]
authors = [
"Jérome Eertmans <jeertmans@icloud.com>"
]
classifiers = [ classifiers = [
"Programming Language :: Python :: 3", "Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.8",
@ -25,97 +14,101 @@ classifiers = [
"Operating System :: OS Independent", "Operating System :: OS Independent",
"Topic :: Multimedia :: Video", "Topic :: Multimedia :: Video",
"Topic :: Multimedia :: Graphics", "Topic :: Multimedia :: Graphics",
"Topic :: Scientific/Engineering" "Topic :: Scientific/Engineering",
]
dependencies = [
"av>=9.0.0",
"click>=8.1.3",
"click-default-group>=1.2.2",
"jinja2>=3.1.2",
"lxml>=4.9.2",
"numpy>=1.19",
"opencv-python>=4.6.0.66",
"pillow>=9.5.0",
"pydantic>=2.0.1",
"pydantic-extra-types>=2.0.0",
"pyside6==6.5.2",
"python-pptx>=0.6.21",
"requests>=2.28.1",
"rich>=13.3.2",
"rtoml>=0.9.0",
"tqdm>=4.64.1",
] ]
description = "Tool for live presentations using manim" description = "Tool for live presentations using manim"
documentation = "https://eertmans.be/manim-slides" dynamic = ["license", "readme"]
exclude = ["docs/", "static/"]
homepage = "https://github.com/jeertmans/manim-slides"
keywords = ["manim", "slides", "plugin", "manimgl"] keywords = ["manim", "slides", "plugin", "manimgl"]
license = "MIT"
name = "manim-slides" name = "manim-slides"
packages = [ requires-python = ">=3.8,<3.12"
{include = "manim_slides"}
]
readme = "README.md"
repository = "https://github.com/jeertmans/manim-slides"
version = "5.1.0-rc2" version = "5.1.0-rc2"
[tool.poetry.dependencies] [project.optional-dependencies]
av = ">=9.0.0" all = [
click = "^8.1.3" "manim-slides[magic,manim,manimgl,sphinx-directive]",
click-default-group = "^1.2.2" ]
docutils = {version = "^0.20.1", optional = true} magic = ["manim-slides[manim]", "ipython>=8.12.2"]
ipython = {version = ">=8.12.2", optional = true} manim = ["manim>=0.17.3"]
jinja2 = "^3.1.2" manimgl = ["manimgl>=1.6.1"]
lxml = "^4.9.2" sphinx-directive = ["docutils>=0.20.1", "manim-slides[manim]"]
manim = {version = "^0.17.3", optional = true}
manimgl = {version = "^1.6.1", optional = true}
numpy = "^1.19"
opencv-python = "^4.6.0.66"
pillow = "^9.5.0"
pydantic = "^2.0.1"
pydantic-extra-types = "^2.0.0"
pyside6 = "6.5.2"
python = ">=3.8.1,<3.12"
python-pptx = "^0.6.21"
requests = "^2.28.1"
rich = "^13.3.2"
rtoml = "^0.9.0"
tqdm = "^4.64.1"
[tool.poetry.extras] [project.scripts]
magic = ["manim", "ipython"]
manim = ["manim"]
manimgl = ["manimgl"]
sphinx-directive = ["docutils", "manim"]
[tool.poetry.group.dev]
optional = true
[tool.poetry.group.dev.dependencies]
bump2version = "^1.0.1"
pre-commit = "^3.0.2"
[tool.poetry.group.docs]
optional = true
[tool.poetry.group.docs.dependencies]
furo = "^2023.5.20"
ipykernel = "^6.25.1"
manim = "^0.17.3"
myst-parser = "^2.0.0"
nbsphinx = "^0.9.2"
pandoc = "^2.3"
sphinx = "^7.0.1"
sphinx-click = "^4.4.0"
sphinx-copybutton = "^0.5.1"
sphinxext-opengraph = "^0.7.5"
[tool.poetry.group.test]
optional = true
[tool.poetry.group.test.dependencies]
manim = "^0.17.3"
manimgl = "^1.6.1"
pytest = "^7.4.0"
pytest-cov = "^4.1.0"
pytest-env = "^0.8.2"
pytest-qt = "^4.2.0"
pytest-xdist = "^3.3.1"
[tool.poetry.plugins]
[tool.poetry.plugins."console_scripts"]
manim-slides = "manim_slides.__main__:cli" manim-slides = "manim_slides.__main__:cli"
[project.urls]
Changelog = "https://github.com/jeertmans/manim-slides/releases"
Documentation = "https://eertmans.be/manim-slides"
Founding = "https://github.com/sponsors/jeertmans"
Homepage = "https://github.com/jeertmans/manim-slides"
Repository = "https://github.com/jeertmans/manim-slides"
[tool.coverage.report]
exclude_lines = [
'pragma: no cover',
'raise NotImplementedError',
'if TYPE_CHECKING:',
'if typing.TYPE_CHECKING:',
]
precision = 2
[tool.mypy]
disallow_untyped_decorators = false
install_types = true
python_version = "3.8"
strict = true
[tool.pdm.dev-dependencies]
dev = [
"bump2version>=1.0.1",
"pre-commit>=3.5.0",
]
docs = [
"manim-slides[magic,sphinx-directive]",
"furo>=2023.5.20",
"ipykernel>=6.25.1",
"myst-parser>=2.0.0",
"nbsphinx>=0.9.2",
"pandoc>=2.3",
"sphinx>=7.0.1",
"sphinx-click>=4.4.0",
"sphinx-copybutton>=0.5.1",
"sphinxext-opengraph>=0.7.5",
]
github-action = ["setuptools"]
test = [
"manim-slides[manim,manimgl]",
"pytest>=7.4.0",
"pytest-cov>=4.1.0",
"pytest-env>=0.8.2",
"pytest-qt>=4.2.0",
"pytest-xdist>=3.3.1",
]
[tool.pytest.ini_options] [tool.pytest.ini_options]
env = [ env = [
"QT_QPA_PLATFORM=offscreen" "QT_QPA_PLATFORM=offscreen",
] ]
filterwarnings = [ filterwarnings = [
"error", "error",
"ignore::DeprecationWarning" "ignore::DeprecationWarning",
] ]
[tool.ruff] [tool.ruff]
@ -132,7 +125,7 @@ extend-ignore = [
"D203", "D203",
"D205", "D205",
"D212", "D212",
"E501" "E501",
] ]
extend-include = ["*.ipynb"] extend-include = ["*.ipynb"]
extend-select = ["B", "C90", "D", "I", "N", "RUF", "UP", "T"] extend-select = ["B", "C90", "D", "I", "N", "RUF", "UP", "T"]

View File

@ -1,21 +1,21 @@
#! /bin/bash #! /bin/bash
MANIM_SLIDES_THEME=light poetry run manim render -qk -s --format png --resolution 2560,1280 static/logo.py && mv media/images/logo/*.png static/logo.png MANIM_SLIDES_THEME=light pdm run manim-slides render -qk -s --format png --resolution 2560,1280 static/logo.py && mv media/images/logo/*.png static/logo.png
ln -f -r -s static/logo.png docs/source/_static/logo.png ln -f -r -s static/logo.png docs/source/_static/logo.png
MANIM_SLIDES_THEME=dark_docs poetry run manim render -qk -s --format png --resolution 2560,1280 static/logo.py && mv media/images/logo/*.png static/logo_dark_docs.png MANIM_SLIDES_THEME=dark_docs pdm run manim-slides render -qk -s --format png --resolution 2560,1280 static/logo.py && mv media/images/logo/*.png static/logo_dark_docs.png
ln -f -r -s static/logo_dark_docs.png docs/source/_static/logo_dark_docs.png ln -f -r -s static/logo_dark_docs.png docs/source/_static/logo_dark_docs.png
MANIM_SLIDES_THEME=dark_github poetry run manim render -qk -s --format png --resolution 2560,1280 static/logo.py && mv media/images/logo/*.png static/logo_dark_github.png MANIM_SLIDES_THEME=dark_github pdm run manim-slides render -qk -s --format png --resolution 2560,1280 static/logo.py && mv media/images/logo/*.png static/logo_dark_github.png
ln -f -r -s static/logo_dark_github.png docs/source/_static/logo_dark_github.png ln -f -r -s static/logo_dark_github.png docs/source/_static/logo_dark_github.png
MANIM_SLIDES_THEME=light poetry run manim render -t -qk -s --format png --resolution 2560,1280 static/logo.py && mv media/images/logo/*.png static/logo_light_transparent.png MANIM_SLIDES_THEME=light pdm run manim-slides render -t -qk -s --format png --resolution 2560,1280 static/logo.py && mv media/images/logo/*.png static/logo_light_transparent.png
ln -f -r -s static/logo_light_transparent.png docs/source/_static/logo_light_transparent.png ln -f -r -s static/logo_light_transparent.png docs/source/_static/logo_light_transparent.png
MANIM_SLIDES_THEME=dark_docs poetry run manim render -t -qk -s --format png --resolution 2560,1280 static/logo.py && mv media/images/logo/*.png static/logo_dark_transparent.png MANIM_SLIDES_THEME=dark_docs pdm run manim-slides render -t -qk -s --format png --resolution 2560,1280 static/logo.py && mv media/images/logo/*.png static/logo_dark_transparent.png
ln -f -r -s static/logo_dark_transparent.png docs/source/_static/logo_dark_transparent.png ln -f -r -s static/logo_dark_transparent.png docs/source/_static/logo_dark_transparent.png