Skip to content

Commit

Permalink
Merge branch 'main' into melf/add-ruff-2024
Browse files Browse the repository at this point in the history
  • Loading branch information
cqc-melf authored Oct 24, 2024
2 parents 85a4efc + 96d01b1 commit a3920ec
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 33 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
name: Qiskit - Build and test module
strategy:
matrix:
os: ['ubuntu-22.04', 'macos-12', 'windows-2022']
os: ['ubuntu-latest', 'macos-14', 'windows-latest']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
Expand All @@ -48,14 +48,14 @@ jobs:
with:
python-version: '3.11'
- name: Build and test including remote checks (3.11) mypy
if: (matrix.os == 'ubuntu-22.04') && (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' )
if: (matrix.os == 'ubuntu-latest') && (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 (3.11) 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')
if: (matrix.os != 'macos-14') && (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
Expand All @@ -77,12 +77,12 @@ jobs:
- name: Install poetry
run: pip install poetry
- name: Install docs dependencies
if: (matrix.os == 'ubuntu-22.04') && (github.event_name == 'pull_request' || github.event_name == 'schedule' )
if: (matrix.os == 'ubuntu-latest') && (github.event_name == 'pull_request' || github.event_name == 'schedule' )
run: |
cd docs && bash ./install.sh
for w in `find wheelhouse/ -type f -name "*.whl"` ; do poetry install $w ; done
- name: Build docs
if: (matrix.os == 'ubuntu-22.04') && (github.event_name == 'pull_request' || github.event_name == 'schedule' )
if: (matrix.os == 'ubuntu-latest') && (github.event_name == 'pull_request' || github.event_name == 'schedule' )
timeout-minutes: 20
run: |
cd docs && poetry run bash ./build-docs.sh
Expand All @@ -92,7 +92,7 @@ jobs:
name: Publish to pypi
if: github.event_name == 'release'
needs: qiskit-checks
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:
- name: Download all wheels
# downloading all three files into the wheelhouse
Expand All @@ -117,7 +117,7 @@ jobs:
name: Build docs
if: github.event_name == 'release'
needs: publish_to_pypi
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
jobs:
docs:
name: build docs
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
jobs:
lint:

runs-on: ubuntu-22.04
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
Expand All @@ -27,5 +27,4 @@ jobs:
run: |
ruff check .
- name: Run pylint
run: |
pylint */
run: pylint */
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.57.0"
__extension_version__ = "0.58.0"
__extension_name__ = "pytket-qiskit"
8 changes: 8 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
Changelog
~~~~~~~~~

0.58.0 (October 2024)
---------------------

* Updated pytket version requirement to 1.33.1.
* Require qiskit >= 1.2.4.
* Require qiskit-ibm-runtime >= 0.30.0.
* Require qiskit-aer >= 0.15.1.

0.57.0 (October 2024)
---------------------

Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ Using TKET directly on qiskit circuits
======================================
.. currentmodule:: pytket.extensions.qiskit

For usage of :py:class:`~tket_backend.TketBackend` see the `qiskit integration notebook example <https://tket.quantinuum.com/examples/qiskit_integration.html>`_.
For usage of :py:class:`~tket_backend.TketBackend` see the `qiskit integration notebook example <https://tket.quantinuum.com/user-guide/examples/backends/qiskit_integration.html>`_.

.. autosummary::
:nosignatures:
Expand Down
30 changes: 14 additions & 16 deletions pytket/extensions/qiskit/qiskit_convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,16 @@ def _get_pytket_condition_kwargs(
raise NotImplementedError("condition must contain classical bit or register")


def _build_circbox(instr: Instruction, circuit: QuantumCircuit) -> CircBox:
qregs = [QuantumRegister(instr.num_qubits, "q")] if instr.num_qubits > 0 else []
cregs = [ClassicalRegister(instr.num_clbits, "c")] if instr.num_clbits > 0 else []
builder = CircuitBuilder(qregs, cregs)
builder.add_qiskit_data(circuit, instr.definition)
subc = builder.circuit()
subc.name = instr.name
return CircBox(subc)


class CircuitBuilder:
def __init__(
self,
Expand Down Expand Up @@ -528,7 +538,7 @@ def add_qiskit_data(
q_ctrl_box = _get_qcontrol_box(c_gate=instr, params=params)
self.tkc.add_qcontrolbox(q_ctrl_box, qubits)

elif isinstance(instr, (Initialize, StatePreparation)):
elif optype == OpType.StatePreparationBox:
# Append OpType found by stateprep helpers
_add_state_preparation(self.tkc, qubits, instr)

Expand Down Expand Up @@ -556,22 +566,10 @@ def add_qiskit_data(

elif optype == OpType.Barrier:
self.tkc.add_barrier(qubits)

elif optype == OpType.CircBox:
qregs = (
[QuantumRegister(instr.num_qubits, "q")]
if instr.num_qubits > 0
else []
)
cregs = (
[ClassicalRegister(instr.num_clbits, "c")]
if instr.num_clbits > 0
else []
)
builder = CircuitBuilder(qregs, cregs)
builder.add_qiskit_data(circuit, instr.definition)
subc = builder.circuit()
subc.name = instr.name
self.tkc.add_circbox(CircBox(subc), qubits + bits, **condition_kwargs) # type: ignore
circbox = _build_circbox(instr, circuit)
self.tkc.add_circbox(circbox, qubits + bits, **condition_kwargs) # type: ignore

elif optype == OpType.CU3 and type(instr) is qiskit_gates.CUGate:
if instr.params[-1] == 0:
Expand Down
8 changes: 4 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@
packages=find_namespace_packages(include=["pytket.*"]),
include_package_data=True,
install_requires=[
"pytket >= 1.33.0",
"qiskit >= 1.2.0",
"qiskit-ibm-runtime >= 0.24.1",
"qiskit-aer >= 0.14.2",
"pytket >= 1.33.1",
"qiskit >= 1.2.4",
"qiskit-ibm-runtime >= 0.30.0",
"qiskit-aer >= 0.15.1",
"numpy >= 1.26.4",
],
classifiers=[
Expand Down

0 comments on commit a3920ec

Please sign in to comment.