Skip to main content

QPanda-lite

GitHub version Documentation Status PyPI version codecov Build and Test

QPanda: Quantum Programming Architecture for NISQ Device Application

QPanda-lite is a simple, easy-to-use, and transparent Python-native version of QPanda.


Table of Contents


Quick Example

from qpandalite.circuit_builder import Circuit
from qpandalite.simulator import OriginIR_Simulator

# Build a Bell state circuit
circuit = Circuit()
circuit.h(0)           # Hadamard on qubit 0
circuit.cnot(0, 1)     # CNOT from qubit 0 to qubit 1
circuit.measure(0, 1)   # Measure both qubits

# Simulate with 1000 shots
sim = OriginIR_Simulator()
result = sim.simulate_shots(circuit.originir, shots=1000)
print(result)
# Possible output: {0: 497, 3: 503}

Features

QPanda-lite 围绕以下目标设计:

特性 说明
透明 清晰的量子程序组装与执行方式
Python 原生 纯 Python 实现,安装简单,集成方便
多后端 支持 OriginIR Simulator、QASM Simulator、Quafu、OriginQ 等多种执行后端
同步/异步 支持同步和异步两种任务提交模式
可扩展 易于添加新的量子门、操作符和模拟后端

核心概念:

  • Circuit — 量子线路构建器,支持 OriginIR / OpenQASM 格式输出
  • Backend — 量子模拟器或真实量子计算机
  • Result — 测量结果以原生 Python 数据结构返回(dict / list / ndarray)

Installation

Supported Platforms

  • Windows / Linux / macOS

Requirements

  • Python 3.9 – 3.12

pip(推荐)

pip install qpandalite

Build from Source

纯 Python(无 C++ 依赖):

git clone https://github.com/Agony5757/QPanda-lite.git
cd QPanda-lite
pip install . --no-cpp

开发模式:

pip install -e .

含 C++ 模拟器(需 CMake):

git clone --recurse-submodules https://github.com/Agony5757/QPanda-lite.git
cd QPanda-lite
pip install .

Optional Dependencies

功能 安装命令
Quafu 执行后端 pip install pyquafu
Qiskit 执行后端 pip install qiskit qiskit-aer

Project Structure

QPanda-lite/
├── qpandalite/
│   ├── circuit_builder/          # Circuit class and gate definitions
│   ├── simulator/                # Local simulators (OriginIR, QASM, etc.)
│   ├── originir/                 # OriginIR parser
│   ├── qasm/                    # OpenQASM 2.0 parser
│   ├── task/                    # Cloud task submission (OriginQ / Quafu / IBM)
│   ├── transpiler/              # Circuit conversion (Qiskit ↔ OriginIR)
│   └── analyzer/                # Result analysis (expectation values, etc.)
├── QPandaLiteCpp/               # C++ backend (pybind11)
├── docs/                        # Sphinx documentation
└── test/                       # Unit tests

Quick Start

1. Build a Circuit

from qpandalite.circuit_builder import Circuit

c = Circuit()
c.rx(1, 0.1)         # RX rotation on qubit 1
c.cnot(1, 0)         # CNOT with control=1, target=0
c.measure(0, 1)      # Measure qubits 0 and 1


print(c.circuit)
# QINIT 2
# CREG 2
# RX q[1], (0.1)
# CNOT q[1], q[0]
# MEASURE q[0], c[0]
# MEASURE q[1], c[1]

注意:measure 只记录被测量的 qubit,电路中实际使用的 qubit 由门操作决定。

2. Circuit Simulation

import qpandalite.simulator as qsim

sim = qsim.OriginIR_Simulator(reverse_key=False)

originir = '''
QINIT 72
CREG 3
RY q[45],(0.9424777960769379)
RY q[46],(0.9424777960769379)
CZ q[45],q[46]
RY q[45],(-0.25521154)
RY q[46],(0.26327053)
X q[46]
MEASURE q[45],c[0]
MEASURE q[46],c[2]
MEASURE q[52],c[1]
'''

res = sim.simulate_statevector(originir)
print(res)
print(sim.state)

3. Submit to Cloud Hardware

import qpandalite.task.quafu as quafu

