Metadata-Version: 2.1
Name: quantum-serverless
Version: 0.0.4
Summary: UNKNOWN
Home-page: UNKNOWN
License: UNKNOWN
Keywords: quantum serverless qiskit
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Natural Language :: English
Classifier: Operating System :: MacOS
Classifier: Operating System :: POSIX :: Linux
Classifier: Operating System :: Microsoft :: Windows
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Topic :: Scientific/Engineering :: Physics
Requires-Python: >=3.7
Description-Content-Type: text/markdown
Requires-Dist: ray[data,default] (<3,>=2.2.0)
Requires-Dist: requests (>=2.28.2)
Requires-Dist: importlib-metadata (>=4.13.0)
Requires-Dist: qiskit-terra (>=0.23.1)
Requires-Dist: qiskit-nature (>=0.5.2)
Requires-Dist: qiskit-ibmq-provider (>=0.20.0)
Requires-Dist: qiskit-aer (>=0.11.2)
Requires-Dist: qiskit-ibm-runtime (>=0.8.0)
Requires-Dist: redis (>=4.5.1)
Requires-Dist: opentelemetry-api (>=1.15.0)
Requires-Dist: opentelemetry-sdk (>=1.15.0)
Requires-Dist: opentelemetry-exporter-jaeger (>=1.15.0)
Requires-Dist: opentelemetry-exporter-jaeger-proto-grpc (>=1.15.0)
Requires-Dist: opentelemetry-exporter-jaeger-thrift (>=1.15.0)

[![Stability](https://img.shields.io/badge/stability-alpha-f4d03f.svg)](https://github.com/Qiskit-Extensions/quantum-serverless/releases)
[![Client verify process](https://github.com/Qiskit-Extensions/quantum-serverless/actions/workflows/client-verify.yaml/badge.svg)](https://github.com/Qiskit-Extensions/quantum-serverless/actions/workflows/client-verify.yaml)
[![License](https://img.shields.io/github/license/qiskit-community/quantum-prototype-template?label=License)](https://github.com/qiskit-community/quantum-prototype-template/blob/main/LICENSE.txt)
[![Code style: Black](https://img.shields.io/badge/Code%20style-Black-000.svg)](https://github.com/psf/black)
[![Python](https://img.shields.io/badge/Python-3.7%20%7C%203.8%20%7C%203.9%20%7C%203.10-informational)](https://www.python.org/)
[![Qiskit](https://img.shields.io/badge/Qiskit-%E2%89%A5%200.39.0-6133BD)](https://github.com/Qiskit/qiskit)

# Quantum Serverless client

Client part of quantum serverless project. 
Installable python library to communicate with provisioned infrastructure.

### Table of Contents

1. [Installation](#installation)
2. [Usage](#usage)

----------------------------------------------------------------------------------------------------

### Installation

```shell
pip install quantum_serverless
```

or local installation from source

```shell
pip install -e .
```

----------------------------------------------------------------------------------------------------


### Usage

```python
from qiskit import QuantumCircuit
from qiskit.circuit.random import random_circuit
from qiskit.quantum_info import SparsePauliOp
from qiskit_ibm_runtime import Estimator

from quantum_serverless import QuantumServerless, run_qiskit_remote, get, put

# 1. let's annotate out function to convert it
# to function that can be executed remotely
# using `run_qiskit_remote` decorator
@run_qiskit_remote()
def my_function(circuit: QuantumCircuit, obs: SparsePauliOp):
	return Estimator().run([circuit], [obs]).result().values


# 2. Next let's create out serverless object to control
# where our remote function will be executed
serverless = QuantumServerless()

circuits = [random_circuit(2, 2) for _ in range(3)]

# 3. create serverless context
with serverless:
	# 4. let's put some shared objects into remote storage that will be shared among all executions
	obs_ref = put(SparsePauliOp(["ZZ"]))

    # 4. run our function and get back reference to it
    # as now our function it remote one
	function_reference = my_function(circuits[0], obs_ref)

    # 4.1 or we can run N of them in parallel (for all circuits)
	function_references = [my_function(circ, obs_ref) for circ in circuits]

	# 5. to get results back from reference
    # we need to call `get` on function reference
	print("Single execution:", get(function_reference))
	print("N parallel executions:", get(function_references))
```


