Skip to content

Commit 5c03735

Browse files
authored
Merge pull request #128 from CQCL/release/0.40.0
Release/0.40.0
2 parents 12ca6d7 + bcdb062 commit 5c03735

18 files changed

+500
-212
lines changed

.github/workflows/docs/intro.txt

-10
This file was deleted.
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
sphinx ~= 4.3.2
1+
sphinx >= 4.3.2, <6.2.0
22
sphinx_book_theme >= 1.0.1, <2.0
33
sphinx-copybutton

_metadata.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
__extension_version__ = "0.39.0"
1+
__extension_version__ = "0.40.0"
22
__extension_name__ = "pytket-qiskit"

docs/changelog.rst

+15-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,25 @@
11
Changelog
22
~~~~~~~~~
33

4+
0.40.0 (June 2023)
5+
------------------
6+
7+
* IBM devices are now accessed using the `qiskit-ibm-provider <https://github.com/Qiskit/qiskit-ibm-provider>`_ instead of the deprecated :py:class:`IBMQ`. This allows the newest IBM devices and simulators to be accessed through ``pytket-qiskit``. See the updated documentation on `credentials <https://cqcl.github.io/pytket-qiskit/api/index.html#access-and-credentials>`_.
8+
* The parameters ``hub``, ``group`` and ``project`` are no longer handled as separate arguments in :py:class:`IBMQBackend` and :py:meth:`IBMQBackend.available_devices`. Use ``"instance=f"{hub}/{group}/{project}"`` instead.
9+
* Added support for the {X, SX, Rz, ECR} in the default compilation pass for :py:class:`IBMQBackend` and :py:class:`IBMQEmulatorBackend`. This is the set of gates used by some of the new IBM devices.
10+
* Fix to the :py:meth:`tk_to_qiskit` converter to prevent cancellation of redundant gates when converting to qiskit.
11+
* Handle qiskit circuits with :py:class:`Initialize` and :py:class:`StatePreparation` instructions in the :py:meth:`qiskit_to_tk` converter. The :py:meth:`tk_to_qiskit` converter now handles :py:class:`StatePreparationBox`.
12+
* Fix handling of control state in :py:meth:`qiskit_to_tk`.
13+
* Update qiskit version to 0.43.1
14+
* Update qiskit-ibm-runtime version to 0.11.1
15+
* Update qiskit-ibm-provider version to 0.6.1
16+
* Update pytket version to 1.16
17+
418
0.39.0 (May 2023)
519
-----------------
620

721
* Updated pytket version requirement to 1.15.
8-
* The get_compiled_circuit method now allows for optional arguments to override the default settings in the NoiseAwarePlacement
22+
* The :py:meth:`IBMQBackend.get_compiled_circuit` method now allows for optional arguments to override the default settings in the :py:class:`NoiseAwarePlacement`.
923

1024
0.38.0 (April 2023)
1125
-------------------

docs/intro.txt

+16-8
Original file line numberDiff line numberDiff line change
@@ -50,45 +50,53 @@ The :py:class:`AerBackend` also supports GPU simulation which can be configured
5050
Access and Credentials
5151
======================
5252

53-
With the exception of the Aer simulators, accessing devices and simulators through the ``pytket-qiskit`` extension requires an IBMQ account. An account can be set up here: https://quantum-computing.ibm.com/login.
53+
With the exception of the Aer simulators, accessing devices and simulators through the ``pytket-qiskit`` extension requires an IBM account. An account can be set up here: https://quantum-computing.ibm.com/login.
5454

5555
Once you have created an account you can obtain an API token which you can use to configure your credentials locally.
5656

57+
.. note:: The documentation below is correct as of pytket-qiskit version 0.40.0. In the 0.40.0 release pytket-qiskit moved to using the `qiskit-ibm-provider <https://qiskit.org/ecosystem/ibm-provider/tutorials/Migration_Guide_from_qiskit-ibmq-provider.html>`_. In pytket-qiskit versions 0.39.0 and older the parameters ``hub``, ``group`` and ``project`` were handled separately instead of a single ``instance`` string as in 0.40.0 and newer.
58+
5759
::
5860

5961
from pytket.extensions.qiskit import set_ibmq_config
6062

6163
set_ibmq_config(ibmq_api_token=ibm_token)
6264

63-
This will save your IBMQ credentials locally. After saving your credentials you can access ``pytket-qiskit`` backend repeatedly without having to re-initialise your credentials.
65+
After saving your credentials you can access ``pytket-qiskit`` backend repeatedly without having to re-initialise your credentials.
6466

6567
If you are a member of an IBM hub then you can add this information to ``set_ibmq_config`` as well.
6668

6769
::
6870

6971
from pytket.extensions.qiskit import set_ibmq_config
7072

