Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions anthem/__init__.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
# Copyright 2016 Camptocamp SA
# Copyright 2026 XCG SAS
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl-3.0.en.html)

from pkg_resources import get_distribution, DistributionNotFound
try:
# python 3.8+
from importlib.metadata import PackageNotFoundError, distribution
except ModuleNotFoundError:
from importlib_metadata import ( # type: ignore[import,no-redef,assignment]
PackageNotFoundError,
distribution,
)

try:
__version__ = get_distribution(__name__).version
except DistributionNotFound:
# package is not installed
pass
__version__ = distribution("anthem").version
except PackageNotFoundError:
__version__ = "dev"

# publish the decorator so we can use 'anthem.log'
from .output import log # noqa
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
license="LGPLv3+",
packages=find_packages(exclude=("tests", "docs")),
entry_points={"console_scripts": ["anthem = anthem.cli:main"]},
install_requires=[ "unicodecsv"],
install_requires=["unicodecsv", "importlib_metadata; python_version<'3.8'"],
setup_requires=[
"setuptools_scm",
],
Expand Down
Loading