Description
Running manimgl on Python 3.13+ shows a warning:
UserWarning: pkg_resources is deprecated as an API...
This is because __init__.py imports pkg_resources only to fetch the version string.
Fix
Replaced:
import pkg_resources
__version__ = pkg_resources.get_distribution("manimgl").version
with:
try:
from importlib.metadata import version, PackageNotFoundError
except ImportError: # For Python <3.8 fallback
from importlib_metadata import version, PackageNotFoundError # type: ignore
try:
__version__ = version("manimgl")
except PackageNotFoundError:
__version__ = "unknown"
This removes the warning and uses the modern, built-in API.
Pull Request
I’ve submitted a PR with this change here: #2389