From b05b7c487be7776a189225f1d6c73bc6986b6a2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Eertmans?= Date: Wed, 3 May 2023 15:20:20 +0200 Subject: [PATCH 1/7] feat(cli): add more debugging messages --- manim_slides/commons.py | 2 +- manim_slides/logger.py | 5 +++++ manim_slides/present.py | 10 ++++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/manim_slides/commons.py b/manim_slides/commons.py index 82ac09c3..5fa418cc 100644 --- a/manim_slides/commons.py +++ b/manim_slides/commons.py @@ -54,7 +54,7 @@ def callback(ctx: Context, param: Parameter, value: bool) -> None: "-v", "--verbosity", type=click.Choice( - ["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"], + ["PERF", "DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"], case_sensitive=False, ), help="Verbosity of CLI output", diff --git a/manim_slides/logger.py b/manim_slides/logger.py index 168f00b8..6b444b06 100644 --- a/manim_slides/logger.py +++ b/manim_slides/logger.py @@ -6,6 +6,8 @@ import logging from rich.logging import RichHandler +from rich.console import Console +from rich.theme import Theme __all__ = ["logger", "make_logger"] @@ -33,9 +35,12 @@ def make_logger() -> logging.Logger: RichHandler.KEYWORDS = HIGHLIGHTED_KEYWORDS rich_handler = RichHandler( show_time=True, + console=Console(theme=Theme({"logging.level.perf": "magenta"})), ) + logging.addLevelName(5, "PERF") logger = logging.getLogger("manim-slides") logger.addHandler(rich_handler) + return logger diff --git a/manim_slides/present.py b/manim_slides/present.py index 2e9730be..1233436f 100644 --- a/manim_slides/present.py +++ b/manim_slides/present.py @@ -448,6 +448,16 @@ def run(self) -> None: lag = now() - last_time sleep_time = 1 / self.current_presentation.fps + + logger.log(5, f"Took {lag:.3f} seconds to read the next frame, that must play at a rate of one every {sleep_time:.3f} seconds.") + + if sleep_time - lag < 0: + logger.warn("The FPS rate could not be matched. " + "This is normal when manually transitioning between slides.\n" + "If you feel that the FPS are too low, " + "consider checking this issue:\n" + "https://github.com/jeertmans/manim-slides/issues/179.") + sleep_time = max(sleep_time - lag, 0) time.sleep(sleep_time) last_time = now() From e9dca4a850ed04207ba0585ed0d6823f3c124fc3 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 3 May 2023 13:22:22 +0000 Subject: [PATCH 2/7] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- manim_slides/logger.py | 2 +- manim_slides/present.py | 17 +++++++++++------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/manim_slides/logger.py b/manim_slides/logger.py index 6b444b06..3530d5a4 100644 --- a/manim_slides/logger.py +++ b/manim_slides/logger.py @@ -5,8 +5,8 @@ import logging -from rich.logging import RichHandler from rich.console import Console +from rich.logging import RichHandler from rich.theme import Theme __all__ = ["logger", "make_logger"] diff --git a/manim_slides/present.py b/manim_slides/present.py index 1233436f..b4c8f7b7 100644 --- a/manim_slides/present.py +++ b/manim_slides/present.py @@ -449,14 +449,19 @@ def run(self) -> None: lag = now() - last_time sleep_time = 1 / self.current_presentation.fps - logger.log(5, f"Took {lag:.3f} seconds to read the next frame, that must play at a rate of one every {sleep_time:.3f} seconds.") + logger.log( + 5, + f"Took {lag:.3f} seconds to read the next frame, that must play at a rate of one every {sleep_time:.3f} seconds.", + ) if sleep_time - lag < 0: - logger.warn("The FPS rate could not be matched. " - "This is normal when manually transitioning between slides.\n" - "If you feel that the FPS are too low, " - "consider checking this issue:\n" - "https://github.com/jeertmans/manim-slides/issues/179.") + logger.warn( + "The FPS rate could not be matched. " + "This is normal when manually transitioning between slides.\n" + "If you feel that the FPS are too low, " + "consider checking this issue:\n" + "https://github.com/jeertmans/manim-slides/issues/179." + ) sleep_time = max(sleep_time - lag, 0) time.sleep(sleep_time) From 0a6815a6316abb95f0e0a53ad18f037eceab9638 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Eertmans?= Date: Wed, 3 May 2023 15:26:18 +0200 Subject: [PATCH 3/7] chore(lib): fix msg to be more correct --- manim_slides/present.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/manim_slides/present.py b/manim_slides/present.py index b4c8f7b7..84af2db3 100644 --- a/manim_slides/present.py +++ b/manim_slides/present.py @@ -449,10 +449,7 @@ def run(self) -> None: lag = now() - last_time sleep_time = 1 / self.current_presentation.fps - logger.log( - 5, - f"Took {lag:.3f} seconds to read the next frame, that must play at a rate of one every {sleep_time:.3f} seconds.", - ) + logger.log(5, f"Took {lag:.3f} seconds to process the current frame, that must play at a rate of one every {sleep_time:.3f} seconds.") if sleep_time - lag < 0: logger.warn( From 1b0d71f2c61154390ef86d0dace9db5f2d9d0a42 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 3 May 2023 13:26:58 +0000 Subject: [PATCH 4/7] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- manim_slides/present.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/manim_slides/present.py b/manim_slides/present.py index 84af2db3..133811f4 100644 --- a/manim_slides/present.py +++ b/manim_slides/present.py @@ -449,7 +449,10 @@ def run(self) -> None: lag = now() - last_time sleep_time = 1 / self.current_presentation.fps - logger.log(5, f"Took {lag:.3f} seconds to process the current frame, that must play at a rate of one every {sleep_time:.3f} seconds.") + logger.log( + 5, + f"Took {lag:.3f} seconds to process the current frame, that must play at a rate of one every {sleep_time:.3f} seconds.", + ) if sleep_time - lag < 0: logger.warn( From 7784dab23dd8cfec9aa2383fc25407213daeebcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Eertmans?= Date: Wed, 3 May 2023 15:33:06 +0200 Subject: [PATCH 5/7] chore(version): setup dummy version chore(version): fix --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index e348a640..9baae784 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -43,7 +43,7 @@ packages = [ ] readme = "README.md" repository = "https://github.com/jeertmans/manim-slides" -version = "4.12.0" +version = "4.13.0-alpha" [tool.poetry.dependencies] click = "^8.1.3" From 536811fb60d6be91bffda84a48de06d4155547f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Eertmans?= Date: Wed, 3 May 2023 15:34:32 +0200 Subject: [PATCH 6/7] chore(ci): udpate version in __version__ too --- manim_slides/__version__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manim_slides/__version__.py b/manim_slides/__version__.py index ade1e2b4..10522594 100644 --- a/manim_slides/__version__.py +++ b/manim_slides/__version__.py @@ -1 +1 @@ -__version__ = "4.12.0" +__version__ = "4.13.0-alpha" From 33fa4e70082fc1a76ebbfcfec1303c6a3794a248 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Eertmans?= Date: Thu, 4 May 2023 10:10:37 +0200 Subject: [PATCH 7/7] chore(version): revert changes --- manim_slides/__version__.py | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/manim_slides/__version__.py b/manim_slides/__version__.py index 10522594..ade1e2b4 100644 --- a/manim_slides/__version__.py +++ b/manim_slides/__version__.py @@ -1 +1 @@ -__version__ = "4.13.0-alpha" +__version__ = "4.12.0" diff --git a/pyproject.toml b/pyproject.toml index 9baae784..e348a640 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -43,7 +43,7 @@ packages = [ ] readme = "README.md" repository = "https://github.com/jeertmans/manim-slides" -version = "4.13.0-alpha" +version = "4.12.0" [tool.poetry.dependencies] click = "^8.1.3"