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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
([#5120](https://github.com/open-telemetry/opentelemetry-python/pull/5120))
- Add WeaverLiveCheck test util
([#5088](https://github.com/open-telemetry/opentelemetry-python/pull/5088))
- `opentelemetry-api`: use stdlib `importlib.metadata` on Python >= 3.12
([#5156](https://github.com/open-telemetry/opentelemetry-python/pull/5156))

## Version 1.41.0/0.62b0 (2026-04-09)

Expand Down
4 changes: 1 addition & 3 deletions opentelemetry-api/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ classifiers = [
]
dependencies = [
"typing-extensions >= 4.5.0",
# FIXME This should be able to be removed after 3.12 is released if there is a reliable API
# in importlib.metadata.
"importlib-metadata >= 6.0, < 8.8.0",
"importlib-metadata >= 6.0, < 8.8.0; python_version < '3.12'",
]
dynamic = [
"version",
Expand Down
42 changes: 27 additions & 15 deletions opentelemetry-api/src/opentelemetry/util/_importlib_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,35 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import sys
from functools import cache

# FIXME: Use importlib.metadata (not 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,
requires,
version,
)
from importlib_metadata import (
entry_points as original_entry_points,
)
if sys.version_info >= (3, 12):
from importlib.metadata import (
Distribution,
EntryPoint,
EntryPoints,
PackageNotFoundError,
distributions,
requires,
version,
)
from importlib.metadata import (
entry_points as original_entry_points,
)
else:
from importlib_metadata import (
Distribution,
EntryPoint,
EntryPoints,
PackageNotFoundError,
distributions,
requires,
version,
)
from importlib_metadata import (
entry_points as original_entry_points,
)


@cache
Expand Down
6 changes: 3 additions & 3 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading