Skip to main content

A quantum plugin for qiskit AER

Project description

AER Quantum Server Plugin

Build, Test and publish release version

This is the AER plugin for quantum local server. With it, you can easily run your AER jobs in a local server outside your own computer.

Functionalities

In this early stage, this plugin manages the following backends:

  • AER (pure AER implementation)

and to them you can submit jobs to get: counts, quasi distributions and expectation values.

Even thought it's very limited for now, in future versions we aim to make more backends available.

Installation

To install run in your terminal:

pip install aer-plugin

No Server

Although this is meant to be used inside a docker container as a plugin for quantum local server, you can run it locally without it.

To do that, simply install the dependencies:

pip install -r requirements

and then import the aer_plugin module inside your python script:

#main.py

from aer_plugin import Plugin

p = Plugin()

# your qiskit code
# remember to export 
# your circuit to a 
# .qasm file
# ...

target_backend = "aer"
qasm_file_path = "<qasm_file_path>"
metadata = {"shots":1000}
result_type = "counts"

result = p.execute(
    target_backend, 
    qasm_file_path, 
    metadata, 
    result_type)

print(result) # e.g.: {'0':1000}

Usage

As postulated by the qserver documentation, the 3 possible outcomes are counts, quasi dist and expval. To evaluate them with this plugin you must provide some metadata in a specific pattern:

type what you need
counts no metadata is mandatory here, but you can specify the amount of shots you want metadata={"shots":1024}, by default the 1000 are taken.
quasi-dist the same as counts
expval the obs(observables) metadata is mandatory to run the estimator. You must provide a list of lists. Each list inside the main list represents a distinct pub (circuit evaluation - example: [ [pub1], [pub2], ..., [pubn] ]). Inside these lists, you must provide tuples with an observable and its coefficient like: (obs, coeff). Here's an example of a correct expval experiment metadata: [ [('ZZI', 0.4), ('ZIZ', 0.3)], [('IZ', 1)] ].

Dev

For developers. There's some dependencies you need to have installed before adding any code. To ease this installation, you can use conda/mamba/conda-lock to load everything in the correct version.

# using conda/mamba/conda-lock
mamba env create -f environment.yml
conda env create -f environment.yml
conda-lock install -n aer-plugin conda-lock.yml

# then activate your environment
conda activate aer-plugin
mamba activate aer-plugin

# however, if you prefere, you can use pip as well
# make sure to use a virtual environment to avoid conflicts
pip install -r requirements.txt -r dev-requirements.txt

In this project are being used 3 check stages to ensure code quality, which are:

  • linting/code style: using pylint/black
  • types: using mypy
  • tests: using pytest

To manage all this, we're using tox, for 3 python versions: 3.10, 3.11 and 3.12, expecting more versions in the future.

During development, ensure to run tox regularly to ensure that everything is behaving as expected.

to learn more about tox check their wiki here.

Contributing

To start contributing for this project, make sure to:

  • open an issue explaining what you have in mind
  • follow the dev section
  • add as many tests as you can on ./tests
  • use a different branch for you modifications
  • add comments explaining parts of your code that can be directly understand without deep investigation
  • create readable code

Ensuring that, you're ready to open a pull request and be part of this community :)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aer_plugin-0.0.2.tar.gz (10.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aer_plugin-0.0.2-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file aer_plugin-0.0.2.tar.gz.

File metadata

  • Download URL: aer_plugin-0.0.2.tar.gz
  • Upload date:
  • Size: 10.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for aer_plugin-0.0.2.tar.gz
Algorithm Hash digest
SHA256 fc565b62cc4051979029c40bcf9c9b94c255c7d6f2bd8d15ed1fb8ac8883873c
MD5 e46bb443b5fc709935ff25b0de4436a1
BLAKE2b-256 9ef274d5cae939540c3e0c8620a7977fb0fa55fef9d46ccc13ae72e17125517c

See more details on using hashes here.

Provenance

The following attestation bundles were made for aer_plugin-0.0.2.tar.gz:

Publisher: build_test_publish.yml on quantum-plugins/aer-plugin

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file aer_plugin-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: aer_plugin-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 8.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for aer_plugin-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2234f7f0554fb5b587889c01d7b66452fa1c00fbba4c69223f7b9fcb032939a3
MD5 afe6e6b75d5cc18282761639e0f33b3f
BLAKE2b-256 44d216d5e43557362ba35238b637069497fa281e32c2f03152e6cf7250f80c9d

See more details on using hashes here.

Provenance

The following attestation bundles were made for aer_plugin-0.0.2-py3-none-any.whl:

Publisher: build_test_publish.yml on quantum-plugins/aer-plugin

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page