# Configure first: see qcloud_config_template/quafu_template.py
# quafu.create_quafu_online_config(...)

taskid = quafu.submit_task(circuit.originir, chip_id='ScQ-P10')
result = quafu.query_by_taskid_sync(taskid)

Examples

📁 examples/ — Runnable demonstrations

Getting Started

Example Description
Circuit Remapping Build a circuit and remap qubits for real hardware
Dummy Server Submit tasks to the local dummy simulator
Result Post-Processing Convert and analyze results

Algorithms

Example Description
Grover Search Unstructured search with quadratic speedup
Quantum Phase Estimation Eigenvalue phase estimation

Documentation

📖 Read the Docs


Status

🚧 Actively developing. API may change.

Metadata

Release files for qpandalite 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for qpandalite 0.3.0
File
qpandalite-0.3.0-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details
qpandalite-0.3.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.17+ x86-64 Details
qpandalite-0.3.0-cp313-cp313-manylinux_2_17_i686.manylinux2014_i686.whl CPython 3.13 CPython 3.13 Linux glibc 2.17+ x86-32 Details
qpandalite-0.3.0-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
qpandalite-0.3.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.17+ x86-64 Details
qpandalite-0.3.0-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl CPython 3.12 CPython 3.12 Linux glibc 2.17+ x86-32 Details
qpandalite-0.3.0-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details
qpandalite-0.3.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.17+ x86-64 Details
qpandalite-0.3.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl CPython 3.11 CPython 3.11 Linux glibc 2.17+ x86-32 Details
qpandalite-0.3.0-cp310-cp310-win_amd64.whl CPython 3.10 CPython 3.10 Windows x86-64 Details
qpandalite-0.3.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.17+ x86-64 Details
qpandalite-0.3.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl CPython 3.10 CPython 3.10 Linux glibc 2.17+ x86-32 Details

Total release size: 9.9 MB

Release files / qpandalite-0.3.0-cp313-cp313-win_amd64.whl

Download URL qpandalite-0.3.0-cp313-cp313-win_amd64.whl
Size 765.3 kB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
0631f9bdd241dc52fcaf1983ddb34c275dcdb2df1e32eede27e9e4daf7b123bd
BLAKE2b-256 checksum
How to use checksums
0a4d3680d3814afdf5bafcf0f58b9a2b92efed054dbee3ef4547d9c5e2bc2583
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 16, 2026.

Transparency log

Release files / qpandalite-0.3.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL qpandalite-0.3.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 844.4 kB
Tags CPython 3.13 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
346e765683017500888948e85b39399c19f373bb7ff26574d4cdc2740036ba47
BLAKE2b-256 checksum
How to use checksums
7cab0ef266a9de06bbe9362a25df506bc4ceaef74dedf5308a5e31f6785f7f8e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 16, 2026.

Transparency log

Release files / qpandalite-0.3.0-cp313-cp313-manylinux_2_17_i686.manylinux2014_i686.whl

Download URL qpandalite-0.3.0-cp313-cp313-manylinux_2_17_i686.manylinux2014_i686.whl
Size 855.5 kB
Tags CPython 3.13 Linux glibc 2.17+ x86-32
SHA-256 checksum
How to use checksums
1df8cb2ad7fd3c0138e831da2a6b92e10e0def5a4fa647d833591fe6c8267e03
BLAKE2b-256 checksum
How to use checksums
391c4cd562be56123f27a03564b1fc886b48cfc54bfd02e703342e8e245f7526
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 16, 2026.

Transparency log

Release files / qpandalite-0.3.0-cp312-cp312-win_amd64.whl

Download URL qpandalite-0.3.0-cp312-cp312-win_amd64.whl
Size 765.3 kB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
38226ec9a4882d7e9911da4f213b980c4b4bff6b2b07b87b8632a1eed40405c9
BLAKE2b-256 checksum
How to use checksums
8c93ae747257b7b01eb064ffd8e350b103e7f9fadffcda8bd41e4ca53ba84a1d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 16, 2026.

Transparency log

