Skip to content

Commit d5d1513

Browse files
chore(dev): move to Rye instead of PDM (#420)
* test: re-add opencv-python * chore(dev): move to Rye instead of PDM * try fix * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix: build backend * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix: string quotes? * small fixes * upgrade typing * fix(ci): rye install on Windows * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix(ci): typos * fix * fix(ci): actually use right python version * fix(deps): manimgl * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix docs * another fix * cleanup * make sure to use trusted publisher * chore(docs): remove PDM --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent bd04dae commit d5d1513

31 files changed

+965
-3677
lines changed

.github/workflows/publish.yml

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,22 @@ jobs:
1818
- name: Checkout repository
1919
uses: actions/checkout@v4
2020

21-
- name: Install PDM
22-
uses: pdm-project/setup-pdm@v4
23-
with:
24-
python-version: '3.10'
25-
cache: true
21+
- name: Setup Rye
22+
env:
23+
RYE_INSTALL_OPTION: --yes
24+
run: |
25+
curl -sSf https://rye-up.com/get | bash
26+
echo "$HOME/.rye/shims" >> $GITHUB_PATH
27+
28+
- name: Configure Rye
29+
run: rye config --set-bool behavior.use-uv=true
30+
31+
- name: Build package
32+
run: rye build
2633

2734
- name: Publish to PyPI
2835
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
29-
run: pdm publish
36+
uses: pypa/gh-action-pypi-publish@release/v1
3037

3138
publish-docker:
3239
name: Publish Docker image

.github/workflows/tests.yml

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -25,28 +25,30 @@ jobs:
2525
- name: Checkout repository
2626
uses: actions/checkout@v4
2727

28-
- name: Install PDM
29-
uses: pdm-project/setup-pdm@v4
30-
with:
31-
python-version: ${{ matrix.pyversion }}
32-
cache: true
33-
34-
# Path related stuff
35-
- name: Append to Path on MacOS
36-
if: matrix.os == 'macos-latest'
28+
- name: Setup Rye
29+
if: matrix.os != 'windows-latest'
30+
env:
31+
RYE_TOOLCHAIN_VERSION: ${{ matrix.pyversion}}
32+
RYE_INSTALL_OPTION: --yes
3733
run: |
38-
echo "${HOME}/.local/bin" >> $GITHUB_PATH
39-
echo "/Users/runner/Library/Python/${{ matrix.pyversion }}/bin" >> $GITHUB_PATH
40-
41-
- name: Append to Path on Ubuntu
42-
if: matrix.os == 'ubuntu-latest'
43-
run: echo "${HOME}/.local/bin" >> $GITHUB_PATH
34+
curl -sSf https://rye-up.com/get | bash
35+
echo "$HOME/.rye/shims" >> $GITHUB_PATH
4436
45-
- name: Append to Path on Windows
37+
# Stolen from https://github.com/bluss/pyproject-local-kernel/blob/2b641290694adc998fb6bceea58d3737523a68b7/.github/workflows/ci.yaml
38+
- name: Install Rye (Windows)
4639
if: matrix.os == 'windows-latest'
47-
run: echo "${HOME}/.local/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
40+
shell: bash
41+
run: |
42+
C:/msys64/usr/bin/wget.exe -q 'https://github.com/astral-sh/rye/releases/latest/download/rye-x86_64-windows.exe' -O rye-x86_64-windows.exe
43+
./rye-x86_64-windows.exe self install --toolchain-version ${{ matrix.pyversion }} --modify-path -y
44+
echo "$HOME\\.rye\\shims" >> $GITHUB_PATH
45+
46+
- name: Configure Rye
47+
shell: bash
48+
run: |
49+
rye config --set-bool behavior.use-uv=true
50+
rye pin ${{ matrix.pyversion }}
4851
49-
# OS dependencies
5052
- name: Install manim dependencies on MacOS
5153
if: matrix.os == 'macos-latest'
5254
run: brew install ffmpeg py3cairo
@@ -68,16 +70,17 @@ jobs:
6870
uses: ssciwr/setup-mesa-dist-win@v2
6971

7072
- name: Install Manim Slides
71-
run: |
72-
pdm sync -Ggithub-action -Gtest
73+
shell: bash
74+
run: rye sync
7375

7476
- name: Run pytest
77+
shell: bash
7578
if: matrix.os != 'ubuntu-latest' || matrix.pyversion != '3.11'
76-
run: pdm run pytest
79+
run: rye run pytest
7780

7881
- name: Run pytest and coverage
7982
if: matrix.os == 'ubuntu-latest' && matrix.pyversion == '3.11'
80-
run: pdm run pytest --cov-report xml --cov=manim_slides tests/
83+
run: rye run pytest --cov-report xml --cov=manim_slides tests/
8184

8285
- name: Upload to codecov.io
8386
if: matrix.os == 'ubuntu-latest' && matrix.pyversion == '3.11'

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.11.8

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1717
[#417](https://github.com/jeertmans/manim-slides/pull/417)
1818
- Create FAQ page and clear FAQ from README.md.
1919
[#418](https://github.com/jeertmans/manim-slides/pull/418)
20+
- Used Rye instead of PDM for faster development.
21+
[#420](https://github.com/jeertmans/manim-slides/pull/420)
2022

2123
(unreleased-fixed)=
2224
### Fixed

docs/source/contributing/workflow.md

Lines changed: 8 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -24,61 +24,25 @@ the repository, and clone it locally.
2424

2525
As for every Python project, using virtual environment is recommended to avoid
2626
conflicts between modules.
27-
For this project, we use [PDM](https://pdm-project.org/) to easily manage project
27+
For this project, we use [Rye](https://rye-up.com/) to easily manage project
2828
and development dependencies. If not already, please install this tool.
2929

3030
## Installing Python modules
3131

32-
With PDM, installation becomes straightforward:
32+
With Rye, installation becomes straightforward:
3333

3434
```bash
35-
pdm install
35+
rye sync --all-features
3636
```
3737

38-
This, however, only installs the minimal set of dependencies to run the package.
39-
40-
If you would like to install Manim or ManimGL,
41-
as documented in the [quickstart](/quickstart),
42-
you can use the `-G|--group` option:
43-
44-
```bash
45-
pdm install -Gmanim # For Manim
46-
# or
47-
pdm install -Gmanimgl # For ManimGL
48-
```
49-
50-
Additionally, Manim Slides comes with groups of dependencies for development purposes:
51-
52-
```bash
53-
pdm install -Gdev # For linters and formatters
54-
# or
55-
pdm install -Gdocs # To build the documentation locally
56-
# or
57-
pdm install -Gtest # To run tests
58-
```
59-
60-
:::{note}
61-
You can combine any number of groups or extras when installing the package locally.
62-
63-
You can also install everything with `pdm install -G:all`.
64-
:::
65-
6638
## Running commands
6739

6840
Because modules are installed in a new Python environment,
6941
you cannot use them directly in the shell.
70-
Instead, you either need to prepend `pdm run` to any command, e.g.:
71-
72-
```bash
73-
pdm run manim-slides wizard
74-
```
75-
76-
or [enter a new shell](https://pdm-project.org/latest/usage/venv/#activate-a-virtualenv)
77-
that uses this new Python environment:
42+
Instead, you either need to prepend `rye run` to any command, e.g.:
7843

7944
```bash
80-
eval $(pdm venv activate) # Click on the link above to see shell-specific command
81-
manim-slides wizard
45+
rye run manim-slides wizard
8246
```
8347

8448
## Testing your code
@@ -87,7 +51,7 @@ Most of the tests are done with GitHub actions, thus not on your computer.
8751
The only command you should run locally is:
8852

8953
```bash
90-
pdm run pre-commit run --all-files
54+
rye run pre-commit run --all-files
9155
```
9256

9357
This runs a few linter and formatter to make sure the code quality and style stay
@@ -97,7 +61,7 @@ If a warning or an error is displayed, please fix it before going to next step.
9761
For testing your code, simply run:
9862

9963
```bash
100-
pdm run pytest
64+
rye run pytest
10165
```
10266

10367
## Building the documentation
@@ -109,7 +73,7 @@ To generate the documentation, run the following:
10973

11074
```bash
11175
cd docs
112-
pdm run make html
76+
rye run make html
11377
```
11478

11579
Then, the output index file is located at `docs/build/html/index.html` and

docs/source/installation.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,9 @@ Along with the optional dependencies for Manim and ManimGL,
106106
Manim Slides offers additional *extras*, that can be activated
107107
using optional dependencies:
108108

109-
- `full`, to include `magic`, `manim`, `manimgl`, and
109+
- `full`, to include `magic`, `manim`, and
110+
`sphinx-directive` extras (see below);
111+
- `full-gl`, to include `magic`, `manimgl`, and
110112
`sphinx-directive` extras (see below);
111113
- `magic`, to include a Jupyter magic to render
112114
animations inside notebooks. This automatically installs `manim`,

docs/source/manim_or_manimgl.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ the slides.
1515
If both modules are present in {py:data}`sys.modules`, then Manim Slides will
1616
prefer using `manim`.
1717

18-
1918
### Usage
2019

2120
The simplest way to use Manim Slides with the correct Manim API is to:

docs/source/reference/magic_example.ipynb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"outputs": [],
1919
"source": [
2020
"from manim import *\n",
21+
"\n",
2122
"from manim_slides import *"
2223
]
2324
},

manim_slides/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def __getattr__(self, name: str) -> Any:
2929

3030
return ModuleType.__getattribute__(self, name)
3131

32-
def __dir__(self) -> List[str]:
32+
def __dir__(self) -> list[str]:
3333
result = list(new_module.__all__)
3434
result.extend(
3535
(

manim_slides/config.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from inspect import Parameter, signature
55
from pathlib import Path
66
from textwrap import dedent
7-
from typing import Any, Callable, Dict, List, Optional, Set, Tuple
7+
from typing import Any, Callable, Optional
88

99
import rtoml
1010
from pydantic import (
@@ -24,7 +24,7 @@
2424

2525

2626
class Signal(BaseModel): # type: ignore[misc]
27-
__receivers: List[Receiver] = PrivateAttr(default_factory=list)
27+
__receivers: list[Receiver] = PrivateAttr(default_factory=list)
2828

2929
def connect(self, receiver: Receiver) -> None:
3030
self.__receivers.append(receiver)
@@ -47,14 +47,14 @@ def key_id(name: str) -> PositiveInt:
4747
class Key(BaseModel): # type: ignore[misc]
4848
"""Represents a list of key codes, with optionally a name."""
4949

50-
ids: List[PositiveInt] = Field(unique=True)
50+
ids: list[PositiveInt] = Field(unique=True)
5151
name: Optional[str] = None
5252

5353
__signal: Signal = PrivateAttr(default_factory=Signal)
5454

5555
@field_validator("ids")
5656
@classmethod
57-
def ids_is_non_empty_set(cls, ids: Set[Any]) -> Set[Any]:
57+
def ids_is_non_empty_set(cls, ids: set[Any]) -> set[Any]:
5858
if len(ids) <= 0:
5959
raise ValueError("Key's ids must be a non-empty set")
6060
return ids
@@ -98,8 +98,8 @@ class Keys(BaseModel): # type: ignore[misc]
9898

9999
@model_validator(mode="before")
100100
@classmethod
101-
def ids_are_unique_across_keys(cls, values: Dict[str, Key]) -> Dict[str, Key]:
102-
ids: Set[int] = set()
101+
def ids_are_unique_across_keys(cls, values: dict[str, Key]) -> dict[str, Key]:
102+
ids: set[int] = set()
103103

104104
for key in values.values():
105105
if len(ids.intersection(key["ids"])) != 0:
@@ -296,8 +296,8 @@ def from_pre_slide_config_and_files(
296296

297297

298298
class PresentationConfig(BaseModel): # type: ignore[misc]
299-
slides: List[SlideConfig] = Field(min_length=1)
300-
resolution: Tuple[PositiveInt, PositiveInt] = (1920, 1080)
299+
slides: list[SlideConfig] = Field(min_length=1)
300+
resolution: tuple[PositiveInt, PositiveInt] = (1920, 1080)
301301
background_color: Color = "black"
302302

303303
@classmethod

0 commit comments

Comments
 (0)