Skip to content

Commit a2b349b

Browse files
authored
Merge pull request #103 from CQCL/release/1.14
Release/1.14
2 parents 3609f6f + 1ab6bc7 commit a2b349b

15 files changed

+65
-36
lines changed

.github/workflows/build_and_test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -157,4 +157,4 @@ jobs:
157157
steps:
158158
- name: Deploy to GitHub Pages
159159
id: deployment
160-
uses: actions/deploy-pages@v1
160+
uses: actions/deploy-pages@v2
16.3 KB
Loading

.github/workflows/docs/build-docs

+6-3
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,11 @@ def build_module_docs():
4040
mod_docs = MODULES_DIR / "docs"
4141
mod_build = mod_docs / "build"
4242
conf_copy = mod_docs / "conf.py"
43-
logo_copy = mod_docs / "Quantinuum_logo.png"
43+
logo_copy_black = mod_docs / "Quantinuum_logo_black.png"
44+
logo_copy_white = mod_docs / "Quantinuum_logo_white.png"
4445
shutil.copy(DOCS_DIR / "conf.py", conf_copy)
45-
shutil.copy(DOCS_DIR / "Quantinuum_logo.png", logo_copy)
46+
shutil.copy(DOCS_DIR / "Quantinuum_logo_black.png", logo_copy_black)
47+
shutil.copy(DOCS_DIR / "Quantinuum_logo_white.png", logo_copy_white)
4648
remove_dir(mod_build)
4749
index_rst = mod_docs / "index.rst"
4850
with open(mod_docs / "intro.txt", "r") as f:
@@ -81,7 +83,8 @@ def build_module_docs():
8183
fix_links(htmlfile)
8284
fix_links(mod_build / "searchindex.js")
8385
conf_copy.unlink()
84-
logo_copy.unlink()
86+
logo_copy_black.unlink()
87+
logo_copy_white.unlink()
8588
index_rst.unlink()
8689

8790

.github/workflows/docs/conf.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,16 @@
2121
"repository_url": "https://github.com/CQCL/pytket-qiskit",
2222
"use_repository_button": True,
2323
"use_issues_button": True,
24+
"logo": {
25+
"image_light": "Quantinuum_logo_black.png",
26+
"image_dark": "Quantinuum_logo_white.png",
27+
},
2428
}
2529

2630
html_static_path = ["_static"]
2731

2832
html_css_files = ["custom.css"]
2933

30-
html_logo = "Quantinuum_logo.png"
31-
3234
# -- Extension configuration -------------------------------------------------
3335

3436
pytketdoc_base = "https://cqcl.github.io/tket/pytket/api/"
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
sphinx ~= 4.3.2
2-
sphinx_book_theme ~= 0.3.3
2+
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.37.1"
1+
__extension_version__ = "0.38.0"
22
__extension_name__ = "pytket-qiskit"

docs/_static/custom.css

+2-11
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@
1616
background-color: #d9d9d9;
1717
}
1818

