Skip to content

Commit

Permalink
fix: Replace pkg_resources with importlib.metadata (#935)
Browse files Browse the repository at this point in the history
  • Loading branch information
tachikoma-li authored Apr 9, 2024
1 parent 5b21c12 commit 64a2536
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
5 changes: 2 additions & 3 deletions doc/conf.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
"""Sphinx configuration."""

import datetime

import pkg_resources
from importlib.metadata import version

# Sphinx configuration below.
project = "amazon-braket-sdk"
version = pkg_resources.require(project)[0].version
version = version(project)
release = version
copyright = "{}, Amazon.com".format(datetime.datetime.now().year)

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
"amazon-braket-schemas>=1.21.0",
"amazon-braket-default-simulator>=1.21.2",
"oqpy~=0.3.5",
"setuptools",
"backoff",
"boltons",
"boto3>=1.28.53",
Expand All @@ -41,6 +40,7 @@
"openpulse",
"openqasm3",
"sympy",
"backports.entry-points-selectable",
],
extras_require={
"test": [
Expand Down
12 changes: 7 additions & 5 deletions src/braket/devices/local_simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,13 @@

from __future__ import annotations

import sys
from functools import singledispatchmethod
from itertools import repeat
from multiprocessing import Pool
from os import cpu_count
from typing import Any, Optional, Union

import pkg_resources

from braket.ahs.analog_hamiltonian_simulation import AnalogHamiltonianSimulation
from braket.annealing.problem import Problem
from braket.circuits import Circuit
Expand All @@ -39,9 +38,12 @@
from braket.tasks.local_quantum_task import LocalQuantumTask
from braket.tasks.local_quantum_task_batch import LocalQuantumTaskBatch

_simulator_devices = {
entry.name: entry for entry in pkg_resources.iter_entry_points("braket.simulators")
}
if sys.version_info.minor == 9:
from backports.entry_points_selectable import entry_points
else:
from importlib.metadata import entry_points

_simulator_devices = {entry.name: entry for entry in entry_points(group="braket.simulators")}


class LocalSimulator(Device):
Expand Down

0 comments on commit 64a2536

Please sign in to comment.