Python SDK
The CorePlexML Python SDK provides a type-safe wrapper around the CorePlexML REST API. It gives Python developers a clean, resource-oriented interface for managing the full ML lifecycle – from data upload and model training to production deployment and monitoring.
Installation
Install from PyPI:
pip install coreplexml
Or install from a local distribution (e.g., downloaded from your CorePlexML server):
pip install /path/to/coreplexml-0.1.0.tar.gz
Requirements:
Python >= 3.9
requests>= 2.28
Quick Initialization
from coreplexml import CorePlexMLClient
client = CorePlexMLClient(
base_url="https://your-domain.com",
api_key="prefix.your-secret-key",
)
# All resources are accessible as attributes
projects = client.projects.list()
Key Concepts
Resources
The SDK is organized around resources that mirror the CorePlexML REST API. Each resource is an attribute on the client and exposes methods matching the available API operations:
client.projects–ProjectsResourceclient.datasets–DatasetsResourceclient.experiments–ExperimentsResourceclient.models–ModelsResourceclient.deployments–DeploymentsResourceclient.reports–ReportsResourceclient.privacy–PrivacyResourceclient.synthgen–SynthGenResourceclient.studio–StudioResource
All methods return plain Python dictionaries parsed from the server’s JSON responses.
Job Polling
Long-running operations (AutoML training, report generation) are handled as background jobs. The SDK provides built-in polling methods that block until the job completes or a configurable timeout is reached:
exp = client.experiments.create(...)
result = client.experiments.wait(exp["id"], interval=5.0, timeout=3600.0)
Error Handling
All API errors are raised as typed exceptions. Every exception includes
message, status_code, and detail attributes:
from coreplexml import CorePlexMLError, NotFoundError
try:
client.projects.get("nonexistent-id")
except NotFoundError as e:
print(f"Status {e.status_code}: {e.detail}")
See Exceptions for the full exception hierarchy.
Authentication
The SDK uses Bearer token authentication via API keys. Generate an API key from the CorePlexML web UI under Settings > API Keys. Pass it to the client constructor:
client = CorePlexMLClient(
base_url="https://your-domain.com",
api_key="prefix.your-secret-key",
)
Version Compatibility
SDK Version |
Server Version |
Python Version |
|---|---|---|
0.1.x |
>= 0.1.0 |
>= 3.9 |
Contents
- Quick Start
- Prerequisites
- Step 1 – Install and Configure
- Step 2 – Create a Project
- Step 3 – Upload a Dataset
- Step 4 – Create an Experiment (Classification)
- Step 5 – Wait for Training
- Step 6 – List Models and Get the Best One
- Step 7 – Deploy to Staging
- Step 8 – Make Predictions via Deployment
- Step 9 – Generate a Report
- Step 10 – Clean Up
- Error Handling
- Next Steps
- CorePlexMLClient
- Resource Reference
- Exceptions
- Advanced Usage
- Example Scripts