Skip to content

Commit

Permalink
Add package version to meta package
Browse files Browse the repository at this point in the history
  • Loading branch information
wpreimes committed Nov 10, 2023
1 parent f4c8396 commit fa857b7
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 20 deletions.
35 changes: 15 additions & 20 deletions src/qa4sm_reader/__init__.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
# -*- coding: utf-8 -*-
import sys

# __author__ = "Lukas Racbhauer"
# __copyright__ = "2019, TU Wien, Department of Geodesy and Geoinformation"
# __license__ = "mit"
#
#
# from pkg_resources import get_distribution, DistributionNotFound
# from qa4sm_reader import ncplot
#
# __all__ = ['ncplot']
#
# try:
# # Change here if project is renamed and does not equal the package name
# dist_name = __name__
# __version__ = get_distribution(dist_name).__version
# except DistributionNotFound:
# __version__ = 'unknown'
# finally:
# del get_distribution, DistributionNotFound
#
if sys.version_info[:2] >= (3, 8):
# TODO: Import directly (no need for conditional) when `python_requires = >= 3.8`
from importlib.metadata import PackageNotFoundError, version # pragma: no cover
else:
from importlib_metadata import PackageNotFoundError, version # pragma: no cover

try:
# Change here if project is renamed and does not equal the package name
dist_name = __name__
__version__ = version(dist_name)
except PackageNotFoundError: # pragma: no cover
__version__ = "unknown"
finally:
del version, PackageNotFoundError
4 changes: 4 additions & 0 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import qa4sm_reader

def test_get_version():
assert qa4sm_reader.__version__ != 'unknown'

0 comments on commit fa857b7

Please sign in to comment.