Skip to content

Commit

Permalink
Change project management tool from poetry to uv (#4138)
Browse files Browse the repository at this point in the history
* rewrite pyproject.toml to support uv; version upgrades of several dev dependencies

* codespellrc: poetry.lock -> uv.lock

* rewrite workflows, first attempt

* change name of pre-commit-hook

* dev-dependencies -> dependency-groups.dev

* lint + format

* Update .github/workflows/ci.yml

Co-authored-by: Aarush Deshpande <[email protected]>

* convert development.rst to myst markdown

* fix (most) docbuild warnings from theme upgrade

* development instructions: switch to uv, plus minor updates

* update entrypoint config in plugin docs + tests

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: Aarush Deshpande <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Feb 2, 2025
1 parent a6990bd commit 95fba7d
Show file tree
Hide file tree
Showing 13 changed files with 4,244 additions and 5,261 deletions.
2 changes: 1 addition & 1 deletion .codespellrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[codespell]
check-hidden = True
skip = .git,*.js,*.js.map,*.css,*.css.map,*.html,*.po,*.pot,poetry.lock,*.log,*.svg
skip = .git,*.js,*.js.map,*.css,*.css.map,*.html,*.po,*.pot,uv.lock,*.log,*.svg
ignore-words = .codespell_ignorewords
24 changes: 8 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,15 @@ jobs:
- name: Checkout the repository
uses: actions/checkout@v4

- name: Install Poetry
run: |
pipx install "poetry==1.8.*"
poetry config virtualenvs.prefer-active-python true
- name: Setup Python ${{ matrix.python }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
cache: "poetry"

- name: Setup macOS PATH
if: runner.os == 'macOS'
run: |
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true

- name: Setup cache variables
shell: bash
Expand Down Expand Up @@ -119,7 +113,6 @@ jobs:
shell: bash
run: |
echo "/Library/TeX/texbin" >> $GITHUB_PATH
echo "$HOME/.poetry/bin" >> $GITHUB_PATH
echo "$PWD/macos-cache/TinyTeX/bin/universal-darwin" >> $GITHUB_PATH
- name: Setup Windows cache
Expand Down Expand Up @@ -150,21 +143,20 @@ jobs:
if: runner.os == 'Windows'
run: |
$env:Path += ";" + "$($PWD)\ManimCache\LatexWindows\TinyTeX\bin\windows"
$env:Path = "$env:USERPROFILE\.poetry\bin;$($env:PATH)"
echo "$env:Path" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Install dependencies and manim
run: |
poetry install --all-extras
uv sync --all-extras --locked
- name: Run tests
run: |
poetry run python -m pytest
uv run python -m pytest
- name: Run module doctests
run: |
poetry run python -m pytest -v --cov-append --ignore-glob="*opengl*" --doctest-modules manim
uv run python -m pytest -v --cov-append --ignore-glob="*opengl*" --doctest-modules manim
- name: Run doctests in rst files
run: |
cd docs && poetry run make doctest O=-tskip-manim
cd docs && uv run make doctest O=-tskip-manim
26 changes: 13 additions & 13 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,28 @@ on:

jobs:
release:
name: "Publish release"
runs-on: ubuntu-latest
environment: release
permissions:
id-token: write

steps:
- uses: actions/checkout@v4

- name: Set up Python 3.11
- name: Set up Python 3.13
uses: actions/setup-python@v5
with:
python-version: 3.11

- name: Install dependencies
run: python -m pip install --upgrade poetry
python-version: 3.13

# TODO: Set PYPI_API_TOKEN to api token from pip in secrets
- name: Configure pypi credentials
env:
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
run: poetry config http-basic.pypi __token__ "$PYPI_API_TOKEN"
- name: Install uv
uses: astral-sh/setup-uv@v5

- name: Publish release to pypi
- name: Build and push release to PyPI
run: |
poetry publish --build
poetry build
uv sync
uv build
uv publish
- name: Store artifacts
uses: actions/upload-artifact@v4
Expand Down
12 changes: 7 additions & 5 deletions .github/workflows/release-publish-documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Set up Python 3.11
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.11
python-version: 3.13

- name: Install uv
uses: astral-sh/setup-uv@v5

- name: Install system dependencies
run: |
Expand All @@ -30,13 +33,12 @@ jobs:
babel-english ctex doublestroke dvisvgm frcursive fundus-calligra jknapltx \
mathastext microtype physics preview ragged2e relsize rsfs setspace standalone \
wasy wasysym
python -m pip install --upgrade poetry
poetry install
uv sync
- name: Build and package documentation
run: |
cd docs/
poetry run make html
uv run make html
cd build/html/
tar -czvf ../html-docs.tar.gz *
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ repos:
- id: mixed-line-ending
- id: end-of-file-fixer
- id: check-toml
name: Validate Poetry
name: Validate pyproject.toml
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.9.2
hooks:
Expand Down
1 change: 0 additions & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@
"source_repository": "https://github.com/ManimCommunity/manim/",
"source_branch": "main",
"source_directory": "docs/source/",
"top_of_page_button": None,
"light_logo": "manim-logo-sidebar.svg",
"dark_logo": "manim-logo-sidebar-dark.svg",
"light_css_variables": {
Expand Down
Loading

0 comments on commit 95fba7d

Please sign in to comment.