Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more symbols to opentelemetry.util._importlib_metadata #4181

Merged
merged 2 commits into from
Sep 11, 2024
Merged
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
20 changes: 14 additions & 6 deletions opentelemetry-api/src/opentelemetry/util/_importlib_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,23 @@
# FIXME: Use importlib.metadata when support for 3.11 is dropped if the rest of
# the supported versions at that time have the same API.
from importlib_metadata import ( # type: ignore
Distribution,
EntryPoint,
EntryPoints,
PackageNotFoundError,
distributions,
entry_points,
requires,
version,
)

# The importlib-metadata library has introduced breaking changes before to its
# API, this module is kept just to act as a layer between the
# importlib-metadata library and our project if in any case it is necessary to
# do so.

__all__ = ["entry_points", "version", "EntryPoint", "EntryPoints"]
__all__ = [
"entry_points",
"version",
"EntryPoint",
"EntryPoints",
"requires",
"Distribution",
"distributions",
"PackageNotFoundError",
]
3 changes: 3 additions & 0 deletions opentelemetry-api/tests/util/test__importlib_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from opentelemetry.util._importlib_metadata import (
entry_points as importlib_metadata_entry_points,
)
from opentelemetry.util._importlib_metadata import version


class TestEntryPoints(TestCase):
Expand Down Expand Up @@ -106,3 +107,5 @@ def test_uniform_behavior(self):
entry_points = importlib_metadata_entry_points(group="abc", name="abc")
self.assertIsInstance(entry_points, EntryPoints)
self.assertEqual(len(entry_points), 0)

self.assertIsInstance(version("opentelemetry-api"), str)