fix: resolve folder-wide manim.cfg relative to the scene file, not the cwd - #5014
Open
Selahattinozdmr wants to merge 1 commit into
Open
Selahattinozdmr wants to merge 1 commit into
Selahattinozdmr wants to merge 1 commit into
Conversation
Selahattinozdmr
force-pushed
the
fix/manim-cfg-relative-to-scene-file
branch
from
September 13, 2026 11:31
4c17082 to
1d97ca6
Compare
…e cwd
The folder-wide manim.cfg was being read at import time via a bare
relative Path("manim.cfg"), which configparser resolves against the
current working directory. This happens before the CLI has parsed
args.file, so the documented behavior ("manim will look for a
manim.cfg config file in the same directory as the file being
rendered, and not in the directory of execution") did not hold:
running `manim src/scene.py` from a different directory than the
scene file silently ignored `src/manim.cfg`.
digest_args now re-digests library-wide + user-wide + the scene
file's own directory as one cascade once args.file is known, so the
folder-wide file is resolved relative to the scene, not to cwd. This
also fixes a stray-value leak: options the scene folder's config
doesn't set now correctly fall back to the library defaults instead
of keeping whatever a wrong cwd-based config had set.
Fixes ManimCommunity#4963
Selahattinozdmr
force-pushed
the
fix/manim-cfg-relative-to-scene-file
branch
from
September 13, 2026 11:43
1d97ca6 to
bd4ec65
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The folder-wide
manim.cfgwas being located via a bare relativePath("manim.cfg")inconfig_file_paths(), whichconfigparserresolves against the current working directory. This lookup happens at import time, before the CLI has parsedargs.file, so the documented behavior did not hold:Running
manim src/myanimation/animation1.pyfrom a different directory than the scene file silently ignoredsrc/myanimation/manim.cfg, and instead picked up (or missed) whatevermanim.cfghappened to exist in the current working directory.Fixes #4963
Fix
digest_argsnow re-digests library-wide + user-wide + the scene file's own directory'smanim.cfgas one cascade onceargs.fileis known (skipped when an explicit--config_filewas passed, preserving existing precedence rules). This also fixes a secondary correctness issue: options the scene folder's config doesn't set now correctly fall back to the library defaults, instead of keeping whatever value a wrong cwd-based config had already set at import time.Test plan
test_folder_wide_config_resolves_relative_to_scene_file, which renders from a scene file in one directory while simulating stray config contamination, and asserts both that the scene folder'smanim.cfgvalue is applied and that untouched options fall back to library defaults rather than leaking the contamination.pytest tests/test_config.py— 44 passed (6 unrelated failures in this sandbox are due tolatex/LaTeX not being installed in the minimal test container, not this change)ruff check/ruff format --checkclean🤖 Generated with Claude Code