-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update how we access importlib metadata
- Loading branch information
jschaff
committed
Oct 28, 2024
1 parent
4504cf7
commit 691461a
Showing
1 changed file
with
12 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,13 @@ | ||
import importlib.metadata | ||
""" | ||
Package versioning using PEP-376 | ||
https://peps.python.org/pep-0396/#pep-376-metadata | ||
""" | ||
|
||
# https://peps.python.org/pep-0396/#pep-376-metadata | ||
distribution_name = "biothings_client" | ||
__version__ = importlib.metadata.version(distribution_name) | ||
try: | ||
from importlib import metadata | ||
except ImportError: | ||
# Running on pre-3.8 Python; use importlib-metadata package | ||
import importlib_metadata as metadata # type: ignore | ||
|
||
DISTRIBUTION_NAME = "biothings_client" | ||
__version__ = metadata.version(DISTRIBUTION_NAME) |