71-
set_ibmq_config(ibmq_api_token=ibm_token, hub='your hub', group='your group', project='your project')
73+
set_ibmq_config(ibmq_api_token=ibm_token, instance=f"{hub}/{group}/{project}")
7274

7375
Alternatively you can use the following qiskit commands to save your credentials
7476
locally without saving the token in pytket config:
7577

78+
.. note:: If using pytket-qiskit 0.39.0 or older you will have to use the deprecated :py:meth:`IBMQ.save_account` instead of :py:meth:`IBMProvider.save_account` in the code below.
79+
7680
::
7781

78-
from qiskit import IBMQ
82+
from qiskit_ibm_provider import IBMProvider
7983
from qiskit_ibm_runtime import QiskitRuntimeService
8084

81-
IBMQ.save_account(token=ibm_token)
85+
IBMProvider.save_account(token=ibm_token)
8286
QiskitRuntimeService.save_account(channel="ibm_quantum", token=ibm_token)
8387

84-
To see which devices you can access you can use the ``available_devices`` method on the :py:class:`IBMQBackend` or :py:class:`IBMQEmulatorBackend`. Note that it is possible to pass ``hub``, ``group`` and ``project`` parameters to this method. This allows you to see which devices are accessible through your IBM hub.
88+
To see which devices you can access you can use the ``available_devices`` method on the :py:class:`IBMQBackend` or :py:class:`IBMQEmulatorBackend`. Note that it is possible to pass optional ``instance`` and ``provider`` arguments to this method. This allows you to see which devices are accessible through your IBM hub.
8589

8690
::
8791

8892
from pytket.extensions.qiskit import IBMQBackend
93+
from qiskit_ibm_provider import IBMProvider
8994

90-
backend = IBMQBackend # Initialise backend for an IBM device
91-
backend.available_devices(hub='your hub', group='your group', project='your project')
95+
my_instance=f"{hub}/{group}/{project}"
96+
ibm_provider = IBMProvider(instance=my_instance)
97+
backend = IBMQBackend("ibmq_belem") # Initialise backend for an IBM device
98+
backendinfo_list = backend.available_devices(instance=my_instance, provider=ibm_provider)
99+
print([backend.device_name for backend in backendinfo_list])
92100

93101

94102
Backends Available Through pytket-qiskit

pytket/extensions/qiskit/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from ._metadata import __extension_version__, __extension_name__ # type: ignore
1818
from .backends import (
1919
IBMQBackend,
20-
NoIBMQAccountError,
20+
NoIBMQCredentialsError,
2121
AerBackend,
2222
AerStateBackend,
2323
AerUnitaryBackend,

pytket/extensions/qiskit/backends/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@
1313
# limitations under the License.
1414
"""Backends for connecting to IBM devices and simulators directly from pytket"""
1515

16-
from .ibm import IBMQBackend, NoIBMQAccountError
16+
from .ibm import IBMQBackend, NoIBMQCredentialsError
1717
from .aer import AerBackend, AerStateBackend, AerUnitaryBackend
1818
from .ibmq_emulator import IBMQEmulatorBackend

pytket/extensions/qiskit/backends/config.py

+5-15
Original file line numberDiff line numberDiff line change
@@ -23,39 +23,29 @@ class QiskitConfig(PytketExtConfig):
2323

2424
ext_dict_key: ClassVar[str] = "qiskit"
2525

26-
hub: Optional[str]
27-
group: Optional[str]
28-
project: Optional[str]
26+
instance: Optional[str]
2927
ibmq_api_token: Optional[str]
3028

3129
@classmethod
3230
def from_extension_dict(
3331
cls: Type["QiskitConfig"], ext_dict: Dict[str, Any]
3432
) -> "QiskitConfig":
3533
return cls(
36-
ext_dict.get("hub", None),
37-
ext_dict.get("group", None),
38-
ext_dict.get("project", None),
34+
ext_dict.get("instance", None),
3935
ext_dict.get("ibmq_api_token", None),
4036
)
4137

4238

4339
def set_ibmq_config(
44-
hub: Optional[str] = None,
45-
group: Optional[str] = None,
46-
project: Optional[str] = None,
40+
instance: Optional[str] = None,
4741
ibmq_api_token: Optional[str] = None,
4842
) -> None:
4943
"""Set default values for any of hub, group, project or API token
5044
for your IBMQ provider. Can be overridden in backend construction."""
5145

5246
config = QiskitConfig.from_default_config_file()
53-
if hub is not None:
54-
config.hub = hub
55-
if group is not None:
56-
config.group = group
57-
if project is not None:
58-
config.project = project
47+
if instance is not None:
48+
config.instance = instance
5949
if ibmq_api_token is not None:
6050
config.ibmq_api_token = ibmq_api_token
6151
config.update_default_config_file()

0 commit comments

Comments
 (0)