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

Use qiskit.qpy.QPY_VERSION (up to 13) instead of always QPY 11 #2096

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 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: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ dependencies = [
"websocket-client>=1.5.1",
"ibm-platform-services>=0.22.6",
"pydantic>=2.5.0,<2.10",
"qiskit>=1.1.0",
"qiskit>=1.3",
]

[project.entry-points."qiskit.transpiler.translation"]
Expand Down
16 changes: 3 additions & 13 deletions qiskit_ibm_runtime/utils/json.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import inspect
import io
import json
import re
import warnings
import zlib
from datetime import date
Expand Down Expand Up @@ -54,8 +53,7 @@
from qiskit.transpiler import CouplingMap
from qiskit.circuit.parametertable import ParameterView
from qiskit.result import Result
from qiskit.version import __version__ as _terra_version_string
from qiskit.utils import optionals
from qiskit.qpy import QPY_VERSION as QISKIT_QPY_VERSION
from qiskit.qpy import (
load,
dump,
Expand Down Expand Up @@ -86,10 +84,6 @@

from .noise_learner_result import NoiseLearnerResult

_TERRA_VERSION = tuple(
int(x) for x in re.match(r"\d+\.\d+\.\d", _terra_version_string).group(0).split(".")[:3]
)


def to_base64_string(data: str) -> str:
"""Convert string to base64 string.
Expand Down Expand Up @@ -258,9 +252,7 @@ def default(self, obj: Any) -> Any: # pylint: disable=arguments-differ
if hasattr(obj, "to_json"):
return {"__type__": "to_json", "__value__": obj.to_json()}
if isinstance(obj, QuantumCircuit):
kwargs: Dict[str, object] = {"use_symengine": bool(optionals.HAS_SYMENGINE)}
if _TERRA_VERSION[0] >= 1:
kwargs["version"] = 11
kwargs: Dict[str, object] = {"version": min(13, QISKIT_QPY_VERSION)}
value = _serialize_and_encode(
data=obj,
serializer=lambda buff, data: dump(
Expand All @@ -278,9 +270,7 @@ def default(self, obj: Any) -> Any: # pylint: disable=arguments-differ
if isinstance(obj, ParameterView):
return obj.data
if isinstance(obj, Instruction):
kwargs = {"use_symengine": bool(optionals.HAS_SYMENGINE)}
if _TERRA_VERSION[0] >= 1:
kwargs["version"] = 11
kwargs = {"version": min(13, QISKIT_QPY_VERSION)}
# Append instruction to empty circuit
quantum_register = QuantumRegister(obj.num_qubits)
quantum_circuit = QuantumCircuit(quantum_register)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
upgrade:
- |
The minimal ``qiskit`` version is now 1.3.
- |
The QPY payload now is generated based on ``qiskit.qpy.QPY_VERSION`` and capped until version 13.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We switched to using towncrier for our release notes - https://github.com/Qiskit/qiskit-ibm-runtime/blob/main/CONTRIBUTING.md#adding-a-new-release-note. You can add a release note to the /unreleased folder with a file name of 2096.upgrade.rst.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops, fixed in fbdc01e

Loading