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

Release 0.33.0 #74

Merged
merged 26 commits into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
08b7e6e
Merge pull request #62 from CQCL/main
cqc-melf Nov 24, 2023
3753577
Reports backend_info
yao-cqc Nov 30, 2023
a0bce81
Merge pull request #63 from CQCL/reports-backend_info
yao-cqc Nov 30, 2023
a5bd2e2
Bump the python-packages group with 1 update
dependabot[bot] Dec 1, 2023
215bf70
Merge pull request #59 from CQCL/dependabot/pip/python-packages-00c6d…
yao-cqc Dec 1, 2023
865eb25
Bump actions/deploy-pages from 2 to 3
dependabot[bot] Dec 5, 2023
c4ebb99
Merge pull request #64 from CQCL/dependabot/github_actions/actions/de…
yao-cqc Dec 5, 2023
4f7b38a
Bump actions/setup-python from 4 to 5
dependabot[bot] Dec 7, 2023
8a57129
Merge pull request #65 from CQCL/dependabot/github_actions/actions/se…
yao-cqc Dec 7, 2023
e58f056
Bump actions/download-artifact from 3 to 4 (#66)
dependabot[bot] Dec 15, 2023
24f3e2a
Bump actions/upload-artifact from 3 to 4 (#67)
dependabot[bot] Dec 15, 2023
526fb35
update actions and add PR template (#68)
cqc-melf Dec 15, 2023
ad3e903
Bump actions/upload-pages-artifact from 2 to 3 (#70)
dependabot[bot] Dec 20, 2023
d423140
Bump actions/deploy-pages from 3 to 4 (#69)
dependabot[bot] Dec 20, 2023
e17574a
Fix/workflow 2023 (#71)
cqc-melf Dec 21, 2023
02064eb
Add support for converting multi-register circuits to Qulacs
gcalin Dec 21, 2023
bbe0df0
Reformat to contribution standard
gcalin Dec 21, 2023
b593082
Lint to contribution standard
gcalin Dec 21, 2023
02ee688
Fix indendation
gcalin Dec 21, 2023
243f1a4
Replace relative register indexing with flattening pass
gcalin Dec 21, 2023
8e46736
Merge pull request #72 from gcalin/develop
yao-cqc Dec 22, 2023
e1336c9
Correct URL for documentation. (#73)
cqc-alec Jan 8, 2024
69b003d
update pytket version
cqc-melf Jan 10, 2024
514e080
update changelog
cqc-melf Jan 10, 2024
01889b6
update version
cqc-melf Jan 10, 2024
34ca538
update [email protected]
cqc-melf Jan 10, 2024
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
15 changes: 15 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Description

Please summarise the changes.

# Related issues

Please mention any github issues addressed by this PR.

# Checklist

- [ ] I have performed a self-review of my code.
- [ ] I have commented hard-to-understand parts of my code.
- [ ] I have made corresponding changes to the public API documentation.
- [ ] I have added tests that prove my fix is effective or that my feature works.
- [ ] I have updated the changelog with any user-facing changes.
24 changes: 14 additions & 10 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* +refs/heads/*:refs/remotes/origin/*
- name: Set up Python 3.9
if: github.event_name == 'push' || github.event_name == 'schedule'
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.9'
- name: Build and test (3.9)
Expand All @@ -41,7 +41,7 @@ jobs:
run: |
./.github/workflows/build-test nomypy
- name: Set up Python 3.10
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Build and test including remote checks (3.10) mypy
Expand All @@ -56,18 +56,18 @@ jobs:
./.github/workflows/build-test nomypy
- 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
uses: actions/setup-python@v5
with:
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: |
./.github/workflows/build-test nomypy
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
if: github.event_name == 'release' || contains(github.ref, 'refs/heads/wheel')
with:
name: artefacts
name: artefact-${{ matrix.os }}
path: wheelhouse/
- name: Install docs dependencies
if: (matrix.os == 'ubuntu-22.04') && (github.event_name == 'pull_request' || github.event_name == 'schedule' )
Expand All @@ -87,9 +87,13 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: Download all wheels
uses: actions/download-artifact@v3
# downloading all three files into the wheelhouse
# all files are identical, so there will only be one file
uses: actions/download-artifact@v4
with:
path: wheelhouse
pattern: artefact-*
merge-multiple: true
- name: Put them all in the dist folder
run: |
mkdir dist
Expand All @@ -111,11 +115,11 @@ jobs:
with:
fetch-depth: '0'
- name: Set up Python 3.10
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Download all wheels
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
path: wheelhouse
- name: Install pip, wheel
Expand All @@ -132,7 +136,7 @@ jobs:
mkdir extensions
./build-docs -d ${GITHUB_WORKSPACE}/.github/workflows/docs/extensions/api
- name: Upload docs as artefact
uses: actions/upload-pages-artifact@v2
uses: actions/upload-pages-artifact@v3
with:
path: .github/workflows/docs/extensions

Expand All @@ -150,4 +154,4 @@ jobs:
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
uses: actions/deploy-pages@v4.0.1
4 changes: 2 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Upgrade pip and install wheel
Expand All @@ -30,7 +30,7 @@ jobs:
cd .github/workflows/docs
mkdir extensions
./build-docs -d ${GITHUB_WORKSPACE}/.github/workflows/docs/extensions
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: pytket-extension-docs
path: .github/workflows/docs/extensions/
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.x
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Update pip
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.32.0"
__extension_version__ = "0.33.0"
__extension_name__ = "pytket-qulacs"
6 changes: 6 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Changelog
~~~~~~~~~

0.33.0 (January 2024)
---------------------

* Updated pytket version requirement to 1.23.
* Backends now report backend_info.

0.32.0 (November 2023)
----------------------

Expand Down
7 changes: 3 additions & 4 deletions pytket/extensions/qulacs/backends/qulacs_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
from pytket.circuit import Pauli
from pytket.passes import auto_rebase_pass
from pytket.pauli import QubitPauliString
from pytket.architecture import Architecture
from pytket.utils.operators import QubitPauliOperator
from pytket.utils.outcomearray import OutcomeArray
from pytket.extensions.qulacs.qulacs_convert import (
Expand Down Expand Up @@ -122,7 +121,7 @@ def __init__(
type(self).__name__,
None,
__extension_version__,
Architecture([]),
None,
self._GATE_SET,
)
self._result_type = result_type
Expand All @@ -142,7 +141,7 @@ def _result_id_type(self) -> _ResultIdTuple:

@property
def backend_info(self) -> Optional["BackendInfo"]:
return None
return self._backend_info

@property
def required_predicates(self) -> List[Predicate]:
Expand Down Expand Up @@ -291,7 +290,7 @@ def get_operator_expectation_value(
self._check_all_circuits([state_circuit], nomeasure_warn=False)

observable = Observable(state_circuit.n_qubits)
for (qps, coeff) in operator._dict.items():
for qps, coeff in operator._dict.items():
_items = []
if qps != QubitPauliString():
for qubit, pauli in qps.map.items():
Expand Down
5 changes: 5 additions & 0 deletions pytket/extensions/qulacs/qulacs_convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import numpy as np
from qulacs import QuantumCircuit, gate
from pytket.circuit import Circuit, OpType
from pytket.passes import FlattenRegisters

_ONE_QUBIT_GATES = {
OpType.X: gate.X,
Expand All @@ -43,6 +44,10 @@ def tk_to_qulacs(
) -> QuantumCircuit:
"""Convert a pytket circuit to a qulacs circuit object."""
circ = circuit.copy()

if not circ.is_simple:
FlattenRegisters().apply(circ)

if replace_implicit_swaps:
circ.replace_implicit_wire_swaps()
n_qubits = circ.n_qubits
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
author_email="[email protected]",
python_requires=">=3.9",
project_urls={
"Documentation": "https://tket.quantinuum.com/extensions/pytket-qulacs/api/index.html",
"Documentation": "https://tket.quantinuum.com/extensions/pytket-qulacs/index.html",
"Source": "https://github.com/CQCL/pytket-qulacs",
"Tracker": "https://github.com/CQCL/pytket-qulacs/issues",
},
Expand All @@ -42,7 +42,7 @@
license="Apache 2",
packages=find_namespace_packages(include=["pytket.*"]),
include_package_data=True,
install_requires=["pytket ~= 1.22", "qulacs ~= 0.6.0"],
install_requires=["pytket ~= 1.23", "qulacs ~= 0.6.0"],
classifiers=[
"Environment :: Console",
"Programming Language :: Python :: 3.9",
Expand Down
2 changes: 1 addition & 1 deletion tests/test-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ pytest
pytest-timeout ~= 2.2.0
hypothesis
requests_mock
openfermion~=1.3
openfermion~=1.6
5 changes: 5 additions & 0 deletions tests/test_qulacs_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,11 @@ def test_backend_with_circuit_permutation() -> None:
assert np.allclose(sv, sv1, atol=1e-10)


def test_backend_info() -> None:
for b in backends:
assert b.backend_info is not None


@given(
n_shots=strategies.integers(min_value=1, max_value=10), # type: ignore
n_bits=strategies.integers(min_value=0, max_value=10),
Expand Down