Skip to content

Commit 009c880

Browse files
github-actions[bot]web-flowTakishimaCynocracydependabot[bot]
authored
Release version v0.8.0 (#446)
* Merge master into develop branch (#436) * Preparing release vv0.7.2 * Fix missed bug in optimize.py * Fix typo in _optimize.py * Fix linters/formatters warnings * Update missed hooks * Hotfix: fix GitHub action workflows * Release version v0.7.3 (#435) * Merge master into develop branch (#431) * Preparing release vv0.7.2 * Fix missed bug in optimize.py * Fix typo in _optimize.py * Fix linters/formatters warnings * Update missed hooks * Hotfix: fix GitHub action workflows Co-authored-by: GitHub actions <[email protected]> Co-authored-by: Nguyen Damien <[email protected]> * IonQ API: Move to v0.2, and fixup backends path (#433) * Move to v0.2, and fixup backends path The previous path was mistakenly incorrect, could we release this as a patch release of project-Q? Happy to help how I can. * changelog * fix * One more fixup * remove urljoin * fmt * Preparing release v0.7.3 Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: GitHub actions <[email protected]> Co-authored-by: Nguyen Damien <[email protected]> Co-authored-by: Jon Donovan <[email protected]> Co-authored-by: GitHub actions <[email protected]> Co-authored-by: Nguyen Damien <[email protected]> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Jon Donovan <[email protected]> * Bump docker/setup-qemu-action from 1 to 2 (#437) * Bump docker/setup-qemu-action from 1 to 2 Bumps [docker/setup-qemu-action](https://github.com/docker/setup-qemu-action) from 1 to 2. - [Release notes](https://github.com/docker/setup-qemu-action/releases) - [Commits](docker/setup-qemu-action@v1...v2) --- updated-dependencies: - dependency-name: docker/setup-qemu-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> * Update CHANGELOG * Fix CentOS 7 build Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Nguyen Damien <[email protected]> * Fix setuptools-scm version for Python 3.6 (#440) * Add `blacken-docs` and `pyupgrade` to pre-commit configuration (#441) * Add `blacken-docs` and `pyupgrade` to pre-commit configuration * Apply new pre-commit hooks and fix related issues. * Update CHANGELOG * Fix unit tests failures * Fix pre-commit failure * Generalise the use of f-strings * Fix IonQ tests * Run `pyupgrade` before `isort` and `black` * Deprecate support for Python 3.6 (#442) * Azure Quantum backend (#439) * Add Azure Quantum backend template files * Add implementation of Azure Quantum * Add support for Honeywell and improve exception handling * Fixes and reformatting * Fixes and Improvements * Fixes and Improvements * Fixes and Improvements * Fixes and Improvements * Fix QASM transulation * Fixes and Improvements * Documentation related changes * Fix typos * Add docstrings to util methods * Fix typos * Add Unittests * Add Unittests * Add Unittests & rename honeywell to quantinuum * Fixes for QSAM convector * Add Unittests * Add Unittests * Add Unittests * Add Unittests * Fix Quantinuum Backend for Azure Quantum * Add Unittests * Add Unittests * Add Unittests * Add Unittests * Fix Vdag gate for IonQ backend * Minor updates * Update Docs * Add Azure Quantum example * Update README.rst * Update Docs * Update Docs * Update Unittests * Azure Quantum: CI Fixes (#4) * Azure Quantum: CI Fixes * Fix optional dependency problem * Update pre-commit reformatting * Fix pylint issues * Fix pylint issues * Update CHANGELOG.md * Update CHANGELOG.md * Update CHANGELOG.md * Resolve comments (#5) * Resolve comments * Remove rearrange_result method from _utils.py * Update with pytest.approx for assert floating numbers * Pytest skipif testcases for Azure Quantum (#6) * Pytest skipif testcases for Azure Quantum * Fix projectq.backends._azure._exceptions import * Add common utils module (#7) * Create common utils module * Optimize _rearrange_result method * Make sure pip, setuptools and wheel packages are up to date on CI * Fix formatting issues from latest changes in develop branch * Improve coveralls (#8) * Improve coveralls * Improve coveralls * Rename util.py to utils.py * Minor fixes * Update testcases * Update testcases * Improve coveralls (#9) * Improve coveralls * Improve coveralls * Precommit reformatting * Improve coveralls (#10) * Improve coveralls * Precommit formatting * Fix CI failures * Avoid a few more #pragma: no cover * Fix flake8 warning * Remove one more # pragma: no cover * Reformat file Co-authored-by: Nguyen Damien <[email protected]> * Fix installation on Apple Silicon and older Python versions (#444) * Preparing release v0.8.0 Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: GitHub actions <[email protected]> Co-authored-by: Nguyen Damien <[email protected]> Co-authored-by: Jon Donovan <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Sai Seshu Chadaram <[email protected]>
1 parent 0a4e247 commit 009c880

File tree

256 files changed

+4013
-1037
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

256 files changed

+4013
-1037
lines changed

.github/workflows/ci.yml

+21-12
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ jobs:
1616
matrix:
1717
runs-on: [ubuntu-latest, windows-latest, macos-latest]
1818
python:
19-
- 3.6
2019
- 3.7
2120
- 3.8
2221
- 3.9
@@ -55,15 +54,17 @@ jobs:
5554
- name: Generate requirement file (Unix)
5655
if: runner.os != 'Windows'
5756
run: |
58-
python setup.py gen_reqfile --include-extras=test,braket,revkit
57+
python setup.py gen_reqfile --include-extras=test,azure-quantum,braket,revkit
5958
6059
- name: Generate requirement file (Windows)
6160
if: runner.os == 'Windows'
6261
run: |
63-
python setup.py gen_reqfile --include-extras=test,braket
62+
python setup.py gen_reqfile --include-extras=test,azure-quantum,braket
6463
6564
- name: Prepare env
6665
run: |
66+
python -m pip install -U pip setuptools wheel
67+
cat requirements.txt
6768
python -m pip install -r requirements.txt --prefer-binary
6869
python -m pip install coveralls
6970
@@ -73,11 +74,11 @@ jobs:
7374

7475
- name: Build and install package (Unix)
7576
if: runner.os != 'Windows'
76-
run: python -m pip install -ve .[braket,revkit,test]
77+
run: python -m pip install -ve .[azure-quantum,braket,revkit,test]
7778

7879
- name: Build and install package (Windows)
7980
if: runner.os == 'Windows'
80-
run: python -m pip install -ve .[braket,test]
81+
run: python -m pip install -ve .[azure-quantum,braket,test]
8182

8283
- name: Pytest
8384
run: |
@@ -142,14 +143,16 @@ jobs:
142143
143144
- name: Prepare Python env
144145
run: |
145-
python3 setup.py gen_reqfile --include-extras=test,braket
146+
python3 -m pip install -U pip setuptools wheel
147+
python3 setup.py gen_reqfile --include-extras=test,azure-quantum,braket
148+
cat requirements.txt
146149
python3 -m pip install -r requirements.txt --prefer-binary
147150
148151
- name: Upgrade pybind11 and flaky
149152
run: python3 -m pip install --upgrade pybind11 flaky --prefer-binary
150153

151154
- name: Build and install package
152-
run: python3 -m pip install -ve .[braket,test]
155+
run: python3 -m pip install -ve .[azure-quantum,braket,test]
153156

154157
- name: Pytest
155158
run: |
@@ -187,14 +190,16 @@ jobs:
187190
188191
- name: Prepare Python env
189192
run: |
190-
python3 setup.py gen_reqfile --include-extras=test,braket
193+
python3 -m pip install -U pip setuptools wheel
194+
python3 setup.py gen_reqfile --include-extras=test,azure-quantum,braket
195+
cat requirements.txt
191196
python3 -m pip install -r requirements.txt --prefer-binary
192197
193198
- name: Upgrade pybind11 and flaky
194199
run: python3 -m pip install --upgrade pybind11 flaky --prefer-binary
195200

196201
- name: Build and install package
197-
run: python3 -m pip install -ve .[braket,test]
202+
run: python3 -m pip install -ve .[azure-quantum,braket,test]
198203

199204
- name: Pytest
200205
run: |
@@ -242,7 +247,9 @@ jobs:
242247
run: yum -y install https://packages.endpointdev.com/rhel/7/os/x86_64/endpoint-repo.x86_64.rpm
243248

244249
- name: Install Git > 2.18
245-
run: yum install -y git
250+
run: |
251+
yum install -y git
252+
git config --global --add safe.directory /__w/ProjectQ/ProjectQ
246253
247254
- uses: actions/checkout@v2
248255

@@ -267,11 +274,13 @@ jobs:
267274

268275
- name: Install dependencies
269276
run: |
270-
python3 setup.py gen_reqfile --include-extras=test,braket
277+
python3 -m pip install -U pip setuptools wheel
278+
python3 setup.py gen_reqfile --include-extras=test,azure-quantum,braket
279+
cat requirements.txt
271280
python3 -m pip install -r requirements.txt --prefer-binary
272281
273282
- name: Build and install package
274-
run: python3 -m pip install -ve .[braket,test]
283+
run: python3 -m pip install -ve .[azure-quantum,braket,test]
275284

276285
- name: Pytest
277286
run: |

.github/workflows/publish_release.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
steps:
2727
- name: Set up QEMU
2828
if: matrix.cibw_archs == 'aarch64'
29-
uses: docker/setup-qemu-action@v1
29+
uses: docker/setup-qemu-action@v2
3030
with:
3131
platforms: arm64
3232

.pre-commit-config.yaml

+13-1
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,19 @@ repos:
3535
- id: end-of-file-fixer
3636
- id: mixed-line-ending
3737
- id: trailing-whitespace
38-
- id: fix-encoding-pragma
3938

4039
# Changes tabs to spaces
4140
- repo: https://github.com/Lucas-C/pre-commit-hooks
4241
rev: v1.1.13
4342
hooks:
4443
- id: remove-tabs
4544

45+
- repo: https://github.com/asottile/pyupgrade
46+
rev: v2.34.0
47+
hooks:
48+
- id: pyupgrade
49+
args: [--py37-plus, --keep-mock]
50+
4651
- repo: https://github.com/PyCQA/isort
4752
rev: 5.10.1
4853
hooks:
@@ -57,6 +62,13 @@ repos:
5762
# This is a slow hook, so only run this if --hook-stage manual is passed
5863
stages: [manual]
5964

65+
- repo: https://github.com/asottile/blacken-docs
66+
rev: v1.12.1
67+
hooks:
68+
- id: blacken-docs
69+
args: [-S, -l, '120']
70+
additional_dependencies: [black==22.3.0]
71+
6072
- repo: https://gitlab.com/PyCQA/flake8
6173
rev: 3.9.2
6274
hooks:

.travis.yml

+1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ install:
6060
- env
6161
- python3 -m pip install -U pip setuptools wheel
6262
- python3 -m pip install -U pybind11 dormouse revkit flaky pytest-cov coveralls boto3
63+
- python3 -m pip install -U azure-quantum
6364
- python3 -m pip install -r requirements.txt
6465
- python3 -m pip install -ve .
6566

CHANGELOG.md

+24-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,27 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [v0.8.0] - 2022-10-18
11+
12+
### Added
13+
14+
- New backend for the Azure Quantum platform
15+
16+
### Changed
17+
18+
- Support for Python 3.6 and earlier is now deprecated
19+
- Moved package metadata into pyproject.toml
20+
21+
### Fixed
22+
23+
- Fixed installation on Apple Silicon with older Python versions (&lt; 3.9)
24+
25+
### Repository
26+
27+
- Update `docker/setup-qemu-action` GitHub action to v2
28+
- Fixed CentOS 7 configuration issue
29+
- Added two new pre-commit hooks: `blacken-docs` and `pyupgrade`
30+
1031
## [v0.7.3] - 2022-04-27
1132

1233
### Fixed
@@ -190,7 +211,9 @@ The ProjectQ v0.5.x release branch is the last one that is guaranteed to work wi
190211

191212
Future releases might introduce changes that will require Python 3.5 (Python 3.4 and earlier have already been declared deprecated at the time of this writing)
192213

193-
[Unreleased]: https://github.com/ProjectQ-Framework/ProjectQ/compare/v0.7.3...HEAD
214+
[Unreleased]: https://github.com/ProjectQ-Framework/ProjectQ/compare/v0.8.0...HEAD
215+
216+
[v0.8.0]: https://github.com/ProjectQ-Framework/ProjectQ/compare/v0.7.3...v0.8.0
194217

195218
[v0.7.3]: https://github.com/ProjectQ-Framework/ProjectQ/compare/v0.7.2...v0.7.3
196219

README.rst

+63-23
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ targeting various types of hardware, a high-performance quantum computer
2727
simulator with emulation capabilities, and various compiler plug-ins.
2828
This allows users to
2929

30-
- run quantum programs on the IBM Quantum Experience chip, AQT devices, AWS Braket, or IonQ service provided devices
30+
- run quantum programs on the IBM Quantum Experience chip, AQT devices, AWS Braket, Azure Quantum, or IonQ service provided devices
3131
- simulate quantum programs on classical computers
3232
- emulate quantum programs at a higher level of abstraction (e.g.,
3333
mimicking the action of large oracles instead of compiling them to
@@ -43,7 +43,10 @@ Examples
4343
.. code-block:: python
4444
4545
from projectq import MainEngine # import the main compiler engine
46-
from projectq.ops import H, Measure # import the operations we want to perform (Hadamard and measurement)
46+
from projectq.ops import (
47+
H,
48+
Measure,
49+
) # import the operations we want to perform (Hadamard and measurement)
4750
4851
eng = MainEngine() # create a default compiler (the back-end is a simulator)
4952
qubit = eng.allocate_qubit() # allocate a quantum register with 1 qubit
@@ -52,7 +55,7 @@ Examples
5255
Measure | qubit # measure the qubit
5356
5457
eng.flush() # flush all gates (and execute measurements)
55-
print("Measured {}".format(int(qubit))) # converting a qubit to int or bool gives access to the measurement result
58+
print(f"Measured {int(qubit)}") # converting a qubit to int or bool gives access to the measurement result
5659
5760
5861
ProjectQ features a lean syntax which is close to the mathematical notation used in quantum physics. For example, a rotation of a qubit around the x-axis is usually specified as:
@@ -80,9 +83,7 @@ Instead of simulating a quantum program, one can use our resource counter (as a
8083
from projectq.ops import QFT
8184
from projectq.setups import linear
8285
83-
compiler_engines = linear.get_engine_list(num_qubits=16,
84-
one_qubit_gates='any',
85-
two_qubit_gates=(CNOT, Swap))
86+
compiler_engines = linear.get_engine_list(num_qubits=16, one_qubit_gates='any', two_qubit_gates=(CNOT, Swap))
8687
resource_counter = ResourceCounter()
8788
eng = MainEngine(backend=resource_counter, engine_list=compiler_engines)
8889
qureg = eng.allocate_qureg(16)
@@ -112,12 +113,13 @@ To run a program on the IBM Quantum Experience chips, all one has to do is choos
112113
import projectq.setups.ibm
113114
from projectq.backends import IBMBackend
114115
115-
token='MY_TOKEN'
116-
device='ibmq_16_melbourne'
117-
compiler_engines = projectq.setups.ibm.get_engine_list(token=token,device=device)
118-
eng = MainEngine(IBMBackend(token=token, use_hardware=True, num_runs=1024,
119-
verbose=False, device=device),
120-
engine_list=compiler_engines)
116+
token = 'MY_TOKEN'
117+
device = 'ibmq_16_melbourne'
118+
compiler_engines = projectq.setups.ibm.get_engine_list(token=token, device=device)
119+
eng = MainEngine(
120+
IBMBackend(token=token, use_hardware=True, num_runs=1024, verbose=False, device=device),
121+
engine_list=compiler_engines,
122+
)
121123
122124
123125
**Running a quantum program on AQT devices**
@@ -129,12 +131,13 @@ To run a program on the AQT trapped ion quantum computer, choose the `AQTBackend
129131
import projectq.setups.aqt
130132
from projectq.backends import AQTBackend
131133
132-
token='MY_TOKEN'
133-
device='aqt_device'
134-
compiler_engines = projectq.setups.aqt.get_engine_list(token=token,device=device)
135-
eng = MainEngine(AQTBackend(token=token,use_hardware=True, num_runs=1024,
136-
verbose=False, device=device),
137-
engine_list=compiler_engines)
134+
token = 'MY_TOKEN'
135+
device = 'aqt_device'
136+
compiler_engines = projectq.setups.aqt.get_engine_list(token=token, device=device)
137+
eng = MainEngine(
138+
AQTBackend(token=token, use_hardware=True, num_runs=1024, verbose=False, device=device),
139+
engine_list=compiler_engines,
140+
)
138141
139142
140143
**Running a quantum program on a AWS Braket provided device**
@@ -150,13 +153,21 @@ IonQ from IonQ and the state vector simulator SV1:
150153
creds = {
151154
'AWS_ACCESS_KEY_ID': 'your_aws_access_key_id',
152155
'AWS_SECRET_KEY': 'your_aws_secret_key',
153-
}
156+
}
154157
155158
s3_folder = ['S3Bucket', 'S3Directory']
156-
device='IonQ'
157-
eng = MainEngine(AWSBraketBackend(use_hardware=True, credentials=creds, s3_folder=s3_folder,
158-
num_runs=1024, verbose=False, device=device),
159-
engine_list=[])
159+
device = 'IonQ'
160+
eng = MainEngine(
161+
AWSBraketBackend(
162+
use_hardware=True,
163+
credentials=creds,
164+
s3_folder=s3_folder,
165+
num_runs=1024,
166+
verbose=False,
167+
device=device,
168+
),
169+
engine_list=[],
170+
)
160171
161172
162173
.. note::
@@ -175,6 +186,35 @@ IonQ from IonQ and the state vector simulator SV1:
175186
python3 -m pip install -ve .[braket]
176187
177188
189+
**Running a quantum program on a Azure Quantum provided device**
190+
191+
To run a program on devices provided by the `Azure Quantum <https://azure.microsoft.com/en-us/services/quantum/>`_.
192+
193+
Use `AzureQuantumBackend` to run ProjectQ circuits on hardware devices and simulator devices from providers `IonQ` and `Quantinuum`.
194+
195+
.. code-block:: python
196+
197+
from projectq.backends import AzureQuantumBackend
198+
199+
azure_quantum_backend = AzureQuantumBackend(
200+
use_hardware=False, target_name='ionq.simulator', resource_id='<resource-id>', location='<location>', verbose=True
201+
)
202+
203+
.. note::
204+
205+
In order to use the AzureQuantumBackend, you need to install ProjectQ with the 'azure-quantum' extra requirement:
206+
207+
.. code-block:: bash
208+
209+
python3 -m pip install projectq[azure-quantum]
210+
211+
or
212+
213+
.. code-block:: bash
214+
215+
cd /path/to/projectq/source/code
216+
python3 -m pip install -ve .[azure-quantum]
217+
178218
**Running a quantum program on IonQ devices**
179219

180220
To run a program on the IonQ trapped ion hardware, use the `IonQBackend` and its corresponding setup.

docs/conf.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/env python3
2-
# -*- coding: utf-8 -*-
32
#
43
# projectq documentation build configuration file, created by
54
# sphinx-quickstart on Tue Nov 29 11:51:46 2016.
@@ -533,6 +532,7 @@ def linkcode_resolve(domain, info):
533532
534533
import projectq.setups.ibm as ibm_setup
535534
from projectq import MainEngine
535+
536536
eng = MainEngine(engine_list=ibm_setup.get_engine_list())
537537
# eng uses the default Simulator backend
538538
@@ -560,10 +560,10 @@ def linkcode_resolve(domain, info):
560560
os.mkdir(docgen_path)
561561

562562
for desc in descriptions:
563-
fname = os.path.join(docgen_path, 'projectq.{}.rst'.format(desc.name))
563+
fname = os.path.join(docgen_path, f'projectq.{desc.name}.rst')
564564
lines = None
565565
if os.path.exists(fname):
566-
with open(fname, 'r') as fd:
566+
with open(fname) as fd:
567567
lines = [line[:-1] for line in fd.readlines()]
568568

569569
new_lines = desc.get_ReST()

0 commit comments

Comments
 (0)