Skip to main content

九章光量子真机云接入软件包(jiuzhang SDK)

Project description

jiuzhang SDK 开发说明

本目录是 jiuzhang Python SDK 的源码工程。仓库根 README.md 面向用户和外部 协作方,本文件面向 SDK 开发维护。

当前主线

当前主线是九章云平台 HTTP SDK:

Python / Jupyter
  -> jiuzhang SDK
  -> 九章云平台 API / 本地九章云平台 Mock
  -> 天衍适配器
  -> 天衍平台 / tianyan-Mock

SDK 不直接请求天衍平台,不直接请求 tianyan-Mock,也不保留早期 TCP 真机直连 协议线。

工程结构

code/
├── pyproject.toml
├── README.md
├── src/jiuzhang/
│   ├── __init__.py
│   ├── auth/              # TokenManager
│   ├── cloud/             # CloudClient / HttpTransport
│   ├── gbs/               # GBSParams / GBSResult / analysis / mock
│   ├── jupyter.py         # Notebook helpers
│   ├── settings.py        # Settings.from_env()
│   ├── errors.py
│   ├── exceptions.py
│   └── result.py
└── tests/
    ├── unit/
    └── integration/

本地开发

使用本机 jzsdk conda 环境:

conda activate jzsdk
cd C:\Users\Administrator\Documents\Project\gitlab\jiuzhang_sdk\code
pip install -e ".[dev,jupyter]"

质量检查:

ruff format src tests
ruff check src tests
mypy src
pytest tests

公开 API

from jiuzhang import CloudClient, TokenManager
from jiuzhang import GBSParams, GBSResult, parse_gbs_result
from jiuzhang.gbs.analysis import photon_count_histogram
from jiuzhang.gbs.mock import generate_mock_samples

云平台接口

SDK 当前请求九章云平台公开接口:

POST /estimate
POST /tasks/submit
GET  /tasks/{task_id}

认证头:

X-Jiuzhang-API-Key: <api_key>

提交任务时自动携带:

X-Request-Id: <uuid>

所有云平台响应先检查 code,只有 code == 0 才视为业务成功。

本地 Mock

cd C:\Users\Administrator\Documents\Project\gitlab\jiuzhang_sdk
python local_test/mock_cloud_platform/mock_cloud_platform.py --port 18081 --mode standalone

SDK 测试和示例中的 base_url 指向本地九章云平台 Mock:

http://127.0.0.1:18081

版本

当前版本:0.1.0a10

License

Proprietary — Copyright © 2026 九章量子.

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

jiuzhang_sdk-0.1.0a10.tar.gz (27.1 kB view details)

Uploaded Source

Built Distribution

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

jiuzhang_sdk-0.1.0a10-py3-none-any.whl (25.2 kB view details)

Uploaded Python 3

File details

Details for the file jiuzhang_sdk-0.1.0a10.tar.gz.

File metadata

  • Download URL: jiuzhang_sdk-0.1.0a10.tar.gz
  • Upload date:
  • Size: 27.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for jiuzhang_sdk-0.1.0a10.tar.gz
Algorithm Hash digest
SHA256 f91e6889d30f3916c3bfb42877615a55cf62546b5329ce7569365df7aed3c78c
MD5 64ff4319ff2aadcdb09530fb86e7f478
BLAKE2b-256 d79c82b09ae01dc84a22012d1e3e07856cd6d37feaf28a45e4f344ec7ab4e60f

See more details on using hashes here.

File details

Details for the file jiuzhang_sdk-0.1.0a10-py3-none-any.whl.

File metadata

File hashes

Hashes for jiuzhang_sdk-0.1.0a10-py3-none-any.whl
Algorithm Hash digest
SHA256 1b9445ca5e00270b80e10c6fa3b8979f3ad52203fa7017f372e636bb3f1abe7c
MD5 15287fb02ca64ca291f6fb7e57840972
BLAKE2b-256 6b24c873b58904bfcb24c4c4d1224563c338ce2d9f071e4dd00b5b39656b12d4

See more details on using hashes here.

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