Release files / qpandalite-0.3.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL qpandalite-0.3.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 844.4 kB
Tags CPython 3.12 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
4e30e24a5648496c1990a280db18576b12d7a6bdd886e57595fbf761d3d5a145
BLAKE2b-256 checksum
How to use checksums
feb4f891ccbe6b810926ff6ed1cd4e2eaf662e2265ad826754b4e996aa47f2bc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 16, 2026.

Transparency log

Release files / qpandalite-0.3.0-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl

Download URL qpandalite-0.3.0-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl
Size 855.5 kB
Tags CPython 3.12 Linux glibc 2.17+ x86-32
SHA-256 checksum
How to use checksums
4c29525f7eab3039b1f093d2f73157bc617d7c80b7a75a0cb56a039b78ac4305
BLAKE2b-256 checksum
How to use checksums
6d37cd2379b860d5afab41df7179ec7353cba3882a98e0ce056db5db46508217
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 16, 2026.

Transparency log

Release files / qpandalite-0.3.0-cp311-cp311-win_amd64.whl

Download URL qpandalite-0.3.0-cp311-cp311-win_amd64.whl
Size 765.3 kB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
ffd6d7c25bc28180be9432c2b466fe8644aa77f942887a5ff04f344374870d73
BLAKE2b-256 checksum
How to use checksums
a8be63f67fbeb1f7653b83c51684f5c9e5488c5a556c97b8e1623ea3b7cc8eda
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 16, 2026.

Transparency log

Release files / qpandalite-0.3.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL qpandalite-0.3.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 844.4 kB
Tags CPython 3.11 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
188489fb51c5e529b0ed339be0f82068b5960243c7e4e33e25913efd1a8142fb
BLAKE2b-256 checksum
How to use checksums
6a6c2ada852b867f28c5c82e1a8365640ee8c9c2d397fbf36d6de9bd974dcc99
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 16, 2026.

Transparency log

Release files / qpandalite-0.3.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl

Download URL qpandalite-0.3.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl
Size 855.5 kB
Tags CPython 3.11 Linux glibc 2.17+ x86-32
SHA-256 checksum
How to use checksums
716109a570adf453431673be6f60bbbbc4cc4da80113823621df6341bcb84156
BLAKE2b-256 checksum
How to use checksums
b6a37e372f20eabc3d03d1fcd720e1c1d846f0b26a7013e39a059bac71ce37b6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 16, 2026.

Transparency log

Release files / qpandalite-0.3.0-cp310-cp310-win_amd64.whl

Download URL qpandalite-0.3.0-cp310-cp310-win_amd64.whl
Size 765.3 kB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
43d197b83027cdb11ef95aed0a816739de3cdeda45e0c205bdf1486be71e3e01
BLAKE2b-256 checksum
How to use checksums
08cb7ab300a5e929cc0b8c3a278e1c608df6943717ff7b4e4da5cfda199e5893
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 16, 2026.

Transparency log

Release files / qpandalite-0.3.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL qpandalite-0.3.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 844.4 kB
Tags CPython 3.10 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
03282574c9bfd2e7f5ca24b09b7ec7c4198468f0c99417e438f77d6ad1477d0c
BLAKE2b-256 checksum
How to use checksums
cb35f91627acbfa4c7dee4f6a60aec11578b58d3b644984c4d6897ec3a319895
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 16, 2026.

Transparency log

Release files / qpandalite-0.3.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl

Download URL qpandalite-0.3.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl
Size 855.4 kB
Tags CPython 3.10 Linux glibc 2.17+ x86-32
SHA-256 checksum
How to use checksums
2ba9cf5905ec1dde71846340c071023f86c89a5577631ec3952d4cf21da029ec
BLAKE2b-256 checksum
How to use checksums
a58206bd3ca2ae840a0e60b31beb9c212d33a7090a9b868762e8b8cc5bd9af82
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 16, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.3.0 This release

12 release files

0.2.3

12 release files

0.2.0

8 release files

0.1.9

4 release files

0.1.8

4 release files

0.1.7

4 release files

0.1.6

3 release files

0.1.5

3 release files

0.1.4

3 release files

0.1.3

3 release files

0.1.2

3 release files

0.1.1

3 release files

0.1.0

3 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page