Metadata-Version: 2.4
Name: quapp
Version: 0.1.2
Summary: CLI for the Quapp quantum/cloud computing platform
License: MIT License
        
        Copyright (c) 2026 Quapp CLI Contributors
        
        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.
        
Project-URL: Homepage, https://gitlab.com/quanghuy.ha/Quapp-CLI
Project-URL: Repository, https://gitlab.com/quanghuy.ha/Quapp-CLI
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: typer[all]>=0.12
Requires-Dist: rich>=13
Requires-Dist: requests>=2.31
Requires-Dist: textual>=0.60.0
Provides-Extra: dev
Requires-Dist: pytest>=8; extra == "dev"
Dynamic: license-file

# Quapp CLI

A command-line interface for the [Quapp](https://quapp.cloud) quantum/cloud computing platform. Submit quantum jobs, manage functions and projects, and automate workflows from your terminal or Python scripts.

## Requirements

Python 3.10+ and pip.

## Install

```bash
pip install quapp
```

Or download a standalone binary from the [GitLab CI pipeline artifacts](https://gitlab.com/quapp/quapp-cli/-/pipelines) — no Python required.

## Quick Start

```bash
# 1. Authenticate (interactive prompt — use --email/--password flags for CI)
quapp login

# 2. Create a project and note the ID from the output
quapp project create --name my-project

# 3. Set it as default (avoids --project on every command)
quapp config set project-id <project-id>

# 4a. One-shot: upload handler, deploy, and run a job
quapp deploy \
  --project my-project \
  --function my-qec \
  --handler handler.py \
  --device Simulator \
  --shots 1024 \
  --wait

# 4b. Step-by-step (use when you need fine-grained control)
quapp function create --name my-qec --sdk-version 0.45.3 --lang qiskit
quapp function version <function-id> --description "v1" --files main.py
quapp job run --function <function-id> --device Simulator --shots 1024 --wait
```

## Commands

### Auth
```
quapp login                                  Authenticate (prompts for email + password)
quapp logout                                 Invalidate session
quapp whoami                                 Show the currently authenticated user
```

`quapp login` accepts `--email / -e` and `--password` flags for non-interactive/CI use.

### Config
```
quapp config show                            Print base_url, project_id, and masked token
quapp config set <key> <value>               Set base-url or project-id
```

Use `quapp config set project-id <id>` to set a default project. Project IDs are shown by `quapp project list`.

### SDKs
```
quapp sdk list                               List valid SDK names and versions for function create
```

### Projects
```
quapp project create --name X [--description Y] [--permission private|group]
quapp project list                           IDs shown here — use with config set project-id
quapp project get <id>
quapp project delete <id>
```

### Functions
```
quapp function create --name X --sdk-version X --lang qiskit|cuda [--description Y] [--project / -p <id>]
quapp function version <id> --description X --files file.py [--project / -p <id>]
quapp function list [--project / -p <id>]
quapp function get <id> [--project / -p <id>]
quapp function logs <id> [--project / -p <id>]
quapp function delete <id> [--project / -p <id>]
```

`quapp function version` accepts one or more `--files` entries.

### Jobs
```
quapp job run --function <id> --device X --shots N [--provider X] [--wait] [--project / -p <id>]
quapp job list [--project / -p <id>]
quapp job status <id> [--project / -p <id>]
quapp job results <id> [--project / -p <id>]
quapp job cancel <id> [--project / -p <id>]
quapp job retry <id> [--project / -p <id>]
quapp job watch <id> [--project / -p <id>]
```

`quapp job watch` live-polls until the job reaches a terminal state.

Use `quapp sdk list` to discover available providers and devices.

### Deploy (all-in-one)
```
quapp deploy --project X --function X --handler handler.py --device X [--sdk-version X]
             [--requirements requirements.txt] [--provider X] [--shots N]
             [--input KEY=VALUE ...] [--wait]
```

Uploads the handler, creates a function version, deploys it, and submits a job — all in one command. `--requirements` is auto-detected if omitted. Default provider is `Quapp`.

### Invoke (name-based shortcut)
```
quapp invoke invoke --project X --function X --device X [--provider X] [--shots N]
                    [--input KEY=VALUE ...] [--wait]
```

Resolves project/function/device names to IDs and submits a job without needing explicit IDs. Note: the command is `quapp invoke invoke` — `invoke` is both the command group and the subcommand.

### TUI
```
quapp tui                                    Launch the interactive terminal UI
```

### Global flags
```
--json    Output raw JSON instead of Rich tables
```

> **Note:** `--json` must precede the subcommand: `quapp --json job status <id>`.

## Python SDK

The `quapp` package can be used as a Python SDK — no CLI required.

```python
from quapp.config import load_config
from quapp.api.client import QuappClient
from quapp.api.jobs import run_job, get_job_status

config = load_config()
client = QuappClient(config.base_url, token=config.token, project_id=config.project_id)

job = run_job(client, function_id="f123", provider="Quapp", device="Simulator", shots=1024)
status = get_job_status(client, job["jobId"])
print(status["status"])
```

Full SDK reference: [`docs/SDK.md`](docs/SDK.md)

## Development

```bash
pip install -e .
python -m pytest tests/ -v
quapp tui          # launch interactive UI
```

## License

MIT
