-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use importlib.metadata rather than pkg_resources (#97)
* Use importlib.metadata rather than pkg_resources for dynamic version metadata Co-authored-by: Max Jones <[email protected]>
- Loading branch information
1 parent
57cb69c
commit c92e7d5
Showing
2 changed files
with
8 additions
and
5 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,11 +1,14 @@ | ||
from pkg_resources import DistributionNotFound, get_distribution | ||
from importlib.metadata import ( | ||
PackageNotFoundError as _PackageNotFoundError, | ||
version as _version, | ||
) | ||
|
||
from .accessors import BatchAccessor # noqa: F401 | ||
from .generators import BatchGenerator # noqa: F401 | ||
from .util.print_versions import show_versions # noqa: F401 | ||
|
||
try: | ||
__version__ = get_distribution(__name__).version | ||
except DistributionNotFound: # noqa: F401; pragma: no cover | ||
__version__ = _version(__name__) | ||
except _PackageNotFoundError: | ||
# package is not installed | ||
pass | ||
__version__ = 'unknown' |