Skip to content

Commit

Permalink
Release version v0.8.0 (#446)
Browse files Browse the repository at this point in the history
* 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 <noreply@github.com>
Co-authored-by: Nguyen Damien <ngn.damien@gmail.com>

* 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 <noreply@github.com>
Co-authored-by: Nguyen Damien <ngn.damien@gmail.com>
Co-authored-by: Jon Donovan <donovan@ionq.co>

Co-authored-by: GitHub actions <noreply@github.com>
Co-authored-by: Nguyen Damien <ngn.damien@gmail.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Jon Donovan <donovan@ionq.co>

* 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] <support@github.com>

* Update CHANGELOG

* Fix CentOS 7 build

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Nguyen Damien <ngn.damien@gmail.com>

* 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 <ngn.damien@gmail.com>

* 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 <noreply@github.com>
Co-authored-by: Nguyen Damien <ngn.damien@gmail.com>
Co-authored-by: Jon Donovan <donovan@ionq.co>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Sai Seshu Chadaram <ssc1729@outlook.com>
  • Loading branch information
6 people committed Oct 18, 2022
1 parent 0a4e247 commit 009c880
Show file tree
Hide file tree
Showing 256 changed files with 4,013 additions and 1,037 deletions.
33 changes: 21 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ jobs:
matrix:
runs-on: [ubuntu-latest, windows-latest, macos-latest]
python:
- 3.6
- 3.7
- 3.8
- 3.9
Expand Down Expand Up @@ -55,15 +54,17 @@ jobs:
- name: Generate requirement file (Unix)
if: runner.os != 'Windows'
run: |
python setup.py gen_reqfile --include-extras=test,braket,revkit
python setup.py gen_reqfile --include-extras=test,azure-quantum,braket,revkit
- name: Generate requirement file (Windows)
if: runner.os == 'Windows'
run: |
python setup.py gen_reqfile --include-extras=test,braket
python setup.py gen_reqfile --include-extras=test,azure-quantum,braket
- name: Prepare env
run: |
python -m pip install -U pip setuptools wheel
cat requirements.txt
python -m pip install -r requirements.txt --prefer-binary
python -m pip install coveralls
Expand All @@ -73,11 +74,11 @@ jobs:

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

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

- name: Pytest
run: |
Expand Down Expand Up @@ -142,14 +143,16 @@ jobs:
- name: Prepare Python env
run: |
python3 setup.py gen_reqfile --include-extras=test,braket
python3 -m pip install -U pip setuptools wheel
python3 setup.py gen_reqfile --include-extras=test,azure-quantum,braket
cat requirements.txt
python3 -m pip install -r requirements.txt --prefer-binary
- name: Upgrade pybind11 and flaky
run: python3 -m pip install --upgrade pybind11 flaky --prefer-binary

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

- name: Pytest
run: |
Expand Down Expand Up @@ -187,14 +190,16 @@ jobs:
- name: Prepare Python env
run: |
python3 setup.py gen_reqfile --include-extras=test,braket
python3 -m pip install -U pip setuptools wheel
python3 setup.py gen_reqfile --include-extras=test,azure-quantum,braket
cat requirements.txt
python3 -m pip install -r requirements.txt --prefer-binary
- name: Upgrade pybind11 and flaky
run: python3 -m pip install --upgrade pybind11 flaky --prefer-binary

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

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

- name: Install Git > 2.18
run: yum install -y git
run: |
yum install -y git
git config --global --add safe.directory /__w/ProjectQ/ProjectQ
- uses: actions/checkout@v2

Expand All @@ -267,11 +274,13 @@ jobs:

- name: Install dependencies
run: |
python3 setup.py gen_reqfile --include-extras=test,braket
python3 -m pip install -U pip setuptools wheel
python3 setup.py gen_reqfile --include-extras=test,azure-quantum,braket
cat requirements.txt
python3 -m pip install -r requirements.txt --prefer-binary
- name: Build and install package
run: python3 -m pip install -ve .[braket,test]
run: python3 -m pip install -ve .[azure-quantum,braket,test]

- name: Pytest
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
steps:
- name: Set up QEMU
if: matrix.cibw_archs == 'aarch64'
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v2
with:
platforms: arm64

