Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Gracefully fall back when version metadata is missing (#4324)

S. M. Mohiuddin Khan Shiamf63ba71f0445
diff --git a/manim/__init__.py b/manim/__init__.py
index a4034ed13..0605d4a3a 100644
--- a/manim/__init__.py
+++ b/manim/__init__.py
@@ -1,9 +1,16 @@
#!/usr/bin/env python
from __future__ import annotations
-from importlib.metadata import version
+from importlib.metadata import PackageNotFoundError, version
-__version__ = version(__name__)
+# Use installed distribution version if available; otherwise fall back to a
+# sensible default so that importing from a source checkout works without an
+# editable install (pip install -e .).
+try:
+ __version__ = version(__name__)
+except PackageNotFoundError:
+ # Package is not installed; provide a fallback version string.
+ __version__ = "0.0.0+unknown"
# isort: off