-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Version 0.7.0 release * Fix CI * Fix flake8
- Loading branch information
Showing
6 changed files
with
40 additions
and
27 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
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
from typing import Optional, Tuple | ||
|
||
try: # pragma: no cover | ||
from importlib.metadata import version as metadata_version | ||
except ImportError: # pragma: no cover | ||
from importlib_metadata import version as metadata_version # type: ignore | ||
|
||
from packaging import version | ||
|
||
|
||
def package_version( | ||
package: str, | ||
) -> Optional[Tuple[int, ...]]: | ||
""" | ||
Helper function that fetches distribution version. | ||
Can throw multiple exceptions. | ||
Be careful, use ``is_installed`` before using this one. | ||
Returns parsed varsion to be easily worked with. | ||
""" | ||
return version.parse(metadata_version(package)).release |
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
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