Expand Down
14 changes: 13 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,19 @@ repos:
- id: end-of-file-fixer
- id: mixed-line-ending
- id: trailing-whitespace
- id: fix-encoding-pragma

# Changes tabs to spaces
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.1.13
hooks:
- id: remove-tabs

- repo: https://github.com/asottile/pyupgrade
rev: v2.34.0
hooks:
- id: pyupgrade
args: [--py37-plus, --keep-mock]

- repo: https://github.com/PyCQA/isort
rev: 5.10.1
hooks:
Expand All @@ -57,6 +62,13 @@ repos:
# This is a slow hook, so only run this if --hook-stage manual is passed
stages: [manual]

- repo: https://github.com/asottile/blacken-docs
rev: v1.12.1
hooks:
- id: blacken-docs
args: [-S, -l, '120']
additional_dependencies: [black==22.3.0]

- repo: https://gitlab.com/PyCQA/flake8
rev: 3.9.2
hooks:
Expand Down
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ install:
- env
- python3 -m pip install -U pip setuptools wheel
- python3 -m pip install -U pybind11 dormouse revkit flaky pytest-cov coveralls boto3
- python3 -m pip install -U azure-quantum
- python3 -m pip install -r requirements.txt
- python3 -m pip install -ve .

Expand Down
25 changes: 24 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,27 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [v0.8.0] - 2022-10-18

### Added

- New backend for the Azure Quantum platform

### Changed

- Support for Python 3.6 and earlier is now deprecated
- Moved package metadata into pyproject.toml

### Fixed

- Fixed installation on Apple Silicon with older Python versions (&lt; 3.9)

### Repository

- Update `docker/setup-qemu-action` GitHub action to v2
- Fixed CentOS 7 configuration issue
- Added two new pre-commit hooks: `blacken-docs` and `pyupgrade`

## [v0.7.3] - 2022-04-27

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

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)

[Unreleased]: https://github.com/ProjectQ-Framework/ProjectQ/compare/v0.7.3...HEAD
[Unreleased]: https://github.com/ProjectQ-Framework/ProjectQ/compare/v0.8.0...HEAD

[v0.8.0]: https://github.com/ProjectQ-Framework/ProjectQ/compare/v0.7.3...v0.8.0

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

Expand Down
86 changes: 63 additions & 23 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ targeting various types of hardware, a high-performance quantum computer
simulator with emulation capabilities, and various compiler plug-ins.
This allows users to

