-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Using `pkg_resources` meant that setuptools had to be available during runtime, but this dependency was undeclared. Switch to importlib.metadata which is in stdlib since Python 3.8. Fixes: #8
- Loading branch information
Showing
2 changed files
with
8 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
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,7 +1,10 @@ | ||
# isort: skip_file | ||
from pkg_resources import get_distribution, DistributionNotFound | ||
try: | ||
__version__ = get_distribution(__name__).version | ||
except DistributionNotFound: | ||
from importlib.metadata import version, PackageNotFoundError # type: ignore # isort: skip | ||
except ImportError: | ||
from importlib_metadata import version, PackageNotFoundError # type: ignore # isort: skip | ||
|
||
try: | ||
__version__ = version(__name__) | ||
except PackageNotFoundError: | ||
# package is not installed | ||
pass |