-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from pupil-labs/importlib
Use importlib to read version instead of writing it to a file
- Loading branch information
Showing
4 changed files
with
13 additions
and
14 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 |
---|---|---|
@@ -1,6 +1,14 @@ | ||
"""Top-level entry-point for the <project_name> package""" | ||
|
||
# .version is generated on install via setuptools_scm, see pyproject.toml | ||
from .version import __version__, __version_info__ | ||
try: | ||
from importlib.metadata import PackageNotFoundError, version | ||
except ImportError: | ||
from importlib_metadata import PackageNotFoundError, version | ||
|
||
__all__ = ["__version__", "__version_info__"] | ||
try: | ||
__version__ = version("pupil_labs.project_name") | ||
except PackageNotFoundError: | ||
# package is not installed | ||
pass | ||
|
||
__all__ = ["__version__"] |
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