Skip to content

Commit

Permalink
More general dynamic versioning
Browse files Browse the repository at this point in the history
  • Loading branch information
urschrei committed Oct 1, 2023
1 parent bbea5f4 commit 86e2d4d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/simplification/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from importlib.metadata import version, PackageNotFoundError
import importlib.metadata

try:
__version__ = version("simplification")
except PackageNotFoundError:
# If the package is not installed, don't add __version__
pass
# __package__ allows for the case where __name__ is "__main__"
__version__ = importlib.metadata.version(__package__ or __name__)
except importlib.metadata.PackageNotFoundError:
__version__ = "0.0.0"

0 comments on commit 86e2d4d

Please sign in to comment.