Skip to content

Commit f63ba71

Browse files
Gracefully fall back when version metadata is missing (#4324)
* Update __init__.py * Update manim/__init__.py Co-authored-by: Benjamin Hackl <[email protected]> --------- Co-authored-by: Benjamin Hackl <[email protected]>
1 parent a234ff3 commit f63ba71

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

manim/__init__.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
11
#!/usr/bin/env python
22
from __future__ import annotations
33

4-
from importlib.metadata import version
4+
from importlib.metadata import PackageNotFoundError, version
55

6-
__version__ = version(__name__)
6+
# Use installed distribution version if available; otherwise fall back to a
7+
# sensible default so that importing from a source checkout works without an
8+
# editable install (pip install -e .).
9+
try:
10+
__version__ = version(__name__)
11+
except PackageNotFoundError:
12+
# Package is not installed; provide a fallback version string.
13+
__version__ = "0.0.0+unknown"
714

815

916
# isort: off

0 commit comments

Comments
 (0)