* feat: support multiple compilations
Allow `tex_compiler` to be a `str | list[str]` instead of just
`str`. When a list is given, document will be compiled sequentially.
* fix: suppress compilation progress log when only one compiler is used
* fix: updated docstrings and variable naming
Allows accessing edges via tuple keys like g[(1, 2)] in addition to
vertex lookups like g[1]. Previously only vertex lookups were supported.
FixesManimCommunity/manim#3798
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
* feat: add TypstMobject and TypstMathMobject for first-class Typst support
Implement the initial TypstMobject proposal (see agents/typst.md):
- TypstMobject: renders arbitrary Typst markup to SVG via the 'typst'
Python package (self-contained Rust binary, no system install needed),
then imports through SVGMobject.
- TypstMathMobject: convenience subclass that wraps input in Typst math
delimiters ($ ... $).
Pipeline: user string → wrap in minimal Typst document (auto-sized page,
transparent background) → write .typ file → compile to SVG via
typst.compile() → import via SVGMobject → scale/center/recolor.
Key details:
- Compilation helper in manim/utils/typst_file_writing.py with SHA-256
content-hash caching (same scheme as the LaTeX pipeline).
- font_size property mirrors SingleStringMathTex: compile at fixed 11pt,
scale after import using initial_height / SCALE_FACTOR_PER_FONT_POINT.
- init_colors() recolors black submobjects to self.color (Typst default
fill is black), preserving any explicit Typst colors.
- path_string_config enables curve subdivision for smooth animation.
- 'typst' added as optional dependency group in pyproject.toml.
- 10 tests covering creation, font_size, caching, preamble, and repr.
* feat(typst): add sub-expression selection via {{ }} groups and .select()
- Override modify_xml_tree in Typst to convert data-typst-label
attributes to id attributes before svgelements parsing (avoids
attribute inheritance issue with data-* attributes)
- Add Typst.select(key) method accepting str labels or int indices
to retrieve VGroup sub-expressions from id_to_vgroup_dict
- Implement {{ }} double-brace preprocessor on TypstMath:
- {{ content }} → manimgrp("_grp-N", content) (auto-numbered)
- {{ content : label }} → manimgrp("label", content) (named)
- Skips {{ }} inside string literals and [...] content blocks
- Uses math-mode call convention (no # prefix) to keep args in
math mode
- Auto-inject manimgrp preamble when groups are detected
- Add 12 new tests covering label mapping, nesting, select(),
error handling, and preprocessor edge cases
* Remove unneeded assert line
* Generalize some more critical hard-coded LaTeX assumptions
* Fix syntax error
* Support Typst labels in existing APIs
* Add ManimTextLabel typing alias
* Preserve Typst SVG stroke widths by default
* Calibrate Typst font sizing against TeX
* Add Typst mobject documentation
* Track Typst baseline frames
* Document Typst baseline frame tracking
* Add Typst section to text guide
* Polish Typst docs and label handling
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Improve Typst stroke scaling and docs examples
* Tune Typst SVG stroke scaling
* Restore Typst math example wording
* Fix pre-commit issues for Typst branch
* Fix number line runtime typing import
* Exclude Typst autogenerated .rst files
* Use Manim directive in docstrings and fix wrong key in Typst.select() docstring
* Fix GroupedMath comments
---------
Co-authored-by: Toon Verstraelen <Toon.Verstraelen@UGent.be>
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>
Co-authored-by: Francisco Manríquez Novoa <francisco.manriquezn@usm.cl>
GenericGraph.__getitem__ only handled vertex lookup. Passing a 2-tuple
(u, v) to retrieve an edge mobject raised a KeyError against the
vertices dict instead of looking up self.edges.
Route tuple keys of length 2 to self.edges so that g[(u, v)] returns
the edge mobject, consistent with how edges are stored internally.
Adds a test covering vertex lookup, edge lookup (Graph), and edge
lookup (DiGraph).
Fixes#3798
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
* Issue-4087 Add bug test
* Issue-4087 Fix bug
* Issue-4087 Fix comment and add type hint
* Issue-4087 Fix comment
* Issue-4087 Improve previous test instead of adding a new one
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update tests/module/mobject/mobject/test_mobject.py
* Enhance docstring for reduce_across_dimension method
Updated docstring for reduce_across_dimension method to clarify its purpose and parameters.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Remove float typehints for coords in length_over_dim
* Modify test for empty VMobject dimensions
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
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>
* Allow Swap to accept Group and VGroup and add example
* Modify create_target return type to Group | VGroup
Updated create_target method to allow returning either Group or VGroup.
---------
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
* Add type annotations to `transform_matching_parts.py`
* Make two type errors quiet
* Make the pytests pass
---------
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
* More specific Callable type annotations in mobject_update_utils
* [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>
* Add option to hide/show inner lines in Table class
* Add tests for Table class inner lines visibility
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Correct indentation
* Fix os.startfile usage to check for availability on Windows
* Add ConversationFlowScene to animate user-chatbot interactions and metadata display
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Revert "Merge remote-tracking branch 'origin/conversation' into hide_table_inner_lines"
This reverts commit c0ba5b8511, reversing
changes made to 1f71f4b0e8.
* Revert change
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Leonardo Cariaggi <leonardo.cariaggi@kbc.be>
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
* Add regression tests for four recent fixes in vectorized_mobject.py
Adds four regression tests for fixes that landed without tests in the same PR:
* 21cf9998 (PR #4630, fixes#3569 + #4629) -- IndexError in
`get_nth_subpath` when `path_list` is empty; ensure it always returns
a NumPy array.
* f6cdb547 (PR #4219) -- `add_points_as_corners` silently dropped a
single new point when called on a VMobject whose last subpath was
complete.
* 3d029c12 (PR #4320, fixes#4255) -- `pointwise_become_partial` cleared
the target's points when the source had no cubic curves, surfacing as
`Arrow3D.get_start()` / `get_end()` returning the origin after a
`Create` animation.
* 429f25328 (PR #4694) -- `scale(scale_stroke=True)` on a compound
VMobject propagated the parent's scaled stroke width to every
submobject, overwriting submobjects with their own (e.g. zero) stroke.
Each test reproduces the original failing condition at the unit level
and asserts the post-fix behavior. Validation: every test was confirmed
to fail when the corresponding fix is reverted on the source file, and
pass when the fix is restored.
4 tests, ~0.2s runtime. Tests go in the existing files
`tests/module/mobject/types/vectorized_mobject/test_vectorized_mobject.py`
(three tests, adjacent to their topically-related siblings) and
`tests/module/mobject/types/vectorized_mobject/test_stroke.py` (one test,
next to the existing `test_stroke_scale`).
Co-authored-by: LetMarq <LetMarq@users.noreply.github.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: THE-RAF <THE-RAF@users.noreply.github.com>
Co-authored-by: LetMarq <LetMarq@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>
* Add unit tests for module-level color helpers in manim/utils/color/core.py
Adds tests/module/utils/test_color_helpers.py covering the standalone
helper functions exported from manim.utils.color.core (color_to_rgb,
color_to_rgba, color_to_int_rgb, color_to_int_rgba, rgb_to_color,
rgba_to_color, rgb_to_hex, hex_to_rgb, invert_color, color_gradient,
interpolate_color, average_color, random_bright_color, random_color)
and the RandomColorGenerator class.
Before this PR, only the ManimColor class itself was tested
(via tests/module/utils/test_manim_color.py); the standalone helpers
had zero direct test coverage. Coverage on manim/utils/color/core.py
goes from 71% to 80% (line+branch), and 17 of the 18 testable symbols
in the file's __all__ are now exercised. The only deferred symbol is
get_shaded_rgb, which concerns lighting math rather than color
conversion and is better suited to a follow-up.
42 tests, ~0.3s runtime, no new dependencies.
Co-authored-by: LetMarq <LetMarq@users.noreply.github.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update tests/module/utils/test_color_helpers.py
Increased assertion scheme to cover all colors.
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
---------
Co-authored-by: THE-RAF <THE-RAF@users.noreply.github.com>
Co-authored-by: LetMarq <LetMarq@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>
* fix: preserve geometry in put_start_and_end_on for zero-vector mobjects
* fix: preserve geometry in put_start_and_end_on for zero-vector mobjects
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* fixed asser_array_equal line
* removed commets in mobject.py and opengl_mobject.py as suggested
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* added stacklevel=2 suggestion
---------
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>
Includes the changes from PRs #4666, #4668, #4669, #4670, and #4671.
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
* fix#3569 and #4629
* Add changes to opengl_vectorized_mobject.py
---------
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
* Made the document changes
* added additional example
* Apply some suggestions from code review
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
* Shorten sphere examples
* Fix line breaks and remove trailing whitespace
* Add example for showing portions of spheres
* Undo accidental overwrite of ExampleSphereOverlap
* Change name of manim code block
---------
Co-authored-by: Xiuyuan <u7678992@anu.edu.au>
Co-authored-by: TahitiX <136950383+TahitiX@users.noreply.github.com>
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
Co-authored-by: Francisco Manríquez Novoa <francisco.manriquezn@usm.cl>
* Add type annotations to `mobject.py`
* More work on type annotations for mobject.py
* ...
* Almost handled all mypy errors
* Add the mypy error messages to the lines that trigger them
* Use typing.cast to avoid some mypy errors, as suggested by JasonGrace2282
* Used the ruff linter
* Fixed one typing issue and added the error descriptions to the source code for the remaning 10 errors
* Set the type of the elements in a VGroup to VMobject
* Use typing.cast to handle some specific cases.
* Code cleaning
* Updates
* When started to use typing.cast it is needed to import / define certain elements during runtime and not only during type checking
* Fix bug introduced with the type annotations.
* Made it work again
* ..
* Fixed more issues.
* Code cleanup
* Code cleanup.
Replace self.lines with self.lines_chars and self.lines_alignment.
* Handle slicing when accessing elements inside a VGroup
* Fix missing issues.
* Silence the last mypy error
* Make _Updater, _NonTimeBasedUpdater and _TimeBasedUpdater private.
* Replace | with Union[...] in one location
* Move import of Union
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Remove comment that is no longer relevant
* Overload the auto_zoom method in MovingCamera to provide better type hinting
* Codecleanup
* Code cleanup
* Renamed lines_alignment to lines_alignments and added a TODO about a future cleanup task
* More code cleanup
* Update manim/mobject/matrix.py
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Addressing multiple comments from Chopan50
* Implementing more suggestions from Chopan50
* More suggestions by Chopan50
* ...
* More renaming and code cleanup, as suggested by Chopan50
* Restructure code
* anim_args
* Update typing in vector_space_scene
* Implemented a number of suggestions from chopan50
* Make a list of faces with the type list[ThreeDVMobject]
* Ensure to return a VGroup if slicing is used.
* Revert back to the original code in text_mobject.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Add the propagate_colors option to Mobject as it is used by VMobject.
Replace Self with _UpdateBuilder
* Simplify code
---------
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 quotes to Vector3D and to Point3D to match other calls to `cast`, such has Chopan suggested
Issue #4550: https://github.com/ManimCommunity/manim/issues/4550
Co-authored-by: Colin Belhomme <colin.belhomme@telecom-paris.fr>
* Fix unintended kwargs propagation in LaggedStartMap
Ensure intended for are not forwarded to the superclass, and make explicit.
* add test for keyword propagation in LaggedStartMap
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update test_composition.py
update the test
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update test_composition.py
add there_and_back
---------
Co-authored-by: Benjamin Hackl <mail@behackl.dev>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Stop ignoring manim._config erros in mypy.ini
* Aspect ratio should be a float.
* Handled more mypy issues in _config/utils.py
* Handled more mypy issues in _config/utils.py
* Removed two assert statements that triggered errors in the unittests.
* Fix last mypy issue in utils.py and activate mypy checking
* Fix type of window_size in opengl_renderer_window.py
* ...
---------
Co-authored-by: F. Muenkel <25496279+fmuenkel@users.noreply.github.com>
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
* 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>
* Add support for negative z-index in AnimationGroup
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Refactor animation unpacking logic for clarity
* Fix unpacking logic to handle Mobject instances correctly
* Fix mypy check
* Fix tests
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* fix: simplify AnimationGroup unpacking for moving mobjects
---------
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>