Skip to content

Gracefully fall back when version metadata is missing #4324

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions manim/__init__.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down