chore(lib): reduce import overhead (#147)

* chore(lib): reduce import overhead

This PR should reduce the import time overhead caused by manim imports. To solve this, manim is only imported when Slide or ThreeDSlide is needed. A custom logger is now defined, which copies the one from Manim Community. FFMPEG_BIN is now hardcoded, but should be configurable in the future via the CLI or some config file.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix(lib): remove last .manim import

* fix(lib): remove print

* chore(lib): fix typo

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
Jérome Eertmans
2023-03-08 16:56:51 +01:00
committed by GitHub
parent a440da9468
commit 700584cbcc
10 changed files with 1671 additions and 1564 deletions

View File

@ -4,9 +4,9 @@ import click
import requests
from click_default_group import DefaultGroup
from . import __version__
from .__version__ import __version__
from .convert import convert
from .manim import logger
from .logger import make_logger
from .present import list_scenes, present
from .wizard import init, wizard
@ -27,6 +27,7 @@ def cli(notify_outdated_version: bool) -> None:
If no command is specified, defaults to `present`.
"""
logger = make_logger()
# Code below is mostly a copy from:
# https://github.com/ManimCommunity/manim/blob/main/manim/cli/render/commands.py
if notify_outdated_version: