Skip to content

Commit

Permalink
Merge pull request #59 from CQCL/release/1-11-0
Browse files Browse the repository at this point in the history
Release/1 11 0
  • Loading branch information
cqc-melf committed Jan 18, 2023
2 parents 2c41e11 + a5d7a89 commit 9494d93
Show file tree
Hide file tree
Showing 30 changed files with 252 additions and 163 deletions.
24 changes: 12 additions & 12 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,40 +33,40 @@ jobs:
with:
fetch-depth: '0'
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* +refs/heads/*:refs/remotes/origin/*
- name: Set up Python 3.8
- name: Set up Python 3.9
if: github.event_name == 'push' || github.event_name == 'schedule'
uses: actions/setup-python@v4
with:
python-version: '3.8'
- name: Build and test (3.8)
python-version: '3.9'
- name: Build and test (3.9)
if: github.event_name == 'push' || github.event_name == 'schedule'
shell: bash
run: |
./.github/workflows/build-test nomypy
- name: Set up Python 3.9
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Build and test including remote checks (3.9) mypy
python-version: '3.10'
- name: Build and test including remote checks (3.10) mypy
if: (matrix.os == 'macos-12') && (github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) || github.event_name == 'release' || github.event_name == 'schedule' )
shell: bash
run: |
./.github/workflows/build-test mypy
env:
PYTKET_RUN_REMOTE_TESTS: 1
- name: Build and test including remote checks (3.9) nomypy
- name: Build and test including remote checks (3.10) nomypy
if: (matrix.os != 'macos-12') && (github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) || github.event_name == 'release' || github.event_name == 'schedule')
shell: bash
run: |
./.github/workflows/build-test nomypy
env:
PYTKET_RUN_REMOTE_TESTS: 1
- name: Set up Python 3.10
- name: Set up Python 3.11
if: github.event_name == 'push' || github.event_name == 'pull_request' || github.event_name == 'schedule'
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Build and test (3.10)
python-version: '3.11'
- name: Build and test (3.11)
if: github.event_name == 'push' || github.event_name == 'pull_request' || github.event_name == 'schedule'
shell: bash
run: |
Expand Down Expand Up @@ -117,10 +117,10 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: '0'
- name: Set up Python 3.9
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: '3.9'
python-version: '3.10'
- name: Download all wheels
uses: actions/download-artifact@v3
with:
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,14 @@ jobs:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.9
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: 3.9
python-version: '3.10'
- name: Upgrade pip and install wheel
run: pip install --upgrade pip wheel
- name: Install pytket qiskit
run: |
pip install .
run: pip install .
- name: Install docs dependencies
run: |
pip install -r .github/workflows/docs/requirements.txt
Expand Down
Binary file modified .github/workflows/docs/Quantinuum_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 6 additions & 7 deletions .github/workflows/docs/build-docs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

import argparse
import datetime
from importlib import import_module
from pathlib import Path
import shutil
import subprocess
import sys
from importlib import import_module
from pathlib import Path

DOCS_DIR = Path(sys.argv[0]).absolute().parent
MODULES_DIR = DOCS_DIR.parent.parent.parent
Expand All @@ -16,6 +16,7 @@ PYTKET_QISKIT_PYPI_LINK = "https://pypi.org/project/pytket-qiskit/"
PYTKET_QISKIT_GITHUB = "https://github.com/CQCL/pytket-qiskit"
MODULE = "qiskit"


def get_module_version():
m = import_module(f"pytket.extensions.{MODULE}")
return m._metadata.__extension_version__.split(".")
Expand Down Expand Up @@ -51,12 +52,10 @@ def build_module_docs():
)
content.append(f"\tpytket <{PYTKET_DOCS_LINK}>\n")
content.append(f"\tpytket extensions <{PYTKET_EX_DOCS_LINK}>\n")
content.append(
"\n.. toctree::\n\t:caption: Links:\n\t:maxdepth: 1\n\n"
)
content.append("\n.. toctree::\n\t:caption: Links:\n\t:maxdepth: 1\n\n")
content.append(f"\tbug tracker <{PYTKET_QISKIT_GITHUB}/issues>\n")
content.append(f"\tGitHub <{PYTKET_QISKIT_GITHUB}>\n")
content.append(f"\tPyPi <{PYTKET_QISKIT_PYPI_LINK}>\n")
content.append(f"\tPyPi <{PYTKET_QISKIT_PYPI_LINK}>\n")

with open(index_rst, "w") as f:
f.writelines(content)
Expand Down Expand Up @@ -102,4 +101,4 @@ if __name__ == "__main__":
MODULES_DIR / "docs" / "build",
dest,
dirs_exist_ok=True,
)
)
26 changes: 21 additions & 5 deletions .github/workflows/docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,24 @@
"sphinx.ext.autosummary",
"sphinx.ext.intersphinx",
"sphinx.ext.mathjax",
"sphinx_copybutton",
]

html_theme = "sphinx_rtd_theme"
pygments_style = "borland"

html_theme = "sphinx_book_theme"

html_theme_options = {
"repository_url": "https://github.com/CQCL/pytket-qiskit",
"use_repository_button": True,
"use_issues_button": True,
}

html_static_path = ["_static"]

html_css_files = ["custom.css"]

html_logo = "Quantinuum_logo.png"

# -- Extension configuration -------------------------------------------------

Expand All @@ -29,13 +44,14 @@

# The following code is for resolving broken hyperlinks in the doc.

from sphinx.application import Sphinx
import re
from typing import Any, Dict, List, Optional
from urllib.parse import urljoin

from docutils import nodes
from docutils.nodes import Element, TextElement
from sphinx.application import Sphinx
from sphinx.environment import BuildEnvironment
from urllib.parse import urljoin
import re
from typing import Any, Dict, List, Optional

# Mappings for broken hyperlinks that intersphinx cannot resolve
external_url_mapping = {
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/docs/intro.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
pytket-extensions
=================

.. image:: Quantinuum_logo.png
:width: 160px
:align: right


These extensions enable ``pytket` to be used in conjunction with other
platforms. Each extension adds either new methods to the ``pytket`` package to
convert between circuit representations, or new backends to which ``pytket``
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
sphinx ~= 4.3.2
sphinx_rtd_theme
sphinx_book_theme
sphinx-copybutton
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ build
dist
*.pyc
.vscode
.venv
.mypy_cache
.hypothesis
obj
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ representations.

## Getting started

`pytket-qiskit` is available for Python 3.8, 3.9 and 3.10, on Linux, MacOS
`pytket-qiskit` is available for Python 3.9, 3.10 and 3.11, on Linux, MacOS
and Windows. To install, run:

```pip install pytket-qiskit```
Expand Down
2 changes: 1 addition & 1 deletion _metadata.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__extension_version__ = "0.33.0"
__extension_version__ = "0.34.0"
__extension_name__ = "pytket-qiskit"
44 changes: 44 additions & 0 deletions docs/_static/custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
.wy-side-nav-search,
.wy-nav-top {
background: #5A46BE;
}

.wy-grid-for-nav,
.wy-body-for-nav,
.wy-nav-side,
.wy-side-scroll,
.wy-menu,
.wy-menu-vertical {
background-color: #FFFFFF;
}

.wy-menu-vertical a:hover {
background-color: #d9d9d9;
}

.caption-text {
color: #000000;
}

.btn-link:visited,
.btn-link,
a:visited,
.a.reference.external,
.a.reference.internal,
.wy-menu-vertical a,
.wy-menu-vertical li,
.wy-menu-vertical ul,
.span.pre,
.sig-param,
.std.std-ref,
a {
color: #544d4d;
}

:root {
--pst-color-inline-code: 199, 37, 78 !important;
}

.sig-name {
font-size: 1.25rem;
}
9 changes: 9 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
Changelog
~~~~~~~~~

0.34.0 (January 2023)
---------------------

* Handle more multi-controlled gates in ``tk_to_qiskit`` and ``qiskit_to_tk`` converters (including CnY and CnZ).
* Drop support for Python 3.8; add support for 3.11.
* Fix ordering of registers in statevector simulation results.
* Remove ``reverse_index`` argument in ``tk_to_qiskit()``.
* Updated pytket version requirement to 1.11.

0.33.0 (December 2022)
----------------------

Expand Down
17 changes: 2 additions & 15 deletions docs/intro.txt
Original file line number Diff line number Diff line change
@@ -1,19 +1,6 @@
pytket-qiskit
==================================

.. raw:: html

<embed>
<div style="width:100%; display:flex; align-items:center; justify-content:end; transform: translateY(-85px); margin-bottom: -75px">
<img src="_images/Quantinuum_logo.png" width="100" height="100"></img>
</div>
</embed>

.. image:: Quantinuum_logo.png
:width: 0px
:height: 0px
:align: right

IBM's `Qiskit <https://qiskit.org>`_ is an open-source framework for quantum
computation, ranging from high-level algorithms to low-level circuit
representations, simulation and access to the `IBMQ <https://www.research.ibm.com/ibm-q/>`_ Experience devices.
Expand All @@ -22,7 +9,7 @@ representations, simulation and access to the `IBMQ <https://www.research.ibm.co
run on IBM backends and simulators, as well as conversion to and from Qiskit
representations.

``pytket-qiskit`` is available for Python 3.8, 3.9 and 3.10, on Linux, MacOS and
``pytket-qiskit`` is available for Python 3.9, 3.10 and 3.11, on Linux, MacOS and
Windows. To install, run:

::
Expand Down Expand Up @@ -89,7 +76,7 @@ and several types of simulator.
- Unitary simulator

* [1] ``AerBackend`` is noiseless by default and has no architecture. However it can accept a user defined ``NoiseModel`` and ``Architecture``.
* In addition to the backends above the pytket-qiskit extension also has the ``TketBackend``. This allows a tket ``Backend``s and compilation passes to be used directly through qiskit. see the `Notebook example <https://github.com/CQCL/pytket/blob/main/examples/qiskit_integration.ipynb>`_ on qiskit integration.
* In addition to the backends above the pytket-qiskit extension also has the ``TketBackend``. This allows a tket ``Backend`` to be used directly through qiskit. see the `notebook example <https://github.com/CQCL/pytket/blob/main/examples/qiskit_integration.ipynb>`_ on qiskit integration.

Default Compilation
===================
Expand Down
2 changes: 1 addition & 1 deletion mypy.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[mypy]
python_version = 3.8
python_version = 3.9
warn_unused_configs = True

disallow_untyped_decorators = False
Expand Down
2 changes: 1 addition & 1 deletion pytket/extensions/qiskit/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2019-2022 Cambridge Quantum Computing
# Copyright 2019-2023 Cambridge Quantum Computing
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion pytket/extensions/qiskit/backends/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2019-2022 Cambridge Quantum Computing
# Copyright 2019-2023 Cambridge Quantum Computing
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
10 changes: 4 additions & 6 deletions pytket/extensions/qiskit/backends/aer.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2019-2022 Cambridge Quantum Computing
# Copyright 2019-2023 Cambridge Quantum Computing
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -160,14 +160,12 @@ def process_circuits(
handle_list: List[Optional[ResultHandle]] = [None] * len(circuits)
circuit_batches, batch_order = _batch_circuits(circuits, n_shots_list)

reverse_index = replace_implicit_swaps = (
self.supports_state or self.supports_unitary
)
replace_implicit_swaps = self.supports_state or self.supports_unitary

for (n_shots, batch), indices in zip(circuit_batches, batch_order):
qcs = []
for tkc in batch:
qc = tk_to_qiskit(tkc, reverse_index, replace_implicit_swaps)
qc = tk_to_qiskit(tkc, replace_implicit_swaps)
if self.supports_state:
qc.save_state()
elif self.supports_unitary:
Expand Down Expand Up @@ -350,7 +348,7 @@ def get_result(self, handle: ResultHandle, **kwargs: KwargTypes) -> BackendResul
raise CircuitNotRunError(handle)

res = job.result()
backresults = qiskit_result_to_backendresult(res, reverse_index=False)
backresults = qiskit_result_to_backendresult(res)
for circ_index, backres in enumerate(backresults):
newhandle = ResultHandle(handle[0], circ_index)
self._cache[newhandle]["result"] = backres
Expand Down
2 changes: 1 addition & 1 deletion pytket/extensions/qiskit/backends/config.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2021-2022 Cambridge Quantum Computing
# Copyright 2021-2023 Cambridge Quantum Computing
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion pytket/extensions/qiskit/backends/ibm.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2019-2022 Cambridge Quantum Computing
# Copyright 2019-2023 Cambridge Quantum Computing
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
4 changes: 2 additions & 2 deletions pytket/extensions/qiskit/backends/ibmq_emulator.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2019-2022 Cambridge Quantum Computing
# Copyright 2019-2023 Cambridge Quantum Computing
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -55,7 +55,7 @@


class IBMQEmulatorBackend(Backend):
"""A backend which uses the ibmq_qasm_simulator to emulate the behaviour of
"""A backend which uses the AerBackend simulator to emulate the behaviour of
IBMQBackend. Performs the same compilation and predicate checks as IBMQBackend.
Requires a valid IBMQ account.
Expand Down
Loading

0 comments on commit 9494d93

Please sign in to comment.