- run quantum programs on the IBM Quantum Experience chip, AQT devices, AWS Braket, or IonQ service provided devices
- run quantum programs on the IBM Quantum Experience chip, AQT devices, AWS Braket, Azure Quantum, or IonQ service provided devices
- simulate quantum programs on classical computers
- emulate quantum programs at a higher level of abstraction (e.g.,
mimicking the action of large oracles instead of compiling them to
Expand All @@ -43,7 +43,10 @@ Examples
.. code-block:: python
from projectq import MainEngine # import the main compiler engine
from projectq.ops import H, Measure # import the operations we want to perform (Hadamard and measurement)
from projectq.ops import (
H,
Measure,
) # import the operations we want to perform (Hadamard and measurement)
eng = MainEngine() # create a default compiler (the back-end is a simulator)
qubit = eng.allocate_qubit() # allocate a quantum register with 1 qubit
Expand All @@ -52,7 +55,7 @@ Examples
Measure | qubit # measure the qubit
eng.flush() # flush all gates (and execute measurements)
print("Measured {}".format(int(qubit))) # converting a qubit to int or bool gives access to the measurement result
print(f"Measured {int(qubit)}") # converting a qubit to int or bool gives access to the measurement result
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:
Expand Down Expand Up @@ -80,9 +83,7 @@ Instead of simulating a quantum program, one can use our resource counter (as a
from projectq.ops import QFT
from projectq.setups import linear
compiler_engines = linear.get_engine_list(num_qubits=16,
one_qubit_gates='any',
two_qubit_gates=(CNOT, Swap))
compiler_engines = linear.get_engine_list(num_qubits=16, one_qubit_gates='any', two_qubit_gates=(CNOT, Swap))
resource_counter = ResourceCounter()
eng = MainEngine(backend=resource_counter, engine_list=compiler_engines)
qureg = eng.allocate_qureg(16)
Expand Down Expand Up @@ -112,12 +113,13 @@ To run a program on the IBM Quantum Experience chips, all one has to do is choos
import projectq.setups.ibm
from projectq.backends import IBMBackend
token='MY_TOKEN'
device='ibmq_16_melbourne'
compiler_engines = projectq.setups.ibm.get_engine_list(token=token,device=device)
eng = MainEngine(IBMBackend(token=token, use_hardware=True, num_runs=1024,
verbose=False, device=device),
engine_list=compiler_engines)
token = 'MY_TOKEN'
device = 'ibmq_16_melbourne'
compiler_engines = projectq.setups.ibm.get_engine_list(token=token, device=device)
eng = MainEngine(
IBMBackend(token=token, use_hardware=True, num_runs=1024, verbose=False, device=device),
engine_list=compiler_engines,
)
**Running a quantum program on AQT devices**
Expand All @@ -129,12 +131,13 @@ To run a program on the AQT trapped ion quantum computer, choose the `AQTBackend
import projectq.setups.aqt
from projectq.backends import AQTBackend
token='MY_TOKEN'
device='aqt_device'
compiler_engines = projectq.setups.aqt.get_engine_list(token=token,device=device)
eng = MainEngine(AQTBackend(token=token,use_hardware=True, num_runs=1024,
verbose=False, device=device),
engine_list=compiler_engines)
token = 'MY_TOKEN'
device = 'aqt_device'
compiler_engines = projectq.setups.aqt.get_engine_list(token=token, device=device)
eng = MainEngine(
AQTBackend(token=token, use_hardware=True, num_runs=1024, verbose=False, device=device),
engine_list=compiler_engines,
)
**Running a quantum program on a AWS Braket provided device**
Expand All @@ -150,13 +153,21 @@ IonQ from IonQ and the state vector simulator SV1:
creds = {
'AWS_ACCESS_KEY_ID': 'your_aws_access_key_id',
'AWS_SECRET_KEY': 'your_aws_secret_key',
}
}
s3_folder = ['S3Bucket', 'S3Directory']
device='IonQ'
eng = MainEngine(AWSBraketBackend(use_hardware=True, credentials=creds, s3_folder=s3_folder,
num_runs=1024, verbose=False, device=device),
engine_list=[])
device = 'IonQ'
eng = MainEngine(
AWSBraketBackend(
use_hardware=True,
credentials=creds,
s3_folder=s3_folder,
num_runs=1024,
verbose=False,
device=device,
),
engine_list=[],
)
.. note::
Expand All @@ -175,6 +186,35 @@ IonQ from IonQ and the state vector simulator SV1:
python3 -m pip install -ve .[braket]
**Running a quantum program on a Azure Quantum provided device**

To run a program on devices provided by the `Azure Quantum <https://azure.microsoft.com/en-us/services/quantum/>`_.

Use `AzureQuantumBackend` to run ProjectQ circuits on hardware devices and simulator devices from providers `IonQ` and `Quantinuum`.

.. code-block:: python
from projectq.backends import AzureQuantumBackend
azure_quantum_backend = AzureQuantumBackend(
use_hardware=False, target_name='ionq.simulator', resource_id='<resource-id>', location='<location>', verbose=True
)
.. note::

In order to use the AzureQuantumBackend, you need to install ProjectQ with the 'azure-quantum' extra requirement:

.. code-block:: bash
python3 -m pip install projectq[azure-quantum]
or

.. code-block:: bash
cd /path/to/projectq/source/code
python3 -m pip install -ve .[azure-quantum]
**Running a quantum program on IonQ devices**

To run a program on the IonQ trapped ion hardware, use the `IonQBackend` and its corresponding setup.
Expand Down
6 changes: 3 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# projectq documentation build configuration file, created by
# sphinx-quickstart on Tue Nov 29 11:51:46 2016.
Expand Down Expand Up @@ -533,6 +532,7 @@ def linkcode_resolve(domain, info):
import projectq.setups.ibm as ibm_setup
from projectq import MainEngine
eng = MainEngine(engine_list=ibm_setup.get_engine_list())
# eng uses the default Simulator backend
Expand Down Expand Up @@ -560,10 +560,10 @@ def linkcode_resolve(domain, info):
os.mkdir(docgen_path)

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

new_lines = desc.get_ReST()
Expand Down
Loading

0 comments on commit 009c880

Please sign in to comment.