Metadata-Version: 2.4
Name: imagegp-cli
Version: 0.1.0
Summary: Cross-platform command-line client for ImageGP
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: click>=8.1
Requires-Dist: httpx>=0.27
Requires-Dist: PyYAML>=6.0
Requires-Dist: keyring>=25.0
Dynamic: license-file

# ImageGP CLI

`imagegp` is a local, cross-platform HTTP client for ImageGP. Its `server` value is the ImageGP API base URL, not only the domain name. It uploads local inputs through the API, submits an analysis, polls the asynchronous task, downloads a ZIP artifact bundle, and writes it to a local output folder.

The analysis itself remains on the [ImageGP](https://www.bic.ac.cn/BIC/) server.

## Install

Choose one of the following methods to install `imagegp`:

### Install from PyPI

```
pip install imagegp-cli
```

### Install from GitHub

```bash
pip install ""git+https://github.com/Tong-Chen/imagegp-cli.git""
```

### Install from Gitee

```bash
pip install "git+https://gitee.com/ct5869/imagegp-cli.git"
```

### Install from source

```bash
git clone https://github.com/Tong-Chen/imagegp-cli.git
cd imagegp-cli
python -m pip install .
```

## CLI language

Command-line prompts support Chinese and English. English is the default. Set
the language before the subcommand, or configure it through the environment:

```bash
imagegp --language en login --server https://www.bic.ac.cn/Cloud_Platform_API
imagegp --language zh tools list
export IMAGEGP_LANGUAGE=en
```

`--lang` is an alias for `--language`; accepted values are `zh` and `en`.

JSON output field names remain unchanged regardless of the selected language.

## Authentication

Login interactively and let the CLI store the token in the system keychain:

```bash
imagegp login --server https://www.bic.ac.cn/Cloud_Platform_API
```

The current server login contract expects the password digest used by the Web
client. `imagegp login` hashes the interactive password with MD5 by default.
Use `--password-digest` when supplying an already-generated digest.

CLI run, upload, status, and download operations require an authenticated user.

## Commands

```bash
imagegp version
imagegp logout
imagegp tools list
imagegp run --config examples/boxplot.yaml --input-dir ./input --output-dir ./result
```

Use `--json-output` for automation. A successful run stores the API result in
`result/run/result.json`, the server artifact manifest in
`result/run/artifacts/manifest.json`, and downloaded result files below
`result/run/artifacts/`.

## Optional operations

These operations are not always required.

### Authentication token and environment variables

You can also provide the token through the environment:

```bash
export IMAGEGP_TOKEN='...'
export IMAGEGP_SERVER='https://www.bic.ac.cn/Cloud_Platform_API'
```

Windows PowerShell:

```powershell
$env:IMAGEGP_TOKEN = '...'
$env:IMAGEGP_SERVER = 'https://www.bic.ac.cn/Cloud_Platform_API'
```

### Development install

```bash
python -m venv .venv
source .venv/bin/activate       # Windows: .venv\\Scripts\\activate
python -m pip install -e .
```
