QC Executor
This library provides an abstraction for quantum circuits and operators that can be run on different backends using an Executor object.
Installation
Core Installation
QC Executor can be installed with only the backends you need. By default, only Qiskit (used as the common intermediate representation) is required:
pip install qc-executor
Backend-Specific Installation
Install QC Executor with specific backends:
# Install with PennyLane backend
pip install qc-executor[pennylane]
# Install with Qulacs backend
pip install qc-executor[qulacs]
# Install with full Qiskit support (Aer simulator and IBM Runtime)
pip install qc-executor[qiskit-full]
# Install with Pauli Propagation backend
pip install qc-executor[pauli_propagation]
# Install with all backends
pip install qc-executor[all]
# Install multiple specific backends
pip install qc-executor[pennylane,qulacs,pauli_propagation]
Usage
Factory API (Recommended)
The Executor factory class provides a plugin-based interface for creating executors:
from qc_executor import Executor
# Create an executor for a specific backend
executor = Executor.create("qiskit", shots=1024, seed=42)
# List available backends
backends = Executor.available_backends()
print(backends) # ['qiskit', 'pennylane', 'qulacs', 'pauli_propagation']
# Create circuit and observable
from qc_executor import QuantumCircuit, QuantumOperator
circuit = QuantumCircuit(2)
circuit.h(0)
circuit.cx(0, 1)
observable = QuantumOperator.from_pauli_string("ZZ")
# Run computation
result = executor.expectation_value(circuit, observable)
print(result)
Backend Switching
You can easily switch between backends while preserving configuration:
# Create executor with specific configuration
qiskit_executor = Executor.create("qiskit", shots=1024, seed=42, caching=True)
# Switch to PennyLane backend with same configuration
pennylane_executor = qiskit_executor.switch_backend("pennylane")
# Switch with configuration overrides
qulacs_executor = qiskit_executor.switch_backend("qulacs", shots=2048)
Direct Import API (Alternative)
For backward compatibility, you can still import executors directly:
from qc_executor.qiskit import QiskitExecutor
from qc_executor.pennylane import PennyLaneExecutor
from qc_executor.qulacs import QulacsExecutor
# Create executor directly
executor = QiskitExecutor(shots=1024, seed=42)
Configuration Options
All executors support the following configuration parameters:
shots(int, optional): Number of measurement shotsseed(int, optional): Random seed for reproducibilitylog_file(str, optional): Path to log filelog_level(str, optional): Logging level ("DEBUG", "INFO", "WARNING", "ERROR")caching(bool, optional): Enable result cachingcache_dir(str, optional): Directory for caching (default: "cache")max_cache_size(int, optional): Maximum number of cached results (default: unlimited)
Backend Object Convention
When an executor accepts a backend-specific object (for example a Qiskit backend
instance or a PennyLane qml.devices.Device), the constructor parameter name is
backend.
from qc_executor.pennylane import PennyLaneExecutor
executor = PennyLaneExecutor(backend="default.mixed", shots=1000, seed=42)
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
License
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file qc_executor-0.1.0.tar.gz.
File metadata
- Download URL: qc_executor-0.1.0.tar.gz
- Upload date:
- Size: 353.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2461090932fa1d75fdd21a1984324ad3b05ffd06a70ca3328fba0ec0e5ced10d
|
|
| MD5 |
3ed9ba6d16492bd9e1924ece116f2ffe
|
|
| BLAKE2b-256 |
4685bbeda42711488c55e7f585780be11df276f70b78f0c68e814080d1c01345
|
Provenance
The following attestation bundles were made for qc_executor-0.1.0.tar.gz:
Publisher:
publish.yml on flaqship/qc-executor
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
qc_executor-0.1.0.tar.gz -
Subject digest:
2461090932fa1d75fdd21a1984324ad3b05ffd06a70ca3328fba0ec0e5ced10d - Sigstore transparency entry: 2529315602
- Sigstore integration time:
-
Permalink:
flaqship/qc-executor@0d225e86ae2273e9a2dc019fc64607d7ef98ce08 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/flaqship
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@0d225e86ae2273e9a2dc019fc64607d7ef98ce08 -
Trigger Event:
release
-
Statement type:
File details
Details for the file qc_executor-0.1.0-py3-none-any.whl.
File metadata
- Download URL: qc_executor-0.1.0-py3-none-any.whl
- Upload date:
- Size: 159.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d26e629819ed5ddec3d3dd277593a71a964e2f8bf566606004cde808d4178783
|
|
| MD5 |
bd7df1f5f0f83a68aa1517e4b3305421
|
|
| BLAKE2b-256 |
22b69ac432fbdf9e1d4d8fb6cc124584e1cc6096c720860cb8cb351ebcf56f3e
|
Provenance
The following attestation bundles were made for qc_executor-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on flaqship/qc-executor
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
qc_executor-0.1.0-py3-none-any.whl -
Subject digest:
d26e629819ed5ddec3d3dd277593a71a964e2f8bf566606004cde808d4178783 - Sigstore transparency entry: 2529315718
- Sigstore integration time:
-
Permalink:
flaqship/qc-executor@0d225e86ae2273e9a2dc019fc64607d7ef98ce08 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/flaqship
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@0d225e86ae2273e9a2dc019fc64607d7ef98ce08 -
Trigger Event:
release
-
Statement type: