Skip to main content

Python SDK for interacting with the Qubicon platform through the library or CLI

Project description

Qubicon SDK

Overview

The Qubicon SDK is a Python client library designed for interacting with the Qubicon API. It provides methods for authentication, process management, model creation, data extraction, and more.

This SDK wraps the OpenAPI-generated client and adds custom functionalities to streamline interactions with the Qubicon platform.

Usage Modes

The Qubicon SDK can be used in two ways:

  1. As a Python Library – Import and use the SDK programmatically in your Python applications.
  2. As an Interactive CLI – Run an interactive command-line interface to execute commands without writing code.

To start the interactive menu, run:

qubicon-client --interactive

All function outputs are returned in JSON format, making it easy to parse and integrate with other tools.

Features

  • Authentication & Token Management
  • Process Management (Create, List, Delete Processes & Groups)
  • Model Management (Create, Fetch, Export Computable Models)
  • Physical Quantities Handling
  • Process Data Extraction & Export
  • File Upload & Advanced Model Management
  • Event Streaming

Installation

Install the SDK using pip:

pip install qubicon

Alternatively, install from a local package:

pip install /path/to/qubicon_package

Quick Start

1. Initialize the SDK

from qubicon.core import QubiconCore, AuthenticatedClient

# Define base URL (e.g., production or staging server)
BASE_URL = "https://master.qub-lab.io"

# Create a client instance
client = AuthenticatedClient(base_url=BASE_URL, token=None)

# Initialize QubiconCore with the authenticated client
qubicon = QubiconCore(client)

2. Login to Qubicon

username = "your_username"
password = "your_password"
token = qubicon.login_user(username, password)
print("Token:", token)

3. List Processes

processes = qubicon.list_processes()
print(processes)

4. Create a Process

new_process = qubicon.create_process(
    name="Test Process",
    recipe_id=1822,
    description="Automated process creation"
)
print(new_process)

5. Delete a Process

response = qubicon.delete_process(process_id=1234)
print(response)

API Reference

Authentication

def login_user(username: str, password: str) -> Optional[str]
  • Logs in a user and retrieves an authentication token.
def refresh_token(refresh_token: str) -> Optional[str]
  • Refreshes an expired authentication token.

Process Management

def list_processes()
  • Lists all processes with optional filters.
def create_process(name: str, recipe_id: int, description: str = "") -> Optional[Dict[str, Any]]
  • Creates a new process using a specified recipe.
def delete_process(process_id: int) -> Optional[Dict[str, Any]]
  • Deletes a specific process by ID.
def delete_multiple_processes(process_ids: List[int]) -> Dict[int, Optional[Dict[str, Any]]]
  • Deletes multiple processes in a batch operation.
def create_process_group(name: str) -> Optional[Dict[str, Any]]
  • Creates a new process group.
def add_processes_to_group(group_id: int, process_ids: List[int]) -> Optional[Dict[str, Any]]
  • Adds multiple processes to an existing group.

Computable Models

def list_computable_models()
  • Lists all available computable models.
def fetch_model_details(model_id: int)
  • Fetches detailed information about a computable model.
def create_computable_model(model_data: dict) -> Optional[Dict[str, Any]]
  • Creates a new computable model with the given specifications.
def export_model_to_json(model_id: int, filename: str)
  • Exports a computable model into an importable JSON format.

Physical Quantities

def list_physical_quantities()
  • Retrieves all available physical quantities.
def create_physical_quantity(pq_dict: Dict[str, Any]) -> Optional[Dict[str, Any]]
  • Creates a new physical quantity in the system.
def check_existing_physical_quantity(pq_name: str) -> Optional[dict]
  • Checks if a physical quantity already exists.

Process Data & Channels

def extract_channels(process_id: int)
  • Extracts available channels for a given process.
def extract_process_data(process_id: int, output_format: str = "csv", output_file: str = "process_data.csv")
  • Extracts and exports process data.

File Upload & Advanced Models

def upload_file(file_path: str) -> Optional[Dict[str, Any]]
  • Uploads an external file (e.g., ZIP archive) to Qubicon.
def create_advanced_model(model_data: dict, file_path: str) -> Optional[Dict[str, Any]]
  • Creates an advanced model that references an external file.

Event Streaming

def stream_events(event_types: List[str], nonce: str)
  • Streams real-time events from the API.

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

qubicon-3.5.1.tar.gz (127.4 kB view details)

Uploaded Source

Built Distribution

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

qubicon-3.5.1-py3-none-any.whl (323.1 kB view details)

Uploaded Python 3

File details

Details for the file qubicon-3.5.1.tar.gz.

File metadata

  • Download URL: qubicon-3.5.1.tar.gz
  • Upload date:
  • Size: 127.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.4

File hashes

Hashes for qubicon-3.5.1.tar.gz
Algorithm Hash digest
SHA256 e8153a3d29717bfec139b9ce45f9cdb68078d8d9de72f5b07a454db9562d567d
MD5 c2e2cd0ec2528f3033a4e085220e3a2e
BLAKE2b-256 20a67e820305a12f14f23afa172a23867ac99ae47b994aef3b9cf6964c9b611b

See more details on using hashes here.

File details

Details for the file qubicon-3.5.1-py3-none-any.whl.

File metadata

  • Download URL: qubicon-3.5.1-py3-none-any.whl
  • Upload date:
  • Size: 323.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.4

File hashes

Hashes for qubicon-3.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 32d479f69fb412e22cfcc9f5d6085ea63394fbf7944c227adeabad7fb6397e4a
MD5 18dddb9c860d0b4dd4feefe86792cb85
BLAKE2b-256 da15e7e2f0551416e38c92da19d37dc375b7bb5e6a91e8509290b950580c8343

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