From b6c0903bdb15b85acd5b4f4f0cc4f13c66a94192 Mon Sep 17 00:00:00 2001 From: Aathish Sivasubrahmanian Date: Sat, 15 Aug 2020 12:01:12 +0530 Subject: [PATCH 1/5] Changed log level for Read Configuration Files message. Changed default logging level for tests to "DEBUG" Edited expected.txt to account for verbosity change. --- manim/config.py | 2 +- tests/test_logging/expected.txt | 5 ++++- tests/tests_data/manim.cfg | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/manim/config.py b/manim/config.py index e9216deffb..1b679a2e4e 100644 --- a/manim/config.py +++ b/manim/config.py @@ -90,7 +90,7 @@ def _parse_config(config_parser, args): args, config_parser, file_writer_config, successfully_read_files = _run_config() logger.setLevel(file_writer_config["verbose"]) if _from_command_line(): - logger.info( + logger.debug( f"Read configuration files: {[os.path.abspath(cfgfile) for cfgfile in successfully_read_files]}" ) if not (hasattr(args, "subcommands")): diff --git a/tests/test_logging/expected.txt b/tests/test_logging/expected.txt index fc4ad658a1..ccb8a2eaed 100644 --- a/tests/test_logging/expected.txt +++ b/tests/test_logging/expected.txt @@ -1,4 +1,7 @@ -INFO Read configuration files: config.py: +DEBUG Read configuration files: config.py: +DEBUG Animation : Partial movie file written in scene_file_writer.py: +DEBUG Animation : Partial movie file written in scene_file_writer.py: +DEBUG Animation : Partial movie file written in scene_file_writer.py: INFO scene_file_writer.py: File ready at diff --git a/tests/tests_data/manim.cfg b/tests/tests_data/manim.cfg index a1b7f8a381..c7990a9505 100644 --- a/tests/tests_data/manim.cfg +++ b/tests/tests_data/manim.cfg @@ -4,6 +4,7 @@ write_to_movie = True # write_all = False save_last_frame = False # save_pngs = False +verbose = DEBUG [logger] log_width = 512 From 4b6e96192f01daf854c5acf54747b7775295242f Mon Sep 17 00:00:00 2001 From: Aathish Sivasubrahmanian Date: Sat, 15 Aug 2020 12:03:42 +0530 Subject: [PATCH 2/5] Run tests on this branch. --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9889a4fffa..3071194e2f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,6 +3,7 @@ on: push: branches: - master + - show_cfg_in_debug_only pull_request: branches: - master From 824534594f067cd0c15d6846b6aec692d42786ce Mon Sep 17 00:00:00 2001 From: Aathish Sivasubrahmanian Date: Sat, 15 Aug 2020 12:16:22 +0530 Subject: [PATCH 3/5] Make cli tests also use verbose logs. --- tests/test_cli/manim.cfg | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/test_cli/manim.cfg b/tests/test_cli/manim.cfg index 1838b30c24..4388b03091 100644 --- a/tests/test_cli/manim.cfg +++ b/tests/test_cli/manim.cfg @@ -2,6 +2,7 @@ movie_file_extension = .mp4 write_to_movie = True sound = True +verbose = DEBUG # write_all = False save_last_frame = True # save_pngs = False From 6cb575a675b58b41f8a66165177807ccee1a5d71 Mon Sep 17 00:00:00 2001 From: Aathish Sivasubrahmanian Date: Sat, 15 Aug 2020 12:46:34 +0530 Subject: [PATCH 4/5] Stop testing on this branch. --- .github/workflows/ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3071194e2f..9889a4fffa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,7 +3,6 @@ on: push: branches: - master - - show_cfg_in_debug_only pull_request: branches: - master From 36495f4cd44c529ff8168aa2b4c8504b0aa1dbb9 Mon Sep 17 00:00:00 2001 From: Aathish Sivasubrahmanian Date: Sat, 15 Aug 2020 14:44:43 +0530 Subject: [PATCH 5/5] Rename `verbose` to verbosity. --- manim/__main__.py | 4 ++-- manim/config.py | 2 +- manim/constants.py | 4 ++-- manim/default.cfg | 4 ++-- manim/utils/config_utils.py | 14 +++++++------- tests/test_cli/manim.cfg | 2 +- tests/tests_data/manim.cfg | 2 +- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/manim/__main__.py b/manim/__main__.py index caf8e1af43..4f02758656 100644 --- a/manim/__main__.py +++ b/manim/__main__.py @@ -19,7 +19,7 @@ def open_file_if_needed(file_writer): - if file_writer_config["verbose"] != "DEBUG": + if file_writer_config["verbosity"] != "DEBUG": curr_stdout = sys.stdout sys.stdout = open(os.devnull, "w") @@ -43,7 +43,7 @@ def open_file_if_needed(file_writer): for file_path in file_paths: open_media_file(file_path, file_writer_config["show_in_file_browser"]) - if file_writer_config["verbose"] != "DEBUG": + if file_writer_config["verbosity"] != "DEBUG": sys.stdout.close() sys.stdout = curr_stdout diff --git a/manim/config.py b/manim/config.py index 1b679a2e4e..57ad844208 100644 --- a/manim/config.py +++ b/manim/config.py @@ -88,7 +88,7 @@ def _parse_config(config_parser, args): args, config_parser, file_writer_config, successfully_read_files = _run_config() -logger.setLevel(file_writer_config["verbose"]) +logger.setLevel(file_writer_config["verbosity"]) if _from_command_line(): logger.debug( f"Read configuration files: {[os.path.abspath(cfgfile) for cfgfile in successfully_read_files]}" diff --git a/manim/constants.py b/manim/constants.py index 81674b220d..45d9b16dd3 100644 --- a/manim/constants.py +++ b/manim/constants.py @@ -152,11 +152,11 @@ class MyText(Text): ) PALETTE = list(COLOR_MAP.values()) locals().update(COLOR_MAP) -VERBOSE_FFMPEG_MAP = { +FFMPEG_VERBOSITY_MAP = { "DEBUG": "error", "INFO": "error", "WARNING": "error", "ERROR": "error", "CRITICAL": "fatal", } -VERBOSE_CHOICES = VERBOSE_FFMPEG_MAP.keys() +VERBOSITY_CHOICES = FFMPEG_VERBOSITY_MAP.keys() diff --git a/manim/default.cfg b/manim/default.cfg index 28beeaea6a..5786bc2a11 100644 --- a/manim/default.cfg +++ b/manim/default.cfg @@ -36,8 +36,8 @@ preview = False # -f, --show_in_file_browser show_in_file_browser = False -# -v, --verbose -verbose = INFO +# -v, --verbosity +verbosity = INFO # --progress_bar progress_bar = True diff --git a/manim/utils/config_utils.py b/manim/utils/config_utils.py index 20a76a5108..9d445fcc24 100644 --- a/manim/utils/config_utils.py +++ b/manim/utils/config_utils.py @@ -138,15 +138,15 @@ def _parse_file_writer_config(config_parser, args): fw_config["max_files_cached"] = default.getint("max_files_cached") if fw_config["max_files_cached"] == -1: fw_config["max_files_cached"] = float("inf") - # Parse the verbose flag to read in the log level - verbose = getattr(args, "verbose") - verbose = default["verbose"] if verbose is None else verbose - fw_config["verbose"] = verbose + # Parse the verbosity flag to read in the log level + verbosity = getattr(args, "verbosity") + verbosity = default["verbosity"] if verbosity is None else verbosity + fw_config["verbosity"] = verbosity # Parse the ffmpeg log level in the config ffmpeg_loglevel = config_parser["ffmpeg"].get("loglevel", None) fw_config["ffmpeg_loglevel"] = ( - constants.VERBOSE_FFMPEG_MAP[verbose] + constants.FFMPEG_VERBOSITY_MAP[verbosity] if ffmpeg_loglevel is None else ffmpeg_loglevel ) @@ -385,10 +385,10 @@ def _parse_cli(arg_list, input=True): # Specify the verbosity parser.add_argument( "-v", - "--verbose", + "--verbosity", type=str, help="Verbosity level. Also changes the ffmpeg log level unless the latter is specified in the config", - choices=constants.VERBOSE_CHOICES, + choices=constants.VERBOSITY_CHOICES, ) # Specify if the progress bar should be displayed diff --git a/tests/test_cli/manim.cfg b/tests/test_cli/manim.cfg index 4388b03091..ae9ef35bc6 100644 --- a/tests/test_cli/manim.cfg +++ b/tests/test_cli/manim.cfg @@ -2,7 +2,7 @@ movie_file_extension = .mp4 write_to_movie = True sound = True -verbose = DEBUG +verbosity = DEBUG # write_all = False save_last_frame = True # save_pngs = False diff --git a/tests/tests_data/manim.cfg b/tests/tests_data/manim.cfg index c7990a9505..069801255e 100644 --- a/tests/tests_data/manim.cfg +++ b/tests/tests_data/manim.cfg @@ -4,7 +4,7 @@ write_to_movie = True # write_all = False save_last_frame = False # save_pngs = False -verbose = DEBUG +verbosity = DEBUG [logger] log_width = 512