Skip to content

Commit

Permalink
bugfixing (#10452)
Browse files Browse the repository at this point in the history
(cherry picked from commit 6143c3f)
  • Loading branch information
1ucian0 authored and mergify[bot] committed Jul 24, 2023
1 parent 97e1808 commit ceb1eef
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions qiskit/tools/jupyter/version_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,14 @@ def qiskit_version_table(self, line="", cell=None):
html += "<table>"
html += "<tr><th>Software</th><th>Version</th></tr>"

packages = {}
packages = {"qiskit": None}

packages["qiskit-terra"] = qiskit.__version__

qiskit_modules = {module.split(".")[0] for module in modules.keys() if "qiskit" in module}

for qiskit_module in qiskit_modules:
packages[qiskit_module] = getattr(modules[qiskit_module], "__version__", None)

from importlib.metadata import metadata, PackageNotFoundError

Expand All @@ -45,14 +52,9 @@ def qiskit_version_table(self, line="", cell=None):
except PackageNotFoundError:
packages["qiskit"] = None

packages["qiskit-terra"] = qiskit.__version__

qiskit_modules = {module.split(".")[0] for module in modules.keys() if "qiskit" in module}
for qiskit_module in qiskit_modules:
packages[qiskit_module] = getattr(modules[qiskit_module], "__version__", None)

for name, version in packages.items():
html += f"<tr><td><code>{name}</code></td><td>{version}</td></tr>"
if name == "qiskit" or version:
html += f"<tr><td><code>{name}</code></td><td>{version}</td></tr>"

html += "<tr><th colspan='2'>System information</th></tr>"

Expand Down

0 comments on commit ceb1eef

Please sign in to comment.