Repository: ManimCommunity/manim
File: manim/__init__.py (Python)

Code before:
#!/usr/bin/env python

# flake8: noqa

try:
    import importlib.metadata as importlib_metadata
except ModuleNotFoundError:
    import importlib_metadata

__version__ = importlib_metadata.version(__name__)


import sys

# Importing the config module should be the first thing we do, since other
# modules depend on the global config dict for initialization.
from ._config import *

# Workaround to set the renderer passed via CLI args *before* importing
# Manim's classes (as long as the metaclass approach for switching
# between OpenGL and cairo rendering is in place, classes depend
# on the value of config.renderer).
for ind, arg in enumerate(sys.argv):
    if arg.startswith("--renderer"):
        if "=" in arg:
            _, parsed_renderer = arg.split("=")
        else:
            parsed_renderer = sys.argv[ind + 1]
        config.renderer = parsed_renderer


from .animation.animation import *
from .animation.composition import *
from .animation.creation import *
from .animation.fading import *
from .animation.growing import *
from .animation.indication import *
from .animation.movement import *
from .animation.numbers import *
from .animation.rotation import *
from .animation.transform import *
from .animation.transform_matching_parts import *
from .animation.update import *
from .camera.camera import *
from .camera.mapping_camera import *
from .camera.moving_camera import *
from .camera.multi_camera import *
from .camera.three_d_camera import *
from .constants import *

Review comment (suggestion):
Imo as long as `--use_opengl_renderer` and `--use_webgl_renderer` are usable arguments, they should be handled here

Code after:
#!/usr/bin/env python

# flake8: noqa

try:
    import importlib.metadata as importlib_metadata
except ModuleNotFoundError:
    import importlib_metadata

__version__ = importlib_metadata.version(__name__)


import sys

# Importing the config module should be the first thing we do, since other
# modules depend on the global config dict for initialization.
from ._config import *

# Workaround to set the renderer passed via CLI args *before* importing
# Manim's classes (as long as the metaclass approach for switching
# between OpenGL and cairo rendering is in place, classes depend
# on the value of config.renderer).
for i, arg in enumerate(sys.argv):
    if arg.startswith("--renderer"):
        if "=" in arg:
            _, parsed_renderer = arg.split("=")
        else:
            parsed_renderer = sys.argv[i + 1]
        config.renderer = parsed_renderer
    elif arg == "--use_opengl_renderer":
        config.renderer = "opengl"
    elif arg == "--use_webgl_renderer":
        config.renderer = "webgl"


from .animation.animation import *
from .animation.composition import *
from .animation.creation import *
from .animation.fading import *
from .animation.growing import *
from .animation.indication import *
from .animation.movement import *
from .animation.numbers import *
from .animation.rotation import *
from .animation.transform import *
from .animation.transform_matching_parts import *
from .animation.update import *
from .camera.camera import *
from .camera.mapping_camera import *