Source
manim/_config/utils.py, line 1193 (as of HEAD ):
# TODO: This was parsed before maybe add ManimColor(val), but results in circular import
@property
def background_color(self) -> ManimColor:
"""Background color of the scene (-c)."""
return self._d["background_color"]
Problem
The background_color property is type-annotated as ManimColor, but the underlying value stored in self._d is not wrapped in a ManimColor instance. The natural fix, return ManimColor(self._d["background_color"]), is blocked by a circular import between _config/utils.py and the ManimColor definition.
The mismatch between the annotation and the runtime value can mislead callers that rely on ManimColor methods being available on the returned object.
Suggested approaches
- Lazy import of
ManimColor inside the getter.
- Restructure the import graph so
_config/utils.py can import ManimColor at module level.
- Audit other config properties that may have the same gap (e.g. other color-typed config values).
Source
manim/_config/utils.py, line 1193 (as of HEAD ):Problem
The
background_colorproperty is type-annotated asManimColor, but the underlying value stored inself._dis not wrapped in aManimColorinstance. The natural fix,return ManimColor(self._d["background_color"]), is blocked by a circular import between_config/utils.pyand theManimColordefinition.The mismatch between the annotation and the runtime value can mislead callers that rely on
ManimColormethods being available on the returned object.Suggested approaches
ManimColorinside the getter._config/utils.pycan importManimColorat module level.