Metadata-Version: 2.4
Name: qubecli
Version: 1.0.9
Summary: QubeCore CLI — Command Line Interface for QubeCore
License: MIT License
        
        Copyright (c) 2026 QubeCore Project
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Requires-Python: >=3.11
Requires-Dist: qubecore-client>=1.0.15
Requires-Dist: typer>=0.12.0
Provides-Extra: dev
Requires-Dist: mypy>=1.8.0; extra == 'dev'
Requires-Dist: ruff>=0.1.0; extra == 'dev'
Description-Content-Type: text/markdown

# QubeCli

Command Line Interface for QubeCore — Quantum Computing Operating System.

## Overview

QubeCli provides a terminal-based interface for submitting and managing
quantum jobs on QubeCore. Built on [qubecore-client](https://github.com/sdt-quantum/qubecore-client).

## Requirements

- Python 3.11+
- QubeCore Server running and accessible

## Installation

```bash
pip install qubecli
```

## Quick Start

```bash
# Set server address
qubecore config set host 192.168.1.100:50051

# Submit a gate job
qubecore submit --backend backend1 \
  --circuit 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg q[2];\ncreg c[2];\nh q[0];\ncx q[0],q[1];\nmeasure q -> c;' \
  --shots 100

# Submit a pulse job
qubecore submit-pulse --backend backend1 \
  --pulse '{"channel": "qubit_0", "frequency": 5000000000, "amplitude": 0.5, "duration": 100}' \
  --shots 100

# Submit a reset job
qubecore submit-reset --backend backend1 \
  --qubits qubit_0,qubit_1 \
  --shots 100

# Submit a calibration job
qubecore submit-calibration --backend backend1 \
  --calibration-type widescan \
  --params '{"qubit": "qubit_0", "span": 100000000, "n_points": 200, "num_shots": 100}'

# Stream gate jobs with a parameter sweep (results arrive one by one)
qubecore stream \
  --backend backend1 \
  --template 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg q[2];\ncreg c[2];\nry({theta}) q[0];\ncx q[0],q[1];\nmeasure q -> c;' \
  --params '[{"theta": 0.0}, {"theta": 0.5}, {"theta": 1.57}]' \
  --shots 1024

# Check status
qubecore status --job-id <job_id>

# Fetch result
qubecore result --job-id <job_id>

# Cancel job (only possible while status is PENDING)
qubecore cancel --job-id <job_id>
```

## Commands

### Version

```bash
qubecore -v
qubecore --version
```

### Server Configuration

```bash
qubecore config set host 192.168.1.100:50051
qubecore config get
qubecore config get host
qubecore config unset host
```

### Job Commands

```bash
# Gate job
qubecore submit --backend <backend> --circuit <circuit_string> --shots <n>
qubecore submit --backend backend1 --circuit 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg q[2];\ncreg c[2];\nh q[0];\ncx q[0],q[1];\nmeasure q -> c;' --shots 100 --priority 2 --optimization-level 1

# Pulse job
qubecore submit-pulse --backend <backend> --pulse <pulse_json> --shots <n>

# Reset job
qubecore submit-reset --backend <backend> --qubits qubit_0,qubit_1 --shots <n>

# Calibration job
qubecore submit-calibration --backend <backend> --calibration-type widescan --params '{"qubit": "qubit_0", "span": 100000000, "n_points": 200, "num_shots": 100}'

# Stream gate job (parameter sweep, results arrive one by one)
qubecore stream --backend <backend> \
  --template 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg q[2];\ncreg c[2];\nry({theta}) q[0];\ncx q[0],q[1];\nmeasure q -> c;' \
  --params '[{"theta": 0.0}, {"theta": 0.5}, {"theta": 1.57}]' \
  --shots 1024

# Status
qubecore status --job-id <job_id>

# Result
qubecore result --job-id <job_id>

# Cancel
qubecore cancel --job-id <job_id>
```

One-time server override (overrides saved host for this command only):

```bash
qubecore --host 10.0.0.1:50051 submit --backend backend1 --circuit 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg q[2];\ncreg c[2];\nh q[0];\ncx q[0],q[1];\nmeasure q -> c;' --shots 100
```

## Options

### `submit`

| Option | Required | Description |
|--------|:--------:|-------------|
| `--backend` | Yes | Backend name (`backend1`, `kreo.sc-20`, etc.) |
| `--circuit` | Yes | Circuit string (QASM2/QASM3/JSON) |
| `--shots` | Yes | Number of shots |
| `--priority` | No | Priority 1–4 (1=CRITICAL, 2=HIGH, 3=NORMAL, 4=LOW) |
| `--optimization-level` | No | Transpile optimization level 0–3 |

### `submit-pulse`

| Option | Required | Description |
|--------|:--------:|-------------|
| `--backend` | Yes | Backend name |
| `--pulse` | Yes | Pulse program string (backend-specific JSON) |
| `--shots` | Yes | Number of shots |
| `--priority` | No | Priority 1–4 (default: 3=NORMAL) |

### `submit-reset`

| Option | Required | Description |
|--------|:--------:|-------------|
| `--backend` | Yes | Backend name |
| `--qubits` | Yes | Comma-separated qubit names (e.g. `qubit_0,qubit_1`) |
| `--shots` | Yes | Number of verification shots after reset |
| `--priority` | No | Priority 1–4 (default: 3=NORMAL) |

### `submit-calibration`

| Option | Required | Description |
|--------|:--------:|-------------|
| `--backend` | Yes | Backend name |
| `--calibration-type` | Yes | Calibration type: `widescan` or `punchout` |
| `--params` | Yes | Calibration parameters as JSON string |
| `--priority` | No | Priority 1–4 (default: 3=NORMAL) |

### `stream`

Parameter sweep over a QASM template using bidirectional streaming. Results are printed as each iteration completes.

| Option | Required | Description |
|--------|:--------:|-------------|
| `--backend` | Yes | Backend name |
| `--template` | Yes | QASM circuit template with `{param}` placeholders |
| `--params` | Yes | JSON array of parameter dicts (one per iteration) |
| `--shots` | Yes | Number of shots per iteration |
| `--priority` | No | Priority 1–4 (default: 3=NORMAL) |
| `--optimization-level` | No | Transpile optimization level 0–3 |

## Compatibility

| qubecli | qubecore-client | qubecore |
|---------|----------------|----------|
| 1.0.8+ | 1.0.15+ | 1.x |
| 1.x | 1.x | 1.x |

## License

MIT
