Repository: ManimCommunity/manim
File: manim/cli/render/commands.py (Python)

Code before:
            except Exception:
                console.print_exception()
    elif config.renderer == "webgl":
        try:
            from manim.grpc.impl import frame_server_impl

            server = frame_server_impl.get(file)
            server.start()
            server.wait_for_termination()
        except ModuleNotFoundError:
            console.print(
                "Dependencies for the WebGL render are missing. Run "
                "pip install manim[webgl_renderer] to install them."
            )
            console.print_exception()
    else:
        for SceneClass in scene_classes_from_file(file):
            try:
                scene = SceneClass()
                scene.render()
            except Exception:
                console.print_exception()

    if config.notify_outdated_version or args["notify_outdated_version"]:
        manim = requests.get("https://pypi.org/pypi/manim/json")
        releases = manim.json()["releases"].keys()
        stable = max(releases)

        if stable != __version__:
            console.print(
                f"You are using manim version [red]v{__version__}[/red], but version [green]v{stable}[/green] is available."
            )
            console.print(
                "You should consider upgrading via [yellow]pip install -U manim[/yellow]"
            )

    return args


Review comment (bug):
Two comments regarding these two lines:

- I'm not particularly fond of a variable named `manim` and would prefer if it were renamend (I won't block the PR over it though),
- Given that `requests.get` raises an exception when the request fails (`pypi.org` could be down, or no internet connection could be available), I think it should be handled and a warning should be logged instead informing the user that it could not be checked whether the installed version is the latest. (I think this is actually important and I'd like to have that implemented before merging.)

Code after:
                scene.render()
            except Exception:
                console.print_exception()
    elif config.renderer == "webgl":
        try:
            from manim.grpc.impl import frame_server_impl

            server = frame_server_impl.get(file)
            server.start()
            server.wait_for_termination()
        except ModuleNotFoundError:
            console.print(
                "Dependencies for the WebGL render are missing. Run "
                "pip install manim[webgl_renderer] to install them."
            )
            console.print_exception()
    else:
        for SceneClass in scene_classes_from_file(file):
            try:
                scene = SceneClass()
                scene.render()
            except Exception:
                console.print_exception()

    if config.notify_outdated_version:
        manim_info_url = "https://pypi.org/pypi/manim/json"
        warn_prompt = "Cannot check if latest release of manim is installed"
        req_info = {}

        try:
            req_info = requests.get(manim_info_url)
            req_info.raise_for_status()
        except requests.exceptions.HTTPError:
            logger.debug(f"HTTP Error: {warn_prompt}")
        except requests.exceptions.ConnectionError:
            logger.debug(f"Connection Error: {warn_prompt}")
        except requests.exceptions.Timeout:
            logger.debug(f"Timed Out: {warn_prompt}")
        except Exception:
            logger.debug(f"Something went wrong: {warn_prompt}")

        try:
            stable = req_info.json()["info"]["version"]

            if stable != __version__:
                console.print(
                    f"You are using manim version [red]v{__version__}[/red], but version [green]v{stable}[/green] is available."
                )
                console.print(
                    "You should consider upgrading via [yellow]pip install -U manim[/yellow]"
                )