Skip to main content

Command-line interface for LuciHub system

Project description

LuciHub CLI

Command-line interface for the LuciHub analog computing system.

Overview

The LuciHub CLI provides a convenient command-line interface to interact with LuciHub's analog computing devices through the REST API. You can submit tasks, monitor their progress, and retrieve results directly from your terminal.

Installation

  1. Navigate to the CLI directory:

    cd components/cli
    
  2. Install using Poetry:

    poetry install
    
  3. The CLI tool will be available as lucihub command after installation.

Usage

Basic Commands

The CLI connects to a LuciHub API server. By default, it connects to localhost:8000, but you can specify different host and port:

# Connect to default server
lucihub status

# Connect to different server
lucihub -h 192.168.1.100 -p 8080 status

Available Commands

1. System Status

Get system information and connected devices:

lucihub status

2. Run Tasks

Execute a configuration on physical LUCIDAC device:

# Basic run
lucihub run config.json

# With custom parameters
lucihub run config.json --sample-rate 20000 --op-time 0.5 --device device1

Options:

  • --sample-rate: Number of samples per second (default: 10000)
  • --op-time: Integration time in seconds (default: 0.1)
  • --device: Specific device ID (auto-detected if not specified)
  • --no-confirm: Skip confirmation prompt

3. Simulate Tasks

Execute a configuration on the built-in simulator:

# Basic simulation
lucihub simulate config.json

# With simulator options
lucihub simulate config.json --k0 1000 --with-limits --op-time 1.0

Options:

  • --sample-rate: Number of samples per second (default: 10000)
  • --op-time: Integration time in seconds (default: 0.1)
  • --k0: Acceleration factor (choices: 1, 10, 100, 1000, 10000; default: 10000)
  • --with-limits: Enable integrator capacity limits
  • --device: Device context (auto-detected if not specified)
  • --no-confirm: Skip confirmation prompt

4. Compile Tasks

Compile an ODE specification to device configuration:

# Basic compilation
lucihub compiler ode.json

Options:

  • --no-confirm: Skip confirmation prompt

File Formats

Configuration Files (for run/simulate)

JSON files containing analog circuit configurations:

{
  "integrators": {
    "int0": {"initial_value": 1.0}
  },
  "constants": {
    "k1": 2.5
  },
  "connections": []
}

ODE Files (for compiler)

JSON files containing ODE specifications:

{
  "variables": ["x", "y"],
  "equations": {
    "x": "-y",
    "y": "x"
  },
  "initial_conditions": {
    "x": 1.0,
    "y": 0.0
  }
}

Example Workflow

  1. Check system status:

    lucihub status
    
  2. Compile an ODE to configuration:

    lucihub compiler my_ode.json
    # Save the output to compiled_config.json when prompted
    
  3. Run the compiled configuration:

    lucihub run compiled_config.json --sample-rate 25000 --op-time 0.2
    
  4. Or simulate instead:

    lucihub simulate compiled_config.json --k0 1000 --with-limits
    

Development

Running Tests

poetry run pytest

Code Formatting

poetry run black .

Dependencies

  • click: Command-line interface framework
  • httpx: HTTP client for API communication
  • pydantic: Data validation using the shared models
  • rich: Rich text and beautiful formatting in the terminal
  • lucihub-common: Shared models and utilities

Error Handling

The CLI provides user-friendly error messages for common issues:

  • Connection errors to the API server
  • Invalid JSON files
  • Missing files
  • API errors with detailed messages

Progress indicators show task status during execution, and results are displayed in a formatted, readable way.

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

lucihub_cli-0.1.0.tar.gz (23.9 kB view details)

Uploaded Source

Built Distribution

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

lucihub_cli-0.1.0-py3-none-any.whl (16.8 kB view details)

Uploaded Python 3

File details

Details for the file lucihub_cli-0.1.0.tar.gz.

File metadata

  • Download URL: lucihub_cli-0.1.0.tar.gz
  • Upload date:
  • Size: 23.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.30 {"installer":{"name":"uv","version":"0.9.30","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"12","id":"bookworm","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for lucihub_cli-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e6de0d8c080f17a13b26d442d5eb8cd69aa24e1ca06374daa4e58d7e3ab471e3
MD5 dec33ed076cd898d592fccb7b566455c
BLAKE2b-256 0fff2d576a09738f793657d4499b1bbc691dc7e3a5dc737249644b7a132c4921

See more details on using hashes here.

File details

Details for the file lucihub_cli-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: lucihub_cli-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 16.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.30 {"installer":{"name":"uv","version":"0.9.30","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"12","id":"bookworm","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for lucihub_cli-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 334f0bfe0b3fdc2b636d0e7a2ee9fc2711b4c4f85a607a90425c378bb4885234
MD5 2efba4e0c4d76c3c77e549a58670cb7c
BLAKE2b-256 5775dbb53526cd31633d65507b2f85da6add816e0bb426a8ffc657007e75586d

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