* docker: add libgl1 runtime dependency for OpenGL
* docker: tighten .dockerignore for smaller build context
* docs(docker): add runtime notes for latest image
* docs(docker): note ctex is not included by default
---------
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
* fix: replace double-brace splitting regex with state-machine parser
The previous re.split(r'{{|}}', ...) call split on any occurrence of
{{ or }} in the input string, which broke strings whose only }} came
from closing two nested LaTeX brace groups (e.g. ^{\frac{Mq}{M+m}}).
The new _split_double_braces() static method uses a character-level
state machine with three guards:
* Escape priority: \\ is consumed before \{ / \}, so \\}} is
correctly read as an escaped backslash followed by a real }}, not
misinterpreted as \ + \} + lone }.
* Whitespace-gated opener: {{ is only treated as a Manim group opener
at the start of the string or after whitespace. Naturally-occurring
{{ in LaTeX is usually preceded by non-whitespace (e.g. \frac{{{n}}}
or a^{{2}}), so this eliminates the most common false positives.
* Depth-tracking closer: inside a Manim group, }} only closes the
group when the inner brace depth is zero, so {{ a^{b^{c}} }} is
handled correctly and nested LaTeX }} cannot trigger an early close.
Fixes#4601.
* docs: document double-brace whitespace requirement
Add a Notes section to the MathTex docstring explaining:
- how {{ }} splits a string into submobjects
- that {{ must be at start-of-string or preceded by whitespace
- that this leaves natural LaTeX like \frac{{{n}}}{k} untouched
- the { { ... } } escape hatch when a split is not wanted
Apply the same explanation to the double-brace paragraph in
docs/source/guides/using_text.rst.
* fix: use r-string for _split_double_braces docstring, halve backslash escaping
* fix: resolve parameter shadowing bug in release script changelog command
* chore: bump version to v0.20.0, regenerate lockfile, update citation
* generate v0.20.0 changelog, first round
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* a bit of copyediting, second pass
* include newly merged PR, apply suggestions from review
* Update docs/source/changelog/0.20.0-changelog.md
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
* Extracted the method get_mob_from_shape_element
* Moved more functionality to get_mob_from_shape_element
* More cleanup
* Parse the svg file while maintaining the group structure.
* Make the svg groups available
* Handle PERF401 issue
* [pre-commit.ci] pre-commit autoupdate (#4506)
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.14.7 → v0.14.8](https://github.com/astral-sh/ruff-pre-commit/compare/v0.14.7...v0.14.8)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Added an example of the issue
* Experimenting with coloring elements from the latex equation
* ...
* Regular expression can now match more than one object
* Process the string by applying the substrings in the order they match
* Code refactoring and added type annotations
* ...
* Added a lot of test cases
* More examples
* More examples
* Use matched_strings_and_ids to simplify existing methods
* Remove unused code
* Update get_part_by_tex to use matched_strings_and_ids
* This is required for test_MathTable to pass
* Ensure that self.texstring is set.
* Added more examples from exising issues in the github repo
* Ensure that latex groups are maintained by adding an additional pair of curly braces around the extracted part
* ExampleScene -> Scene
* Added comment
* _break_up_by_substrings
* Refactor code
* Added comment to example
* Handle integer inputs well.
* Expose the original tex_string
* Do not treat the content of substrings_to_isolate as regular expressions.
* Updated examples
* Update examples
* Fix SVMobject caching issue.
* Remove traces from brace_notation_split_occurred
* Simplify MathTex::_break_up_by_substrings
* Fix small issue in tex that in some cases moved elements a tiny bit around
* No use of regular expressions for locate substrings.
* Updated notes to the set of test cases
* Handle issues with the center environment.
* Add example
* Fix issue with rectangles (e.g. from sqrt)
* ConvertToOpenGL
* Reduce the number of nesting levels.
* Use the specified arg_seperator
* Deal with the double curly brace markup
* Code cleanup
* Code cleanup
* Rollback a few changes
* Code cleanup
* Adjust paths the generated artefacts in tests that rely on MathTex
* Added a remark to the using text guide on enclosing snippets in curly braces for substrings_to_isolate to work
* Added space around the numerator argument to frac to avoid having double curly braces in the example.
This would otherwise trigger MathTex to split the string at that location.
* Log errors properly and display some information about the errors and their context.
* Code refactoring as suggested by Benjamin
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
* Set the default python version to 3.13 in the uv installation guide.
* Capitalize Python
---------
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
* edit: added the descriptions to /docs/source/index.rst
* apply suggestions from review
---------
Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
* Add classes MethodWithArgs, SceneInteractRerun and SceneInteractExit
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Add missing manim.data_structures file
* Rename SceneInteractExit to SceneInteractContinue and use dataclasses
* Revert using @dataclass(slots=True), because Python 3.9 does not support it
* Change order of dataclasses
* Add references to Scene.queue in docstrings
* Include data_structures in utilities_misc.rst
* Use qualified names and mark strings as code in data_structures.py
* Add module docstring to data_structures.py
* Move Scene.interact() objects from data_structures.py into scene.py
* Use qualified name in SceneInteractAction docstring
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* 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 <110117391+JasonGrace2282@users.noreply.github.com>
* 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 <110117391+JasonGrace2282@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Fix link formatting and clarify the distinction between Manim versions
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Update readme to properly credit Grant Sanderson and revise dismissive language
* Adjust readme and add landing-page mention about Grant's Manim
* Apply suggestions from code review
---------
Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
Follow-up to #3501
This commit combines all the installation documentation onto one page, and switches to recommending the usage
of `uv` for installing Manim.
* Implement SurroundingRectangle.multiple and BackgroundRectangle.multiple
* Integrate SurroundingRectangle constructor for multiple objects into __init__
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* SurroundingRectangle now takes multiple Mobjects as positional args
* Add tests for multiple Mobjects in SurroundingRectangle
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fix example that was not using keyword args for SurroundingRectangle
* Remove duplicate code from BackgroundRectangle
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Add typing to manim argument of SurroundingRecrabgle constructor
Co-authored-by: Aarush Deshpande <110117391+JasonGrace2282@users.noreply.github.com>
* Remove redundant argument from test_SurroundingRectangle
Co-authored-by: Aarush Deshpande <110117391+JasonGrace2282@users.noreply.github.com>
* Remove type check from SurroundingRectangle
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fix missing line issue
* resolve merge conflict
* Fix Group import
* Move Group import into the body of SurroundingRectangle
* Return type checking to SurroundingRectangle
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* small change to error message
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* fix missing imports
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Aarush Deshpande <110117391+JasonGrace2282@users.noreply.github.com>
Co-authored-by: JasonGrace2282 <aarush.deshpande@gmail.com>
* pyproject
* Autofixes from pre-commit
* use get over get(x, None)
Co-authored-by: Victorien <65306057+Viicos@users.noreply.github.com>
---------
Co-authored-by: Victorien <65306057+Viicos@users.noreply.github.com>
* Update macos.rst
As of July/2024, brew installs Manim and its dependencies.
Guideline for installing dependencies with brew, and attempt to install using pip3 will no longer work either venv or not.
Now homebrew team manages python resources as "System-wide" only with Brew installed resources.
Hence, to give first time installer just leave a single line install command would be the simplest option we have.
* Update docs/source/installation/macos.rst
---------
Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
* docs: add manim.typing guide
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Add colors
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Add another example for when to typehint as Vector
* Add docs for images+functions
* write Beziers
* Improve based on feedback
* type -> Type
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
* added av as a dependency
* make partial movie files use av instead of piping to external ffmpeg
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* opengl rendering: use av for movie files
* no need to check for ffmpeg executable
* refactor: *_movie_pipe -> *_partial_movie_stream
* improve (oneline) documentation
* pass more options to partial movie file rendering
* move ffmpeg verbosity settings to config; renamed option dict
* replaced call to ffmpeg in combine_files by using av
Co-authored-by: Jérome Eertmans <jeertmans@icloud.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* there was one examples saved as a gif?
* chore(deps): re-order av
* chore(lib): simplify `write_frame` method
Reduces the overall code complexity
* chore(lib): add audio
* fix(lib): same issue for conversion
* fix(lib): webm export
* fix(lib): transparent export
Though the output video is weird
* try(lib): fix gif + TODOs
* chore(deps): lower dep crit
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* feat(lib): add support for GIF
* fix(ci): rewrite tests
* fix
* chore(ci): prevent calling concat on empty list
* add missing dot
* fix(ci): update frame comparison ?
* fix(log): add handler to libav logger
* chore: add TODO
* fix(lib): concat issue
* Revert "fix(ci): update frame comparison ?"
This reverts commit 904cfb46ae.
* fix(ci): make it pass tests
* chore(lib/docs/ci): remove FFMPEG entirely
This removes any reference to FFMPEG, except in translation files
* added av as a dependency
* make partial movie files use av instead of piping to external ffmpeg
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* opengl rendering: use av for movie files
* no need to check for ffmpeg executable
* refactor: *_movie_pipe -> *_partial_movie_stream
* improve (oneline) documentation
* pass more options to partial movie file rendering
* move ffmpeg verbosity settings to config; renamed option dict
* replaced call to ffmpeg in combine_files by using av
Co-authored-by: Jérome Eertmans <jeertmans@icloud.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* there was one examples saved as a gif?
* chore(deps): re-order av
* chore(lib): simplify `write_frame` method
Reduces the overall code complexity
* chore(lib): add audio
* fix(lib): same issue for conversion
* fix(lib): webm export
* fix(lib): transparent export
Though the output video is weird
* try(lib): fix gif + TODOs
* chore(deps): lower dep crit
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* feat(lib): add support for GIF
* fix(ci): rewrite tests
* fix
* chore(ci): prevent calling concat on empty list
* add missing dot
* fix(ci): update frame comparison ?
* fix(log): add handler to libav logger
* chore: add TODO
* fix(lib): concat issue
* Revert "fix(ci): update frame comparison ?"
This reverts commit 904cfb46ae.
* fix(ci): make it pass tests
* chore(lib/docs/ci): remove FFMPEG entirely
This removes any reference to FFMPEG, except in translation files
* chore(deps): update lockfile
* chore(lib): rewrite ffprobe
* fix typo
* slightly more aggressive removal of ffmpeg in docs; minor language changes
* fix gif output stream dimensions
* minor style change
* fix encoding of (transparent) mov files
* fixed metadata / comment
* set frame rate for --format=gif in output_stream
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* more video tests for different render settings, also test pix_fmt
* improve default bitrate setting via crf
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* parametrized format/transparency rendering test
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* context managers for (some) av.open
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update manim/utils/commands.py
Co-authored-by: Jérome Eertmans <jeertmans@icloud.com>
* fixed segfault
* update test data involving implicit functions (output improved!)
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* explicity set pix_fmt for transparent webms
* special-special case extracting frame from vp9-encoded file with transparency
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* fix transparent gifs, more special casing in parametrized video format test
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* run tests on macos-latest again
* removed old control data
* Revert "run tests on macos-latest again"
This reverts commit f50efa4b88.
* added sound to codec test; fixed issue with sound track in gif (disabled) and webm (now via opus)
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* manual wav -> ogg transcoding
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* fixed f-string
* refactored codec test, split out gif
* check for non-zero audio samples
* more cleanup
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* remove ffmpeg from readthedocs apt_packages
* round up run_time if positive and shorter than current frame rate
* added more run_time tests
* black
* improve implementation of test
* removed some unused imports
* improve wording of logged warning
Co-authored-by: Jérome Eertmans <jeertmans@icloud.com>
* move run_time checks from Animation.begin to Scene.get_run_time
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* remove unused import
* flake: PT012
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Jérome Eertmans <jeertmans@icloud.com>
* Update typing guidelines
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* fix formatting
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Remove call to deprecated `pkg_resources`
* Remove support for dynamic plugin imports, update plugin utilities
* fix affected tests
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* more fixes
* Last fix
* Fix import
* Update docs
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Jason Villanueva <a@jsonvillanueva.com>