manim 0.18.0__py3-none-any.whl → 0.18.1__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.

Files changed (115) hide show
  1. manim/__init__.py +3 -6
  2. manim/__main__.py +18 -10
  3. manim/_config/__init__.py +5 -2
  4. manim/_config/cli_colors.py +12 -8
  5. manim/_config/default.cfg +1 -1
  6. manim/_config/logger_utils.py +9 -8
  7. manim/_config/utils.py +637 -449
  8. manim/animation/animation.py +9 -2
  9. manim/animation/composition.py +78 -40
  10. manim/animation/creation.py +12 -6
  11. manim/animation/fading.py +0 -1
  12. manim/animation/indication.py +10 -21
  13. manim/animation/movement.py +1 -2
  14. manim/animation/rotation.py +1 -1
  15. manim/animation/specialized.py +1 -1
  16. manim/animation/speedmodifier.py +7 -2
  17. manim/animation/transform_matching_parts.py +1 -1
  18. manim/camera/camera.py +13 -4
  19. manim/cli/cfg/group.py +18 -8
  20. manim/cli/checkhealth/checks.py +2 -0
  21. manim/cli/checkhealth/commands.py +2 -0
  22. manim/cli/default_group.py +13 -5
  23. manim/cli/init/commands.py +4 -1
  24. manim/cli/plugins/commands.py +3 -0
  25. manim/cli/render/commands.py +27 -20
  26. manim/cli/render/ease_of_access_options.py +4 -3
  27. manim/cli/render/global_options.py +9 -7
  28. manim/cli/render/output_options.py +6 -5
  29. manim/cli/render/render_options.py +13 -13
  30. manim/constants.py +54 -15
  31. manim/gui/gui.py +2 -0
  32. manim/mobject/geometry/arc.py +4 -4
  33. manim/mobject/geometry/boolean_ops.py +13 -9
  34. manim/mobject/geometry/line.py +16 -8
  35. manim/mobject/geometry/polygram.py +17 -5
  36. manim/mobject/geometry/tips.py +2 -2
  37. manim/mobject/graph.py +379 -106
  38. manim/mobject/graphing/coordinate_systems.py +17 -20
  39. manim/mobject/graphing/functions.py +14 -10
  40. manim/mobject/graphing/number_line.py +1 -1
  41. manim/mobject/mobject.py +175 -72
  42. manim/mobject/opengl/opengl_compatibility.py +2 -0
  43. manim/mobject/opengl/opengl_geometry.py +26 -1
  44. manim/mobject/opengl/opengl_image_mobject.py +2 -0
  45. manim/mobject/opengl/opengl_mobject.py +3 -0
  46. manim/mobject/opengl/opengl_point_cloud_mobject.py +2 -0
  47. manim/mobject/opengl/opengl_surface.py +2 -0
  48. manim/mobject/opengl/opengl_three_dimensions.py +2 -0
  49. manim/mobject/opengl/opengl_vectorized_mobject.py +19 -14
  50. manim/mobject/svg/brace.py +2 -0
  51. manim/mobject/svg/svg_mobject.py +10 -12
  52. manim/mobject/table.py +0 -1
  53. manim/mobject/text/code_mobject.py +2 -0
  54. manim/mobject/text/numbers.py +2 -0
  55. manim/mobject/text/tex_mobject.py +1 -1
  56. manim/mobject/text/text_mobject.py +43 -6
  57. manim/mobject/three_d/three_d_utils.py +4 -4
  58. manim/mobject/three_d/three_dimensions.py +4 -4
  59. manim/mobject/types/image_mobject.py +5 -1
  60. manim/mobject/types/point_cloud_mobject.py +2 -0
  61. manim/mobject/types/vectorized_mobject.py +124 -29
  62. manim/mobject/value_tracker.py +3 -3
  63. manim/mobject/vector_field.py +3 -1
  64. manim/plugins/__init__.py +15 -1
  65. manim/plugins/plugins_flags.py +11 -5
  66. manim/renderer/cairo_renderer.py +12 -2
  67. manim/renderer/opengl_renderer.py +2 -3
  68. manim/renderer/opengl_renderer_window.py +2 -0
  69. manim/renderer/shader_wrapper.py +2 -0
  70. manim/renderer/vectorized_mobject_rendering.py +5 -0
  71. manim/scene/scene.py +22 -6
  72. manim/scene/scene_file_writer.py +3 -1
  73. manim/scene/section.py +2 -0
  74. manim/scene/three_d_scene.py +5 -6
  75. manim/scene/vector_space_scene.py +21 -5
  76. manim/typing.py +567 -67
  77. manim/utils/bezier.py +9 -18
  78. manim/utils/caching.py +2 -0
  79. manim/utils/color/BS381.py +1 -0
  80. manim/utils/color/XKCD.py +1 -0
  81. manim/utils/color/core.py +31 -13
  82. manim/utils/commands.py +8 -1
  83. manim/utils/debug.py +0 -1
  84. manim/utils/deprecation.py +3 -2
  85. manim/utils/docbuild/__init__.py +17 -0
  86. manim/utils/docbuild/autoaliasattr_directive.py +197 -0
  87. manim/utils/docbuild/autocolor_directive.py +9 -4
  88. manim/utils/docbuild/manim_directive.py +18 -9
  89. manim/utils/docbuild/module_parsing.py +198 -0
  90. manim/utils/exceptions.py +6 -0
  91. manim/utils/family.py +2 -0
  92. manim/utils/family_ops.py +5 -0
  93. manim/utils/file_ops.py +6 -2
  94. manim/utils/hashing.py +2 -0
  95. manim/utils/ipython_magic.py +2 -0
  96. manim/utils/module_ops.py +2 -0
  97. manim/utils/opengl.py +14 -0
  98. manim/utils/parameter_parsing.py +31 -0
  99. manim/utils/paths.py +12 -20
  100. manim/utils/rate_functions.py +6 -8
  101. manim/utils/space_ops.py +81 -36
  102. manim/utils/testing/__init__.py +17 -0
  103. manim/utils/testing/frames_comparison.py +7 -5
  104. manim/utils/tex.py +124 -196
  105. manim/utils/tex_file_writing.py +2 -0
  106. manim/utils/tex_templates.py +1 -0
  107. {manim-0.18.0.dist-info → manim-0.18.1.dist-info}/LICENSE.community +1 -1
  108. {manim-0.18.0.dist-info → manim-0.18.1.dist-info}/METADATA +29 -35
  109. {manim-0.18.0.dist-info → manim-0.18.1.dist-info}/RECORD +112 -112
  110. {manim-0.18.0.dist-info → manim-0.18.1.dist-info}/WHEEL +1 -1
  111. manim/cli/new/__init__.py +0 -0
  112. manim/cli/new/group.py +0 -189
  113. manim/plugins/import_plugins.py +0 -43
  114. {manim-0.18.0.dist-info → manim-0.18.1.dist-info}/LICENSE +0 -0
  115. {manim-0.18.0.dist-info → manim-0.18.1.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 pkg_resources
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,7 +1,5 @@
1
1
  from __future__ import annotations
2
2
 
3
- import sys
4
-
5
3
  import click
6
4
  import cloup
7
5
 
@@ -10,18 +8,20 @@ from .cli.cfg.group import cfg
10
8
  from .cli.checkhealth.commands import checkhealth
11
9
  from .cli.default_group import DefaultGroup
12
10
  from .cli.init.commands import init
13
- from .cli.new.group import new
14
11
  from .cli.plugins.commands import plugins
15
12
  from .cli.render.commands import render
16
13
  from .constants import EPILOG
17
14
 
18
15
 
19
- def exit_early(ctx, param, value):
16
+ def show_splash(ctx, param, value):
20
17
  if value:
21
- sys.exit()
18
+ console.print(f"Manim Community [green]v{__version__}[/green]\n")
22
19
 
23
20
 
24
- console.print(f"Manim Community [green]v{__version__}[/green]\n")
21
+ def print_version_and_exit(ctx, param, value):
22
+ show_splash(ctx, param, value)
23
+ if value:
24
+ ctx.exit()
25
25
 
26
26
 
27
27
  @cloup.group(
@@ -35,15 +35,24 @@ console.print(f"Manim Community [green]v{__version__}[/green]\n")
35
35
  "is specified. Run 'manim render --help' if you would like to know what the "
36
36
  f"'-ql' or '-p' flags do, for example.\n\n{EPILOG}",
37
37
  )
38
- @click.option(
38
+ @cloup.option(
39
39
  "--version",
40
40
  is_flag=True,
41
41
  help="Show version and exit.",
42
- callback=exit_early,
42
+ callback=print_version_and_exit,
43
+ is_eager=True,
44
+ expose_value=False,
45
+ )
46
+ @click.option(
47
+ "--show-splash/--hide-splash",
48
+ is_flag=True,
49
+ default=True,
50
+ help="Print splash message with version information.",
51
+ callback=show_splash,
43
52
  is_eager=True,
44
53
  expose_value=False,
45
54
  )
46
- @click.pass_context
55
+ @cloup.pass_context
47
56
  def main(ctx):
48
57
  """The entry point for manim."""
49
58
  pass
@@ -53,7 +62,6 @@ main.add_command(checkhealth)
53
62
  main.add_command(cfg)
54
63
  main.add_command(plugins)
55
64
  main.add_command(init)
56
- main.add_command(new)
57
65
  main.add_command(render)
58
66
 
59
67
  if __name__ == "__main__":
manim/_config/__init__.py CHANGED
@@ -3,7 +3,8 @@
3
3
  from __future__ import annotations
4
4
 
5
5
  import logging
6
- from contextlib import _GeneratorContextManager, contextmanager
6
+ from contextlib import contextmanager
7
+ from typing import Any, Generator
7
8
 
8
9
  from .cli_colors import parse_cli_ctx
9
10
  from .logger_utils import make_logger
@@ -35,12 +36,14 @@ logging.getLogger("PIL").setLevel(logging.INFO)
35
36
  logging.getLogger("matplotlib").setLevel(logging.INFO)
36
37
 
37
38
  config = ManimConfig().digest_parser(parser)
39
+ # TODO: to be used in the future - see PR #620
40
+ # https://github.com/ManimCommunity/manim/pull/620
38
41
  frame = ManimFrame(config)
39
42
 
40
43
 
41
44
  # This has to go here because it needs access to this module's config
42
45
  @contextmanager
43
- def tempconfig(temp: ManimConfig | dict) -> _GeneratorContextManager:
46
+ def tempconfig(temp: ManimConfig | dict[str, Any]) -> Generator[None, None, None]:
44
47
  """Context manager that temporarily modifies the global ``config`` object.
45
48
 
46
49
  Inside the ``with`` statement, the modified config will be used. After
@@ -1,10 +1,14 @@
1
+ from __future__ import annotations
2
+
1
3
  import configparser
2
4
 
3
5
  from cloup import Context, HelpFormatter, HelpTheme, Style
4
6
 
7
+ __all__ = ["parse_cli_ctx"]
8
+
5
9
 
6
- def parse_cli_ctx(parser: configparser.ConfigParser) -> Context:
7
- formatter_settings = {
10
+ def parse_cli_ctx(parser: configparser.SectionProxy) -> Context:
11
+ formatter_settings: dict[str, str | int] = {
8
12
  "indent_increment": int(parser["indent_increment"]),
9
13
  "width": int(parser["width"]),
10
14
  "col1_max_width": int(parser["col1_max_width"]),
@@ -30,16 +34,16 @@ def parse_cli_ctx(parser: configparser.ConfigParser) -> Context:
30
34
  formatter = {}
31
35
  theme = parser["theme"] if parser["theme"] else None
32
36
  if theme is None:
33
- formatter = HelpFormatter().settings(
34
- theme=HelpTheme(**theme_settings), **formatter_settings
37
+ formatter = HelpFormatter.settings(
38
+ theme=HelpTheme(**theme_settings), **formatter_settings # type: ignore[arg-type]
35
39
  )
36
40
  elif theme.lower() == "dark":
37
- formatter = HelpFormatter().settings(
38
- theme=HelpTheme.dark().with_(**theme_settings), **formatter_settings
41
+ formatter = HelpFormatter.settings(
42
+ theme=HelpTheme.dark().with_(**theme_settings), **formatter_settings # type: ignore[arg-type]
39
43
  )
40
44
  elif theme.lower() == "light":
41
- formatter = HelpFormatter().settings(
42
- theme=HelpTheme.light().with_(**theme_settings), **formatter_settings
45
+ formatter = HelpFormatter.settings(
46
+ theme=HelpTheme.light().with_(**theme_settings), **formatter_settings # type: ignore[arg-type]
43
47
  )
44
48
 
45
49
  return Context.settings(
manim/_config/default.cfg CHANGED
@@ -225,5 +225,5 @@ loglevel = ERROR
225
225
  ffmpeg_executable = ffmpeg
226
226
 
227
227
  [jupyter]
228
- media_embed =
228
+ media_embed = False
229
229
  media_width = 60%%
@@ -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.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,14 +86,13 @@ def make_logger(
84
86
  theme = parse_theme(parser)
85
87
  console = Console(theme=theme)
86
88
 
87
- # With rich 9.5.0+ we could pass stderr=True instead
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
@@ -102,7 +103,7 @@ def make_logger(
102
103
  return logger, console, error_console
103
104
 
104
105
 
105
- def parse_theme(parser: configparser.ConfigParser) -> Theme:
106
+ def parse_theme(parser: configparser.SectionProxy) -> Theme:
106
107
  """Configure the rich style of logger and console output.
107
108
 
108
109
  Parameters
@@ -178,7 +179,7 @@ class JSONFormatter(logging.Formatter):
178
179
 
179
180
  """
180
181
 
181
- def format(self, record: dict) -> str:
182
+ def format(self, record: logging.LogRecord) -> str:
182
183
  """Format the record in a custom JSON format."""
183
184
  record_c = copy.deepcopy(record)
184
185
  if record_c.args: