Skip to content

Commit

Permalink
Korrektur init.py
Browse files Browse the repository at this point in the history
  • Loading branch information
dornech committed Nov 17, 2024
1 parent 1bfee01 commit 26374c1
Showing 1 changed file with 28 additions and 6 deletions.
34 changes: 28 additions & 6 deletions src/pytestdornech/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,33 @@
Notion-API: https://developers.notion.com/reference/intro
"""

from importlib.metadata import PackageNotFoundError, version
#from importlib.metadata import PackageNotFoundError, version
#
#try:
# __version__ = version('pytestdornech')
#except PackageNotFoundError: # pragma: no cover
# __version__ = 'unknown'
#finally:
# del version, PackageNotFoundError


# up-to-date version tag for modules installed in editable mode inspired by
# https://github.com/maresb/hatch-vcs-footgun-example/blob/main/hatch_vcs_footgun_example/__init__.py
# Define the variable '__version__':
try:
__version__ = version('pytestdornech')
except PackageNotFoundError: # pragma: no cover
__version__ = 'unknown'
finally:
del version, PackageNotFoundError
# If setuptools_scm is installed (e.g. in a development environment with
# an editable install), then use it to determine the version dynamically.
from setuptools_scm import get_version
# This will fail with LookupError if the package is not installed in
# editable mode or if Git is not installed.
__version__ = get_version(root="..", relative_to=__file__)
except (ImportError, LookupError):
# As a fallback, use the version that is hard-coded in the file.
try:
from ._version import __version__ # noqa: F401
except ModuleNotFoundError:
# The user is probably trying to run this without having installed the
# package, so complain.
raise RuntimeError(
f"Package {__package__} is not correctly installed. Please install it with pip."
)

0 comments on commit 26374c1

Please sign in to comment.