Skip to content

Commit

Permalink
chore(deps): use PDM instead of Poetry
Browse files Browse the repository at this point in the history
  • Loading branch information
jeertmans committed Jan 18, 2024
1 parent 8b1c45b commit 7a047ac
Show file tree
Hide file tree
Showing 13 changed files with 3,683 additions and 4,347 deletions.
27 changes: 19 additions & 8 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,53 +33,64 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Poetry
run: pipx install poetry
- name: Install Python
uses: actions/setup-python@v5

- name: Install PDM
uses: pdm-project/setup-pdm@v3
with:
python-version: '3.10'
cache: poetry
cache: true

- name: Setup Pages
uses: actions/configure-pages@v4

- name: Install Linux Dependencies
run: |
sudo apt-get update
sudo apt-get install libcairo2-dev libpango1.0-dev ffmpeg freeglut3-dev
- name: Setup Pandoc
uses: nikeee/setup-pandoc@v1

- name: Install local Python package
run: poetry install --with docs
run: pdm install -dGdocs

- 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
id: cache-media-restore
uses: actions/cache/restore@v4
with:
path: docs/media
key: ${{ runner.os }}-docs-media

- name: Clear cache
run: |
gh extension install actions/gh-actions-cache
gh actions-cache delete ${{ steps.cache-media-restore.outputs.cache-primary-key }} --confirm || true
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Save media to cache
id: cache-media-save
uses: actions/cache/save@v4
with:
path: docs/media
key: ${{ steps.cache-media-restore.outputs.cache-primary-key }}

- name: Build docs
run: cd docs && poetry run make html
run: cd docs && pdm run make html

- name: Upload artifact
if: github.event_name != 'pull_request'
uses: actions/upload-pages-artifact@v3
with:
# Upload docs/build/html dir
path: docs/build/html/

- name: Show docs/build/html/_static/ dir content (video only)
run: tree -L 3 docs/build/html/_static/ -P '*.mp4'

- name: Deploy to GitHub Pages
id: deployment
if: github.event_name != 'pull_request'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,17 @@ jobs:
build_and_release:
name: Build and release
runs-on: ubuntu-latest

environment: release
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Poetry
run: pipx install poetry

- name: Install Python
uses: actions/setup-python@v5
- name: Install PDM
uses: pdm-project/setup-pdm@v3
with:
python-version: '3.10'
cache: poetry

- name: Build wheels
run: poetry build
cache: true

- name: Publish to PyPI
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN }}
run: poetry publish
run: pdm publish
15 changes: 6 additions & 9 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,11 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Poetry
run: pipx install poetry

- name: Install Python
uses: actions/setup-python@v5
- name: Install PDM
uses: pdm-project/setup-pdm@v3
with:
python-version: ${{ matrix.pyversion }}
cache: poetry
cache: true

# Path related stuff
- name: Append to Path on MacOS
Expand Down Expand Up @@ -72,15 +69,15 @@ jobs:

- name: Install Manim Slides
run: |
poetry install --with test --all-extras
pdm install -dGtest
- name: Run pytest
if: matrix.os != 'ubuntu-latest' || matrix.pyversion != '3.11'
run: poetry run pytest
run: pdm run pytest

- name: Run pytest and coverage
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
if: matrix.os == 'ubuntu-latest' && matrix.pyversion == '3.11'
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,5 @@ paper/media/
coverage.xml

rendering_times.csv

.pdm-python
3 changes: 1 addition & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@ repos:
args: [--autofix]
- id: pretty-format-toml
exclude: poetry.lock
args: [--autofix]
args: [--autofix, --trailing-commas]
- repo: https://github.com/keewis/blackdoc
rev: v0.3.9
hooks:
- id: blackdoc
additional_dependencies: [black==23.10.1]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.13
hooks:
Expand Down
88 changes: 63 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,15 @@

# 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)
* [Dependencies](#dependencies)
Expand All @@ -39,46 +45,58 @@ Tool for live presentations using either [Manim (community edition)](https://www

<!-- start install -->

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.
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.

### Dependencies

<!-- start deps -->

Manim Slides requires either Manim or ManimGL to be installed. Having both packages installed is fine too.
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.
> [!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

> [!NOTE]
> For an easy and safe installation, use [`pipx`](https://pipx.pypa.io/)
> instead of `pip`.
The recommended way to install the latest release is to use pip:

```bash
pip install manim-slides
pipx install manim-slides
```

Optionally, you can also install Manim or ManimGL using extras[^1]:

```bash
pip install manim-slides[manim] # For Manim
pip install "manim-slides[manim]" # For Manim
# or
pip install manim-slides[manimgl] # For ManimGL
pip install "manim-slides[manimgl]" # For ManimGL
```

[^1]: NOTE: you still need to have Manim or ManimGL platform-specific dependencies installed on your computer.
[^1]: 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.
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 to process.

<!-- end install -->

Expand All @@ -87,8 +105,11 @@ An alternative way to install Manim Slides is to clone the git repository, and i
<!-- start usage -->

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.
2. Run `manim-slides` on rendered animations and display them like a *Power Point* presentation.
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.
2. Run `manim-slides` on rendered animations and display them like a
*Power Point* presentation.

The documentation is available [online](https://eertmans.be/manim-slides/).

Expand Down Expand Up @@ -124,11 +145,15 @@ class BasicExample(Slide):
First, render the animation files:

```bash
manim example.py BasicExample
# or
manimgl example.py BasicExample
manim-slides render example.py BasicExample
# or use ManimGL
manim-slides render --GL example.py BasicExample
```

> [!NOTE]
> Using `manim-slides render` makes sure the use the `manim`
> (or `manimlib`) library that was installed in the Python same environment.
To start the presentation using `Scene1`, `Scene2` and so on simply run:

```bash
Expand Down Expand Up @@ -166,17 +191,24 @@ A default file can be created with:
manim-slides init
```

> **_NOTE:_** `manim-slides` uses key codes, which are platform dependent. Using the configuration wizard is therefore highly recommended.
> [!NOTE]
> `manim-slides` uses key codes, which are platform dependent.
> Therefore, sharing keys configuration files accross OSes or keyboards
> is not recommended. Instead, use default key-bindings, or generate
> a new config with `manim-slides wizard`.
## 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 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/)

## Other 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.
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.

Expand All @@ -185,7 +217,8 @@ Below is a small recording of me playing with the slides back and forth.

## Comparison with Similar Tools

There exists are variety of tools that allows to create slides presentations containing Manim animations.
There exists are variety of tools that allows to create slides presentations
containing Manim animations.

Below is a comparison of the most used ones with Manim Slides:

Expand All @@ -203,16 +236,21 @@ Below is a comparison of the most used ones with Manim Slides:

### 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.
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%:
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.
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)

in *Settings*->*Display*.

## 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

Expand Down
6 changes: 5 additions & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,19 @@
# https://www.sphinx-doc.org/en/master/usage/configuration.html

import sys
from datetime import date

from manim_slides import __version__

assert sys.version_info >= (3, 10), "Building docs requires Python 3.10"

# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

project = "Manim Slides"
copyright = "2023, Jérome Eertmans"
copyright = f"2024-{date.today().year}, Jérome Eertmans"
author = "Jérome Eertmans"
version = __version__

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
Expand Down
Loading

0 comments on commit 7a047ac

Please sign in to comment.