19-
.caption-text {
20-
color: #000000;
21-
}
22-
2319
.btn-link:visited,
2420
.btn-link,
2521
a:visited,
@@ -30,13 +26,8 @@ a:visited,
3026
.wy-menu-vertical ul,
3127
.span.pre,
3228
.sig-param,
33-
.std.std-ref,
34-
a {
35-
color: #544d4d;
36-
}
37-
38-
:root {
39-
--pst-color-inline-code: 199, 37, 78 !important;
29+
html[data-theme=light] {
30+
--pst-color-inline-code: rgb(199, 37, 78) !important;
4031
}
4132

4233
.sig-name {

docs/changelog.rst

+8
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
11
Changelog
22
~~~~~~~~~
33

4+
0.38.0 (April 2023)
5+
-------------------
6+
7+
* Fix to ensure that the :py:class:`IBMBackend` and :py:class:`IBMQEmulatorBackend` both properly enforce :py:class:`MaxNQubitsPredicate`.
8+
* Update qiskit version to 0.42.
9+
* Updated pytket version requirement to 1.14.
10+
411
0.37.1 (March 2023)
512
-------------------
13+
614
* Fix backend settings for AerStateBackend and AerUnitaryBackend
715

816
0.37.0 (March 2023)

docs/intro.txt

+6-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,12 @@ The :py:class:`AerBackend` also supports GPU simulation which can be configured
4040
from pytket.extensions.qiskit import AerBackend
4141

4242
backend = AerBackend()
43-
backend._backend.set_option("device", "GPU")
43+
backend._qiskit_backend.set_option("device", "GPU")
44+
45+
.. note:: Making use of GPU simulation requires the qiskit-aer-gpu package. This can be installed with the command
46+
::
47+
48+
pip install qiskit-aer-gpu
4449

4550
Access and Credentials
4651
======================

pytket/extensions/qiskit/backends/ibm.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
GateSetPredicate,
8080
NoClassicalControlPredicate,
8181
NoFastFeedforwardPredicate,
82+
MaxNQubitsPredicate,
8283
Predicate,
8384
)
8485
from pytket.extensions.qiskit.qiskit_convert import tk_to_qiskit, _tk_gate_set
@@ -323,6 +324,7 @@ def available_devices(cls, **kwargs: Any) -> List[BackendInfo]:
323324
def required_predicates(self) -> List[Predicate]:
324325
predicates = [
325326
NoSymbolsPredicate(),
327+
MaxNQubitsPredicate(self._backend_info.n_nodes),
326328
GateSetPredicate(
327329
self._backend_info.gate_set.union(
328330
{
@@ -466,7 +468,7 @@ def process_circuits(
466468
circuits=qcs,
467469
dynamic=self.backend_info.supports_fast_feedforward,
468470
)
469-
job_id = job.job_id
471+
job_id = job.job_id()
470472
for i, ind in enumerate(indices_chunk):
471473
handle_list[ind] = ResultHandle(
472474
job_id, i, qcs[i].count_ops()["measure"], ppcirc_strs[i]

pytket/extensions/qiskit/backends/ibmq_emulator.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ def process_circuits(
177177
options.seed_simulator = kwargs.get("seed")
178178
sampler = Sampler(session=self._session, options=options)
179179
job = sampler.run(circuits=qcs)
180-
job_id = job.job_id
180+
job_id = job.job_id()
181181
for i, ind in enumerate(indices_chunk):
182182
handle_list[ind] = ResultHandle(
183183
job_id, i, c_bit_strs[i], ppcirc_strs[i]

pytket/extensions/qiskit/result_convert.py

+12-10
Original file line numberDiff line numberDiff line change
@@ -77,16 +77,18 @@ def qiskit_experimentresult_to_backendresult(
7777
header = result.header
7878
width = header.memory_slots
7979

80-
c_bits = (
81-
[Bit(name, index) for name, index in header.clbit_labels]
82-
if hasattr(header, "clbit_labels")
83-
else None
84-
)
85-
q_bits = (
86-
[Qubit(name, index) for name, index in header.qubit_labels]
87-
if hasattr(header, "qubit_labels")
88-
else None
89-
)
80+
c_bits, q_bits = None, None
81+
if hasattr(header, "creg_sizes"):
82+
c_bits = []
83+
for name, size in header.creg_sizes:
84+
for index in range(size):
85+
c_bits.append(Bit(name, index))
86+
if hasattr(header, "qreg_sizes"):
87+
q_bits = []
88+
for name, size in header.qreg_sizes:
89+
for index in range(size):
90+
q_bits.append(Qubit(name, index))
91+
9092
shots, counts, state, unitary = (None,) * 4
9193
datadict = result.data.to_dict()
9294
if _result_is_empty_shots(result):

setup.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@
4444
packages=find_namespace_packages(include=["pytket.*"]),
4545
include_package_data=True,
4646
install_requires=[
47-
"pytket ~= 1.13",
48-
"qiskit ~= 0.41.0",
49-
"qiskit-ibm-runtime ~= 0.8.0",
50-
"qiskit-aer ~= 0.11.2",
47+
"pytket ~= 1.14",
48+
"qiskit ~= 0.42.1",
49+
"qiskit-ibm-runtime ~= 0.9.2",
50+
"qiskit-aer ~= 0.12.0",
5151
"numpy",
5252
],
5353
classifiers=[

tests/backend_test.py

+16
Original file line numberDiff line numberDiff line change
@@ -870,6 +870,7 @@ def test_ibmq_emulator(manila_emulator_backend: IBMQEmulatorBackend) -> None:
870870
)
871871
def test_shots_bits_edgecases(n_shots: int, n_bits: int) -> None:
872872
c = Circuit(n_bits, n_bits)
873+
c.measure_all()
873874
aer_backend = AerBackend()
874875

875876
# TODO TKET-813 add more shot based backends and move to integration tests
@@ -1198,3 +1199,18 @@ def test_sim_qubit_order() -> None:
11981199
circ.X(Qubit("a", 0))
11991200
s = backend.run_circuit(circ).get_state()
12001201
assert np.isclose(abs(s[2]), 1.0)
1202+
1203+
1204+
@pytest.mark.skipif(skip_remote_tests, reason=REASON)
1205+
def test_requrired_predicates(manila_emulator_backend: IBMQEmulatorBackend) -> None:
1206+
# https://github.com/CQCL/pytket-qiskit/issues/93
1207+
circ = Circuit(7) # 7 qubit circuit in IBMQ gateset
1208+
circ.X(0).CX(0, 1).CX(0, 2).CX(0, 3).CX(0, 4).CX(0, 5).CX(0, 6).measure_all()
1209+
with pytest.raises(CircuitNotValidError) as errorinfo:
1210+
manila_emulator_backend.run_circuit(circ, n_shots=100)
1211+
assert (
1212+
"pytket.backends.backend_exceptions.CircuitNotValidError:"
1213+
+ "Circuit with index 0 in submitted does"
1214+
+ "not satisfy MaxNQubitsPredicate(5)"
1215+
in str(errorinfo)
1216+
)

0 commit comments

Comments
 (0)