manim 0.18.0.post0__py3-none-any.whl → 0.19.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of manim might be problematic. Click here for more details.
- manim/__init__.py +3 -6
- manim/__main__.py +61 -20
- manim/_config/__init__.py +6 -3
- manim/_config/cli_colors.py +16 -8
- manim/_config/default.cfg +1 -3
- manim/_config/logger_utils.py +14 -8
- manim/_config/utils.py +651 -472
- manim/animation/animation.py +152 -5
- manim/animation/composition.py +80 -39
- manim/animation/creation.py +196 -14
- manim/animation/fading.py +5 -9
- manim/animation/indication.py +103 -47
- manim/animation/movement.py +22 -5
- manim/animation/rotation.py +3 -2
- manim/animation/specialized.py +4 -6
- manim/animation/speedmodifier.py +10 -5
- manim/animation/transform.py +4 -5
- manim/animation/transform_matching_parts.py +1 -1
- manim/animation/updaters/mobject_update_utils.py +17 -14
- manim/camera/camera.py +15 -6
- manim/cli/__init__.py +17 -0
- manim/cli/cfg/group.py +70 -44
- manim/cli/checkhealth/checks.py +93 -75
- manim/cli/checkhealth/commands.py +14 -5
- manim/cli/default_group.py +157 -25
- manim/cli/init/commands.py +32 -24
- manim/cli/plugins/commands.py +16 -3
- manim/cli/render/commands.py +72 -60
- manim/cli/render/ease_of_access_options.py +4 -3
- manim/cli/render/global_options.py +51 -15
- manim/cli/render/output_options.py +6 -5
- manim/cli/render/render_options.py +97 -32
- manim/constants.py +65 -19
- manim/gui/gui.py +2 -0
- manim/mobject/frame.py +0 -1
- manim/mobject/geometry/arc.py +112 -78
- manim/mobject/geometry/boolean_ops.py +32 -25
- manim/mobject/geometry/labeled.py +300 -77
- manim/mobject/geometry/line.py +132 -64
- manim/mobject/geometry/polygram.py +126 -30
- manim/mobject/geometry/shape_matchers.py +35 -15
- manim/mobject/geometry/tips.py +38 -29
- manim/mobject/graph.py +414 -133
- manim/mobject/graphing/coordinate_systems.py +126 -64
- manim/mobject/graphing/functions.py +25 -15
- manim/mobject/graphing/number_line.py +24 -10
- manim/mobject/graphing/probability.py +2 -10
- manim/mobject/graphing/scale.py +6 -5
- manim/mobject/matrix.py +17 -19
- manim/mobject/mobject.py +314 -165
- manim/mobject/opengl/opengl_compatibility.py +2 -0
- manim/mobject/opengl/opengl_geometry.py +30 -9
- manim/mobject/opengl/opengl_image_mobject.py +2 -0
- manim/mobject/opengl/opengl_mobject.py +509 -343
- manim/mobject/opengl/opengl_point_cloud_mobject.py +5 -7
- manim/mobject/opengl/opengl_surface.py +3 -2
- manim/mobject/opengl/opengl_three_dimensions.py +2 -0
- manim/mobject/opengl/opengl_vectorized_mobject.py +46 -79
- manim/mobject/svg/brace.py +63 -13
- manim/mobject/svg/svg_mobject.py +4 -3
- manim/mobject/table.py +11 -13
- manim/mobject/text/code_mobject.py +186 -548
- manim/mobject/text/numbers.py +9 -7
- manim/mobject/text/tex_mobject.py +23 -14
- manim/mobject/text/text_mobject.py +70 -24
- manim/mobject/three_d/polyhedra.py +98 -1
- manim/mobject/three_d/three_d_utils.py +4 -4
- manim/mobject/three_d/three_dimensions.py +62 -34
- manim/mobject/types/image_mobject.py +42 -24
- manim/mobject/types/point_cloud_mobject.py +105 -67
- manim/mobject/types/vectorized_mobject.py +496 -228
- manim/mobject/value_tracker.py +5 -4
- manim/mobject/vector_field.py +5 -5
- manim/opengl/__init__.py +3 -3
- manim/plugins/__init__.py +14 -1
- manim/plugins/plugins_flags.py +14 -8
- manim/renderer/cairo_renderer.py +20 -10
- manim/renderer/opengl_renderer.py +21 -23
- manim/renderer/opengl_renderer_window.py +2 -0
- manim/renderer/shader.py +2 -3
- manim/renderer/shader_wrapper.py +5 -2
- manim/renderer/vectorized_mobject_rendering.py +5 -0
- manim/scene/moving_camera_scene.py +23 -0
- manim/scene/scene.py +90 -43
- manim/scene/scene_file_writer.py +316 -165
- manim/scene/section.py +17 -15
- manim/scene/three_d_scene.py +13 -21
- manim/scene/vector_space_scene.py +22 -9
- manim/typing.py +830 -70
- manim/utils/bezier.py +1667 -399
- manim/utils/caching.py +13 -5
- manim/utils/color/AS2700.py +2 -0
- manim/utils/color/BS381.py +3 -0
- manim/utils/color/DVIPSNAMES.py +96 -0
- manim/utils/color/SVGNAMES.py +179 -0
- manim/utils/color/X11.py +3 -0
- manim/utils/color/XKCD.py +3 -0
- manim/utils/color/__init__.py +8 -5
- manim/utils/color/core.py +844 -309
- manim/utils/color/manim_colors.py +7 -9
- manim/utils/commands.py +48 -20
- manim/utils/config_ops.py +18 -13
- manim/utils/debug.py +8 -7
- manim/utils/deprecation.py +90 -40
- manim/utils/docbuild/__init__.py +17 -0
- manim/utils/docbuild/autoaliasattr_directive.py +234 -0
- manim/utils/docbuild/autocolor_directive.py +21 -17
- manim/utils/docbuild/manim_directive.py +50 -35
- manim/utils/docbuild/module_parsing.py +245 -0
- manim/utils/exceptions.py +6 -0
- manim/utils/family.py +5 -3
- manim/utils/family_ops.py +17 -4
- manim/utils/file_ops.py +26 -16
- manim/utils/hashing.py +9 -7
- manim/utils/images.py +10 -4
- manim/utils/ipython_magic.py +14 -8
- manim/utils/iterables.py +161 -119
- manim/utils/module_ops.py +57 -19
- manim/utils/opengl.py +83 -24
- manim/utils/parameter_parsing.py +32 -0
- manim/utils/paths.py +21 -23
- manim/utils/polylabel.py +168 -0
- manim/utils/qhull.py +218 -0
- manim/utils/rate_functions.py +74 -39
- manim/utils/simple_functions.py +24 -15
- manim/utils/sounds.py +7 -1
- manim/utils/space_ops.py +125 -69
- manim/utils/testing/__init__.py +17 -0
- manim/utils/testing/_frames_testers.py +13 -8
- manim/utils/testing/_show_diff.py +5 -3
- manim/utils/testing/_test_class_makers.py +33 -18
- manim/utils/testing/frames_comparison.py +27 -19
- manim/utils/tex.py +127 -197
- manim/utils/tex_file_writing.py +47 -45
- manim/utils/tex_templates.py +2 -1
- manim/utils/unit.py +6 -5
- {manim-0.18.0.post0.dist-info → manim-0.19.0.dist-info}/LICENSE.community +1 -1
- {manim-0.18.0.post0.dist-info → manim-0.19.0.dist-info}/METADATA +40 -39
- manim-0.19.0.dist-info/RECORD +221 -0
- {manim-0.18.0.post0.dist-info → manim-0.19.0.dist-info}/WHEEL +1 -1
- manim/cli/new/__init__.py +0 -0
- manim/cli/new/group.py +0 -189
- manim/plugins/import_plugins.py +0 -43
- manim-0.18.0.post0.dist-info/RECORD +0 -217
- {manim-0.18.0.post0.dist-info → manim-0.19.0.dist-info}/LICENSE +0 -0
- {manim-0.18.0.post0.dist-info → manim-0.19.0.dist-info}/entry_points.txt +0 -0
manim/__init__.py
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env python
|
|
2
|
-
|
|
3
|
-
|
|
4
2
|
from __future__ import annotations
|
|
5
3
|
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
__version__: str = pkg_resources.get_distribution(__name__).version
|
|
4
|
+
from importlib.metadata import version
|
|
9
5
|
|
|
6
|
+
__version__ = version(__name__)
|
|
10
7
|
|
|
11
|
-
import sys
|
|
12
8
|
|
|
13
9
|
# isort: off
|
|
14
10
|
|
|
@@ -20,6 +16,7 @@ from ._config import *
|
|
|
20
16
|
from .utils.commands import *
|
|
21
17
|
|
|
22
18
|
# isort: on
|
|
19
|
+
import numpy as np
|
|
23
20
|
|
|
24
21
|
from .animation.animation import *
|
|
25
22
|
from .animation.changing import *
|
manim/__main__.py
CHANGED
|
@@ -1,27 +1,54 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
-
import sys
|
|
4
|
-
|
|
5
3
|
import click
|
|
6
4
|
import cloup
|
|
7
5
|
|
|
8
|
-
from
|
|
9
|
-
from .
|
|
10
|
-
from .cli.
|
|
11
|
-
from .cli.
|
|
12
|
-
from .cli.
|
|
13
|
-
from .cli.
|
|
14
|
-
from .cli.plugins.commands import plugins
|
|
15
|
-
from .cli.render.commands import render
|
|
16
|
-
from .constants import EPILOG
|
|
6
|
+
from manim import __version__
|
|
7
|
+
from manim._config import cli_ctx_settings, console
|
|
8
|
+
from manim.cli.cfg.group import cfg
|
|
9
|
+
from manim.cli.checkhealth.commands import checkhealth
|
|
10
|
+
from manim.cli.default_group import DefaultGroup
|
|
11
|
+
from manim.cli.init.commands import init
|
|
12
|
+
from manim.cli.plugins.commands import plugins
|
|
13
|
+
from manim.cli.render.commands import render
|
|
14
|
+
from manim.constants import EPILOG
|
|
15
|
+
|
|
17
16
|
|
|
17
|
+
def show_splash(ctx: click.Context, param: click.Option, value: str | None) -> None:
|
|
18
|
+
"""When giving a value by console, show an initial message with the Manim
|
|
19
|
+
version before executing any other command: ``Manim Community vA.B.C``.
|
|
18
20
|
|
|
19
|
-
|
|
21
|
+
Parameters
|
|
22
|
+
----------
|
|
23
|
+
ctx
|
|
24
|
+
The Click context.
|
|
25
|
+
param
|
|
26
|
+
A Click option.
|
|
27
|
+
value
|
|
28
|
+
A string value given by console, or None.
|
|
29
|
+
"""
|
|
20
30
|
if value:
|
|
21
|
-
|
|
31
|
+
console.print(f"Manim Community [green]v{__version__}[/green]\n")
|
|
32
|
+
|
|
22
33
|
|
|
34
|
+
def print_version_and_exit(
|
|
35
|
+
ctx: click.Context, param: click.Option, value: str | None
|
|
36
|
+
) -> None:
|
|
37
|
+
"""Same as :func:`show_splash`, but also exit when giving a value by
|
|
38
|
+
console.
|
|
23
39
|
|
|
24
|
-
|
|
40
|
+
Parameters
|
|
41
|
+
----------
|
|
42
|
+
ctx
|
|
43
|
+
The Click context.
|
|
44
|
+
param
|
|
45
|
+
A Click option.
|
|
46
|
+
value
|
|
47
|
+
A string value given by console, or None.
|
|
48
|
+
"""
|
|
49
|
+
show_splash(ctx, param, value)
|
|
50
|
+
if value:
|
|
51
|
+
ctx.exit()
|
|
25
52
|
|
|
26
53
|
|
|
27
54
|
@cloup.group(
|
|
@@ -35,17 +62,32 @@ console.print(f"Manim Community [green]v{__version__}[/green]\n")
|
|
|
35
62
|
"is specified. Run 'manim render --help' if you would like to know what the "
|
|
36
63
|
f"'-ql' or '-p' flags do, for example.\n\n{EPILOG}",
|
|
37
64
|
)
|
|
38
|
-
@
|
|
65
|
+
@cloup.option(
|
|
39
66
|
"--version",
|
|
40
67
|
is_flag=True,
|
|
41
68
|
help="Show version and exit.",
|
|
42
|
-
callback=
|
|
69
|
+
callback=print_version_and_exit,
|
|
43
70
|
is_eager=True,
|
|
44
71
|
expose_value=False,
|
|
45
72
|
)
|
|
46
|
-
@click.
|
|
47
|
-
|
|
48
|
-
|
|
73
|
+
@click.option(
|
|
74
|
+
"--show-splash/--hide-splash",
|
|
75
|
+
is_flag=True,
|
|
76
|
+
default=True,
|
|
77
|
+
help="Print splash message with version information.",
|
|
78
|
+
callback=show_splash,
|
|
79
|
+
is_eager=True,
|
|
80
|
+
expose_value=False,
|
|
81
|
+
)
|
|
82
|
+
@cloup.pass_context
|
|
83
|
+
def main(ctx: click.Context) -> None:
|
|
84
|
+
"""The entry point for Manim.
|
|
85
|
+
|
|
86
|
+
Parameters
|
|
87
|
+
----------
|
|
88
|
+
ctx
|
|
89
|
+
The Click context.
|
|
90
|
+
"""
|
|
49
91
|
pass
|
|
50
92
|
|
|
51
93
|
|
|
@@ -53,7 +95,6 @@ main.add_command(checkhealth)
|
|
|
53
95
|
main.add_command(cfg)
|
|
54
96
|
main.add_command(plugins)
|
|
55
97
|
main.add_command(init)
|
|
56
|
-
main.add_command(new)
|
|
57
98
|
main.add_command(render)
|
|
58
99
|
|
|
59
100
|
if __name__ == "__main__":
|
manim/_config/__init__.py
CHANGED
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
import logging
|
|
6
|
-
from
|
|
6
|
+
from collections.abc import Generator
|
|
7
|
+
from contextlib import contextmanager
|
|
8
|
+
from typing import Any
|
|
7
9
|
|
|
8
10
|
from .cli_colors import parse_cli_ctx
|
|
9
11
|
from .logger_utils import make_logger
|
|
@@ -35,12 +37,14 @@ logging.getLogger("PIL").setLevel(logging.INFO)
|
|
|
35
37
|
logging.getLogger("matplotlib").setLevel(logging.INFO)
|
|
36
38
|
|
|
37
39
|
config = ManimConfig().digest_parser(parser)
|
|
40
|
+
# TODO: to be used in the future - see PR #620
|
|
41
|
+
# https://github.com/ManimCommunity/manim/pull/620
|
|
38
42
|
frame = ManimFrame(config)
|
|
39
43
|
|
|
40
44
|
|
|
41
45
|
# This has to go here because it needs access to this module's config
|
|
42
46
|
@contextmanager
|
|
43
|
-
def tempconfig(temp: ManimConfig | dict) ->
|
|
47
|
+
def tempconfig(temp: ManimConfig | dict[str, Any]) -> Generator[None, None, None]:
|
|
44
48
|
"""Context manager that temporarily modifies the global ``config`` object.
|
|
45
49
|
|
|
46
50
|
Inside the ``with`` statement, the modified config will be used. After
|
|
@@ -64,7 +68,6 @@ def tempconfig(temp: ManimConfig | dict) -> _GeneratorContextManager:
|
|
|
64
68
|
8.0
|
|
65
69
|
>>> with tempconfig({"frame_height": 100.0}):
|
|
66
70
|
... print(config["frame_height"])
|
|
67
|
-
...
|
|
68
71
|
100.0
|
|
69
72
|
>>> config["frame_height"]
|
|
70
73
|
8.0
|
manim/_config/cli_colors.py
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
1
3
|
import configparser
|
|
4
|
+
from typing import Any
|
|
2
5
|
|
|
3
6
|
from cloup import Context, HelpFormatter, HelpTheme, Style
|
|
4
7
|
|
|
8
|
+
__all__ = ["parse_cli_ctx"]
|
|
9
|
+
|
|
5
10
|
|
|
6
|
-
def parse_cli_ctx(parser: configparser.
|
|
7
|
-
formatter_settings = {
|
|
11
|
+
def parse_cli_ctx(parser: configparser.SectionProxy) -> dict[str, Any]:
|
|
12
|
+
formatter_settings: dict[str, str | int] = {
|
|
8
13
|
"indent_increment": int(parser["indent_increment"]),
|
|
9
14
|
"width": int(parser["width"]),
|
|
10
15
|
"col1_max_width": int(parser["col1_max_width"]),
|
|
@@ -30,16 +35,19 @@ def parse_cli_ctx(parser: configparser.ConfigParser) -> Context:
|
|
|
30
35
|
formatter = {}
|
|
31
36
|
theme = parser["theme"] if parser["theme"] else None
|
|
32
37
|
if theme is None:
|
|
33
|
-
formatter = HelpFormatter
|
|
34
|
-
theme=HelpTheme(**theme_settings),
|
|
38
|
+
formatter = HelpFormatter.settings(
|
|
39
|
+
theme=HelpTheme(**theme_settings),
|
|
40
|
+
**formatter_settings, # type: ignore[arg-type]
|
|
35
41
|
)
|
|
36
42
|
elif theme.lower() == "dark":
|
|
37
|
-
formatter = HelpFormatter
|
|
38
|
-
theme=HelpTheme.dark().with_(**theme_settings),
|
|
43
|
+
formatter = HelpFormatter.settings(
|
|
44
|
+
theme=HelpTheme.dark().with_(**theme_settings),
|
|
45
|
+
**formatter_settings, # type: ignore[arg-type]
|
|
39
46
|
)
|
|
40
47
|
elif theme.lower() == "light":
|
|
41
|
-
formatter = HelpFormatter
|
|
42
|
-
theme=HelpTheme.light().with_(**theme_settings),
|
|
48
|
+
formatter = HelpFormatter.settings(
|
|
49
|
+
theme=HelpTheme.light().with_(**theme_settings),
|
|
50
|
+
**formatter_settings, # type: ignore[arg-type]
|
|
43
51
|
)
|
|
44
52
|
|
|
45
53
|
return Context.settings(
|
manim/_config/default.cfg
CHANGED
|
@@ -221,9 +221,7 @@ repr_number = green
|
|
|
221
221
|
# Uncomment the following line to manually set the loglevel for ffmpeg. See
|
|
222
222
|
# ffmpeg manpage for accepted values
|
|
223
223
|
loglevel = ERROR
|
|
224
|
-
# defaults to the one present in path
|
|
225
|
-
ffmpeg_executable = ffmpeg
|
|
226
224
|
|
|
227
225
|
[jupyter]
|
|
228
|
-
media_embed =
|
|
226
|
+
media_embed = False
|
|
229
227
|
media_width = 60%%
|
manim/_config/logger_utils.py
CHANGED
|
@@ -9,13 +9,13 @@ Both ``logger`` and ``console`` use the ``rich`` library to produce rich text
|
|
|
9
9
|
format.
|
|
10
10
|
|
|
11
11
|
"""
|
|
12
|
+
|
|
12
13
|
from __future__ import annotations
|
|
13
14
|
|
|
14
15
|
import configparser
|
|
15
16
|
import copy
|
|
16
17
|
import json
|
|
17
18
|
import logging
|
|
18
|
-
import sys
|
|
19
19
|
from typing import TYPE_CHECKING
|
|
20
20
|
|
|
21
21
|
from rich import color, errors
|
|
@@ -27,6 +27,8 @@ from rich.theme import Theme
|
|
|
27
27
|
if TYPE_CHECKING:
|
|
28
28
|
from pathlib import Path
|
|
29
29
|
|
|
30
|
+
__all__ = ["make_logger", "parse_theme", "set_file_logger", "JSONFormatter"]
|
|
31
|
+
|
|
30
32
|
HIGHLIGHTED_KEYWORDS = [ # these keywords are highlighted specially
|
|
31
33
|
"Played",
|
|
32
34
|
"animations",
|
|
@@ -50,9 +52,9 @@ Loading the default color configuration.[/logging.level.error]
|
|
|
50
52
|
|
|
51
53
|
|
|
52
54
|
def make_logger(
|
|
53
|
-
parser: configparser.
|
|
55
|
+
parser: configparser.SectionProxy,
|
|
54
56
|
verbosity: str,
|
|
55
|
-
) -> tuple[logging.Logger, Console]:
|
|
57
|
+
) -> tuple[logging.Logger, Console, Console]:
|
|
56
58
|
"""Make the manim logger and console.
|
|
57
59
|
|
|
58
60
|
Parameters
|
|
@@ -84,25 +86,29 @@ def make_logger(
|
|
|
84
86
|
theme = parse_theme(parser)
|
|
85
87
|
console = Console(theme=theme)
|
|
86
88
|
|
|
87
|
-
|
|
88
|
-
error_console = Console(theme=theme, file=sys.stderr)
|
|
89
|
+
error_console = Console(theme=theme, stderr=True)
|
|
89
90
|
|
|
90
91
|
# set the rich handler
|
|
91
|
-
RichHandler.KEYWORDS = HIGHLIGHTED_KEYWORDS
|
|
92
92
|
rich_handler = RichHandler(
|
|
93
93
|
console=console,
|
|
94
94
|
show_time=parser.getboolean("log_timestamps"),
|
|
95
|
+
keywords=HIGHLIGHTED_KEYWORDS,
|
|
95
96
|
)
|
|
96
97
|
|
|
97
98
|
# finally, the logger
|
|
98
99
|
logger = logging.getLogger("manim")
|
|
99
100
|
logger.addHandler(rich_handler)
|
|
100
101
|
logger.setLevel(verbosity)
|
|
102
|
+
logger.propagate = False
|
|
103
|
+
|
|
104
|
+
if not (libav_logger := logging.getLogger()).hasHandlers():
|
|
105
|
+
libav_logger.addHandler(rich_handler)
|
|
106
|
+
libav_logger.setLevel(verbosity)
|
|
101
107
|
|
|
102
108
|
return logger, console, error_console
|
|
103
109
|
|
|
104
110
|
|
|
105
|
-
def parse_theme(parser: configparser.
|
|
111
|
+
def parse_theme(parser: configparser.SectionProxy) -> Theme:
|
|
106
112
|
"""Configure the rich style of logger and console output.
|
|
107
113
|
|
|
108
114
|
Parameters
|
|
@@ -178,7 +184,7 @@ class JSONFormatter(logging.Formatter):
|
|
|
178
184
|
|
|
179
185
|
"""
|
|
180
186
|
|
|
181
|
-
def format(self, record:
|
|
187
|
+
def format(self, record: logging.LogRecord) -> str:
|
|
182
188
|
"""Format the record in a custom JSON format."""
|
|
183
189
|
record_c = copy.deepcopy(record)
|
|
184
190
|
if record_c.args:
|