Skip to content

Commit

Permalink
chore(ci): from Rye to uv
Browse files Browse the repository at this point in the history
uv is just better for what I need to do, and Rye will eventually be replaced by uv anyway
  • Loading branch information
jeertmans committed Sep 24, 2024
1 parent 6ad89ec commit 3dbcf29
Show file tree
Hide file tree
Showing 12 changed files with 3,569 additions and 915 deletions.
15 changes: 5 additions & 10 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,13 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Rye
env:
RYE_INSTALL_OPTION: --yes
run: |
curl -sSf https://rye.astral.sh/get | bash
echo "$HOME/.rye/shims" >> $GITHUB_PATH
- name: Configure Rye
run: rye config --set-bool behavior.use-uv=true
- name: Setup uv
uses: astral-sh/setup-uv@v2
with:
enable-cache: true

- name: Build package
run: rye build
run: uv build

- name: Publish to PyPI
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
Expand Down
34 changes: 8 additions & 26 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,29 +69,13 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Rye
if: matrix.os != 'windows-latest'
env:
RYE_TOOLCHAIN_VERSION: ${{ matrix.pyversion}}
RYE_INSTALL_OPTION: --yes
run: |
curl -sSf https://rye.astral.sh/get | bash
echo "$HOME/.rye/shims" >> $GITHUB_PATH
# Stolen from https://github.com/bluss/pyproject-local-kernel/blob/2b641290694adc998fb6bceea58d3737523a68b7/.github/workflows/ci.yaml
- name: Install Rye (Windows)
if: matrix.os == 'windows-latest'
shell: bash
run: |
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
./rye-x86_64-windows.exe self install --toolchain-version ${{ matrix.pyversion }} --modify-path -y
echo "$HOME\\.rye\\shims" >> $GITHUB_PATH
- name: Setup uv
uses: astral-sh/setup-uv@v2
with:
enable-cache: true

- name: Configure Rye
shell: bash
run: |
rye config --set-bool behavior.use-uv=true
rye pin ${{ matrix.pyversion }}
- name: Setup Python ${{ matrix.pyversion }}
run: uv python install ${{ matrix.pyversion }}

- name: Install manim dependencies on MacOS
if: matrix.os == 'macos-latest'
Expand All @@ -113,12 +97,10 @@ jobs:
uses: ssciwr/setup-mesa-dist-win@v2

- name: Install Manim Slides
shell: bash
run: rye sync
run: uv sync

- name: Run pytest
shell: bash
run: rye run pytest
run: uv run pytest

- name: Upload to codecov.io
uses: codecov/codecov-action@v4
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ __pycache__/
/build
/dist
*.egg-info/
.pdm-python

# Manim files
images/
Expand Down
4 changes: 0 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ repos:
- id: pretty-format-toml
exclude: poetry.lock
args: [--autofix, --trailing-commas]
- repo: https://github.com/keewis/blackdoc
rev: v0.3.9
hooks:
- id: blackdoc
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.7
hooks:
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
[#467](https://github.com/jeertmans/manim-slides/pull/467)
- Documented potential fix for PPTX issue.
[#475](https://github.com/jeertmans/manim-slides/pull/475)
- Changed project manager from Rye to uv.
[#476](https://github.com/jeertmans/manim-slides/pull/476)

(unreleased-fixed)=
### Fixed
Expand Down
21 changes: 13 additions & 8 deletions docs/source/contributing/workflow.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,25 +24,30 @@ the repository, and clone it locally.

As for every Python project, using virtual environment is recommended to avoid
conflicts between modules.
For this project, we use [Rye](https://rye.astral.sh/) to easily manage project
For this project, we use [uv](https://github.com/astral-sh/uv) to easily manage project
and development dependencies. If not already, please install this tool.

## Installing Python modules

With Rye, installation becomes straightforward:
With uv, installation becomes straightforward:

```bash
rye sync --all-features
uv sync --all-extras
```

:::{note}
You still need the same dependencies as to install Manim and ManimGL,
so please check their respective installation guides.
:::

## Running commands

Because modules are installed in a new Python environment,
you cannot use them directly in the shell.
Instead, you either need to prepend `rye run` to any command, e.g.:
Instead, you either need to prepend `uv run` to any command, e.g.:

```bash
rye run manim-slides wizard
uv run manim-slides wizard
```

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

```bash
rye run pre-commit run --all-files
uv run pre-commit run --all-files
```

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

```bash
rye run pytest
uv run pytest
```

## Building the documentation
Expand All @@ -73,7 +78,7 @@ To generate the documentation, run the following:

```bash
cd docs
rye run make html
uv run make html
```

Then, the output index file is located at `docs/build/html/index.html` and
Expand Down
7 changes: 2 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ search = "<!-- start changelog -->"
builtin = "clear,rare,informal,usage,names,en-GB_to_en-US"
check-hidden = true
ignore-words-list = "master"
skip = "requirements.lock,requirements-dev.lock"
skip = "uv.lock"

[tool.coverage.report]
exclude_lines = [
Expand Down Expand Up @@ -220,15 +220,12 @@ isort = {known-first-party = ["manim_slides", "tests"]}
"docs/source/reference/magic_example.ipynb" = ["F403", "F405"]
"tests/test_slide.py" = ["N801"]

[tool.rye]
[tool.uv]
dev-dependencies = [
"bump-my-version>=0.20.3",
"pre-commit>=3.5.0",
"setuptools>=73.0.1",
]
managed = true

[tool.uv]
override-dependencies = [
# Bypass constraints from ManimGL
"manimpango>=0.5.0,<1.0.0",
Expand Down
Loading

0 comments on commit 3dbcf29

Please sign in to comment.