Skip to content

Commit

Permalink
Fallback to importlib_metadata for entry_points() for compat
Browse files Browse the repository at this point in the history
  • Loading branch information
randomir committed Jun 17, 2024
1 parent 30d6949 commit 41c46a6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
7 changes: 4 additions & 3 deletions dwave/cloud/utils/dist.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@
"""

from importlib.metadata import (
entry_points, EntryPoint, Distribution, PackageNotFoundError)
from typing import Dict, List, OrderedDict, Union
EntryPoint, Distribution, PackageNotFoundError)
from typing import List, OrderedDict, Union

from importlib_metadata import entry_points
from packaging.requirements import Requirement

__all__ = ['get_distribution', 'PackageNotFoundError', 'VersionNotFoundError']
Expand All @@ -30,7 +31,7 @@
def get_contrib_config() -> List[EntryPoint]:
"""Return all registered contrib (non-open-source) Ocean packages."""

# Note: we use `entry_points` from `importlib_metadata` to simplify access
# Note: we use `entry_points` from `importlib_metadata>=5` to simplify access
# and use py312 semantics. See "compatibility note" in `importlib.metadata`
# docs for entry points.
contrib = [ep.load() for ep in entry_points(group='dwave_contrib')]
Expand Down
6 changes: 6 additions & 0 deletions releasenotes/notes/fix-entry-points-62622b9b1d2c0190.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
fixes:
- |
Fix a regression bug introduced during utils module refactor and keep using
``importlib_metadata`` for ``entry_points()`` access.
See `#631 <https://github.com/dwavesystems/dwave-cloud-client/issues/631>`_.

0 comments on commit 41c46a6

Please sign in to comment.