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

Add support to python 3.11 #311

Open
wants to merge 25 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
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
12 changes: 6 additions & 6 deletions .github/workflows/test_main_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
python: ['3.8', '3.9', '3.10']
python: ['3.8', '3.9', '3.10', '3.11', '3.12']
# The type of runner that the job will run on
runs-on: ${{ matrix.os }}

steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
Expand All @@ -42,7 +42,7 @@ jobs:
pip install ipykernel
- name: Setup IBMQ account
env:
IBMQ_TOKEN: ${{ secrets.IBMQ_TOKEN }}
IBMQ_TOKEN: ${{ secrets.IBMQ_TOKEN }}
run: |
IBMQ_TOKEN=$IBMQ_TOKEN
source env/bin/activate
Expand All @@ -68,7 +68,7 @@ jobs:
source env/bin/activate
ipython kernel install --name "env" --user
pytest tests/ src/*/tests -m 'not (qpu or sim)' --cov --cov-report=xml:coverage.xml

- name: Upload coverage reports to Codecov with GitHub Action
uses: codecov/codecov-action@v3
with:
Expand All @@ -92,7 +92,7 @@ jobs:
run: |
python -m pip install --upgrade pip
make dev-install-docs

- name: Install qvm
run: |
find /usr/lib -name "libffi.so*"
Expand All @@ -109,7 +109,7 @@ jobs:
screen -d -m qvm -S
screen -d -m quilc -S
cd ..

- name: Build and test Sphinx docs
run: |
sudo apt-get install pandoc
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/test_main_macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python: ['3.8', '3.9', '3.10']
python: ['3.8', '3.9', '3.10', '3.11', '3.12']
forest-sdk-version: ['2.23.0']

runs-on: macos-latest
Expand All @@ -25,8 +25,8 @@ jobs:
uses: actions/setup-python@v3
with:
python-version: ${{matrix.python}}
- name: Install forest on macos

- name: Install forest on macos
run: |
echo $PATH
cd /usr/local/bin/
Expand All @@ -44,7 +44,7 @@ jobs:
cd ..

- name: Install OpenQAOA
run: |
run: |
python -m pip install --user virtualenv
python -m venv env
source env/bin/activate
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test_main_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python: ['3.8', '3.9', '3.10']
python: ['3.8', '3.9', '3.10', '3.11', '3.12']
forest-sdk-version: [2.23.0]

# Run on a Windows machine
Expand All @@ -33,7 +33,7 @@ jobs:
- name: Add msbuild to PATH
uses: microsoft/[email protected]

# Install OpenQAOA
# Install OpenQAOA
- name: Install OpenQAOA
shell: pwsh
run: |
Expand All @@ -57,7 +57,7 @@ jobs:
Start-Process -FilePath "C:\Program Files\Rigetti Computing\Forest SDK for Windows\quilc.exe" -ArgumentList "-S" -PassThru
Start-Process -FilePath "C:\Program Files\Rigetti Computing\Forest SDK for Windows\qvm.exe" -ArgumentList "-S" -PassThru

# Run all tests
# Run all tests
- name: Run tests
shell: pwsh
run: |
Expand Down
1 change: 0 additions & 1 deletion _version.py

This file was deleted.

28 changes: 14 additions & 14 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Welcome to OpenQAOA's documentation!
====================================

OpenQAOA is an advanced multi-backend SDK for quantum optimization designed to ease research efforts within the VQA environment while ensuring the reliability and reproducibility of results. The library is divided into individually installable backend plugins.
OpenQAOA is an advanced multi-backend SDK for quantum optimization designed to ease research efforts within the VQA environment while ensuring the reliability and reproducibility of results. The library is divided into individually installable backend plugins.
The core functionalities of the package are contained within `openqaoa-core`, required to run QAOA computations on any Quantum hardware or simulator. Further it includes `openqaoa-qiskit`, `openqaoa-pyquil`, `openqaoa-azure`, `openqaoa-braket` for running
QAOA on devices accessible through the respective cloud providers. Installing any plugin through PyPI ships `openqaoa-core` along with it to provide the complete set of tools required to run QAOA computations.
Users can also easily install all OpenQAOA plugins available by installing `openqaoa` through PyPI. The `openqaoa` metapackage easily manages all OpenQAOA plugins and their dependencies. Users can also install `openqaoa` in developer mode by git cloning the repository and executing the install Makefile,
Expand Down Expand Up @@ -36,12 +36,12 @@ Getting started
Installing
----------

OpenQAOA provides several installation options to choose from. The package consists of `openqaoa-core` and backend specific modules that let users selectively install the provider they wish to run QAOA on.
OpenQAOA provides several installation options to choose from. The package consists of `openqaoa-core` and backend specific modules that let users selectively install the provider they wish to run QAOA on.
For instance, `openqaoa-qiskit` enables QAOA computations on IBMQ devices and simulators, and qiskit supported devices. For a complete installation including all supported cloud providers,
users can simply install the full `openqaoa` metapackage. Do note, `openqaoa-core` is a dependency for all backend specific modules and the full `openqaoa` pacakge.
users can simply install the full `openqaoa` metapackage. Do note, `openqaoa-core` is a dependency for all backend specific modules and the full `openqaoa` pacakge.
rodolfocarobene marked this conversation as resolved.
Show resolved Hide resolved
Therefore, it ships by default with all flavors of OpenQAOA installations.

You can install the latest variants of OpenQAOA directly from PyPI. First, we recommend you create a virtual environment with python>=3.10 and then pip install openqaoa variants with the following commands
You can install the latest variants of OpenQAOA directly from PyPI. First, we recommend you create a virtual environment with python>=3.11 and then pip install openqaoa variants with the following commands
- To install full OpenQAOA with all backend plugins and the `openqaoa` metapackage, users can

.. code-block:: bash
Expand All @@ -64,7 +64,7 @@ Alternatively, you can install manually directly from the GitHub repository by

2. We recommend creating a new python `virtual environment`, for instance, using conda. Instructions on how to create a virtual environment using Anaconda can be found [here](https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#creating-an-environment-with-commands). Make sure to use **python 3.8** (or newer) for the environment.

3. After cloning the repository `cd openqaoa` and pip install the package.
3. After cloning the repository `cd openqaoa` and pip install the package.

.. code-block:: bash

Expand Down Expand Up @@ -102,11 +102,11 @@ First, create a problem instance. For example, an instance of vertex cover:

Where [networkx](https://networkx.org/) is an open source Python package that can easily, among other things, create graphs.

Once the binary problem is defined, the simplest workflow can be defined as
Once the binary problem is defined, the simplest workflow can be defined as

.. code-block:: python
from openqaoa import QAOA

from openqaoa import QAOA
q = QAOA()
q.compile(qubo_problem)
q.optimize()
Expand Down Expand Up @@ -173,7 +173,7 @@ rqaoa_type can take two values which select elimination strategies. The user can

Factory mode
------------
The user is also free to directly access the source code without using the workflow API.
The user is also free to directly access the source code without using the workflow API.

A few reference notebooks can be found:
* [comparing vectorized, pyquil, and qiskit backents](examples/test_backends_correctness.ipynb)
Expand Down Expand Up @@ -202,7 +202,7 @@ then, specify terms and weights in order to define the cost hamiltonian

cost_hamil = Hamiltonian.classical_hamiltonian(terms=terms,coeffs=coeffs,constant=0)
mixer_hamil = X_mixer_hamiltonian(n_qubits=n_qubits)

After having created the hamiltonians it is time to create the Circuit parameters and the Variational Parameters

.. code-block:: python
Expand All @@ -213,7 +213,7 @@ After having created the hamiltonians it is time to create the Circuit parameter
Then proceed by instantiating the backend device

.. code-block:: python

backend_obj = QAOAvectorizedBackendSimulator(qaoa_descriptor = qaoa_descriptor, append_state = None, prepend_state = None, init_hadamard = True)

And finally, create the classical optimizer and minimize the objective function
Expand All @@ -225,7 +225,7 @@ And finally, create the classical optimizer and minimize the objective function
optimizer_obj()


The result of the optimization will the be accessible as
The result of the optimization will the be accessible as

.. code-block:: python

Expand Down Expand Up @@ -259,7 +259,7 @@ Contents
:caption: Installation and setup

openqaoa_metapackage_install

openqaoa_core/openqaoa_core_install

openqaoa_qiskit/openqaoa_qiskit_install
Expand All @@ -283,7 +283,7 @@ Contents
openqaoa_azure/azure_backends

openqaoa_pyquil/pyquil_backends


.. toctree::
:maxdepth: 3
Expand Down
8 changes: 4 additions & 4 deletions docs/source/openqaoa_metapackage_install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ OpenQAOA Metapackage Installation

The following instructions install OpenQAOA along with all optional plugins

OpenQAOA is divided into separately installable plugins based on the requirements of the user. The core elements of the package are placed in ``openqaoa-core`` which comes pre-installed with each flavour of OpenQAOA.
OpenQAOA is divided into separately installable plugins based on the requirements of the user. The core elements of the package are placed in ``openqaoa-core`` which comes pre-installed with each flavour of OpenQAOA.

Currently, OpenQAOA supports the following backends and each can be installed exclusively with the exception of ``openqaoa-azure`` which installs ``openqaoa-qiskit`` as an additional requirement because Azure backends support circuit submissions via `qiskit`.

Expand All @@ -17,22 +17,22 @@ The OpenQAOA metapackage allows you to install all OpenQAOA plug-ins together.

Install via PyPI
----------------
You can install the latest version of OpenQAOA directly from PyPI. First, create a virtual environment with python3.8, 3.9, 3.10 and then pip install openqaoa with the following command
You can install the latest version of OpenQAOA directly from PyPI. First, create a virtual environment with python3.8, 3.9, 3.11, 3.12 and then pip install openqaoa with the following command
.. code-block:: bash

pip install openqaoa


Install via git clone
---------------------
Alternatively, you can install OpenQAOA manually from the GitHub repository by following the instructions below.
Alternatively, you can install OpenQAOA manually from the GitHub repository by following the instructions below.

**NOTE:** We recommend creating a python virtual environment for this project using a python environment manager, for instance Anaconda. Instructions can be found `here <https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#creating-an-environment-with-commands>`_. Make sure to use **python 3.8** (or newer) for the environment.

1. Clone the git repository:

.. code-block:: bash

git clone https://github.com/entropicalabs/openqaoa.git


Expand Down
29 changes: 28 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,30 @@
[build-system]
requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"
build-backend = "setuptools.build_meta"

[project]
name = "openqaoa"
version = "0.2.5"
authors = [{ name = "Entropica Labs" }]
description = "OpenQAOA is a python open-source multi-backend Software Development Kit to create, customise and execute the Quantum Approximate Optimisation Algorithm (QAOA) on Noisy Intermediate-Scale Quantum (NISQ) devices, and simulators"
readme = "README.md"
requires-python = ">=3.8, <3.13"
license = { file = "LICENSE" }
urls = { "Homepage" = "https://github.com/entropicalabs/openqaoa" }
classifiers = [
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Operating System :: OS Independent"
]
keywords = ["quantum", "optimisation", "SDK"]

dependencies = [
"openqaoa-azure==0.2.5",
"openqaoa-braket==0.2.5",
"openqaoa-core==0.2.5",
"openqaoa-pyquil==0.2.5",
KilianPoirier marked this conversation as resolved.
Show resolved Hide resolved
"openqaoa-qiskit==0.2.5"
]
38 changes: 0 additions & 38 deletions setup.py

This file was deleted.

31 changes: 31 additions & 0 deletions src/openqaoa-azure/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,34 @@
[build-system]
requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"

[project]
name = "openqaoa-azure"
version = "0.2.5"
authors = [{ name = "Entropica Labs" }]
description = "Azure Plug-in for OpenQAOA"
readme = "README.md"
requires-python = ">=3.8, <3.13"
license = { file = "LICENSE" }
urls = { "Homepage" = "https://github.com/entropicalabs/openqaoa" }
classifiers = [
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Operating System :: OS Independent",
]
keywords = ["quantum", "optimisation", "SDK"]

dependencies = [
"openqaoa-core==0.2.5",
"openqaoa-qiskit==0.2.5",
KilianPoirier marked this conversation as resolved.
Show resolved Hide resolved
"qdk",
"qiskit-qir",
"qiskit-ionq",
"azure-quantum[qiskit]",
]

[project.entry-points."openqaoa.plugins"]
azure = "openqaoa_azure.backend_config"
4 changes: 0 additions & 4 deletions src/openqaoa-azure/requirements.txt

This file was deleted.

Loading
Loading