Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
6 changes: 2 additions & 4 deletions elasticapm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
import sys
import importlib.metadata

from elasticapm.base import Client, get_client # noqa: F401
from elasticapm.conf import setup_logging # noqa: F401
Expand All @@ -54,10 +55,7 @@
_activation_method = None

try:
try:
VERSION = __import__("importlib.metadata").metadata.version("elastic-apm")
except ImportError:
VERSION = __import__("pkg_resources").get_distribution("elastic-apm").version
VERSION = importlib.metadata.version("elastic-apm")
except Exception:
VERSION = "unknown"

Expand Down
3 changes: 0 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,8 @@
import codecs
import os

import pkg_resources
from setuptools import setup

pkg_resources.require("setuptools>=39.2")


def get_version():
"""
Expand Down
4 changes: 4 additions & 0 deletions tests/client/client_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -558,3 +558,7 @@ def test_user_agent(elasticapm_client, expected):

def test_label_without_client():
elasticapm.label(foo="foo")


def test_version_is_not_unknown():
assert elasticapm.VERSION != "unknown"
Loading