Skip to content

Enhance manim cfg show output and add info-level logging for config files read #4375

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions manim/_config/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,14 @@ def make_config_parser(
# read_file() before calling read() for any optional files."
# https://docs.python.org/3/library/configparser.html#configparser.ConfigParser.read
parser = configparser.ConfigParser()
logger.info(f"Reading config file: {library_wide}")
with library_wide.open() as file:
parser.read_file(file) # necessary file

other_files = [user_wide, Path(custom_file) if custom_file else folder_wide]
for path in other_files:
if path.exists():
logger.info(f"Reading config file: {path}")
parser.read(other_files) # optional files

return parser
Expand Down
6 changes: 6 additions & 0 deletions manim/cli/cfg/group.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,12 @@ def write(level: str | None = None, openfile: bool = False) -> None:

@cfg.command(context_settings=cli_ctx_settings)
def show() -> None:
console.print("CONFIG FILES READ", style="bold green underline")
for path in config_file_paths():
if path.exists():
console.print(f"{path}")
console.print()

parser = make_config_parser()
rich_non_style_entries = [a.replace(".", "_") for a in RICH_NON_STYLE_ENTRIES]
for category in parser:
Expand Down
Loading