Skip to main content

SimpleML SDK

A lightweight Python SDK for the SimpleML MLOps platform. Track experiments, log metrics, manage artifacts, and register models with ease.

Installation

pip install simplemlplatform

Quick Start

Basic Configuration

import simpleml

# Configure with your API key (endpoint is pre-configured)
simpleml.configure(api_key="your_api_key_here")

# Start tracking
experiment = simpleml.get_or_create_experiment("my-experiment")
run = experiment.start_run()

# Log metrics
run.log_metrics({
    "accuracy": 0.95,
    "loss": 0.05
})

# Log hyperparameters
run.log_params({
    "learning_rate": 0.001,
    "batch_size": 32,
    "epochs": 100
})

# Upload artifacts
run.upload_artifact("model.pkl", artifact_type="model")

# Complete the run
run.complete()

Configuration

import simpleml

# Simple configuration - endpoint is pre-configured for the SaaS platform
simpleml.configure(api_key="your_api_key_here")

Features

  • Experiment Tracking: Organize your ML experiments
  • Metrics Logging: Track training and validation metrics over time
  • Artifact Management: Upload and manage model files, plots, and data
  • Model Registry: Register and version your models
  • Simple Setup: Pre-configured production endpoint, just add your API key
  • Lightweight: Minimal dependencies, fast setup

API Reference

Configuration

simpleml.configure(
    api_key="your_api_key_here"   # Required: Your API key (endpoint is pre-configured)
)

Experiments

# Get or create experiment
experiment = simpleml.get_or_create_experiment(
    name="image-classification",
    description="CIFAR-10 classification experiment",
    tags={"dataset": "cifar10", "model": "resnet"}
)

# Get existing experiment
experiment = simpleml.get_experiment("exp-123")

# List experiments
experiments = simpleml.list_experiments()

Runs

# Start a run
run = experiment.start_run(
    name="run-1",
    hyperparameters={"lr": 0.001, "batch_size": 32},
    tags={"optimizer": "adam"}
)

# Get existing run
run = simpleml.get_run("run-123")

Metrics

# Log metrics (always use batch method)
run.log_metrics({
    "train_loss": 0.1,
    "val_loss": 0.15,
    "accuracy": 0.95
}, step=100)

Artifacts

# Upload file
run.upload_artifact("model.pkl", artifact_type="model")

# Upload with custom name
run.upload_artifact("./plots/confusion_matrix.png", 
                   filename="confusion_matrix.png",
                   artifact_type="plot")

# List artifacts
artifacts = run.list_artifacts()

# Download artifact
run.download_artifact("artifact-123", "./downloads/model.pkl")

Models

# Register model from run
model = run.register_model(
    model_name="cifar10-classifier",
    artifacts=["model.pkl", "config.json"],
    description="ResNet model for CIFAR-10",
    stage="staging"
)

# List models
models = simpleml.list_models()

# Update model stage
simpleml.update_model_stage("cifar10-classifier", "v1", "production")

Context Manager Usage

import simpleml

simpleml.configure(api_key="your_api_key_here")

with simpleml.start_run("my-experiment") as run:
    # Your training code here
    for epoch in range(10):
        loss = train_epoch()
        accuracy = validate()
        
        run.log_metrics({
            "loss": loss,
            "accuracy": accuracy
        }, step=epoch)
    
    # Upload model
    run.upload_artifact("model.pkl", artifact_type="model")
    
    # Register model if performance is good
    if accuracy > 0.9:
        run.register_model("my-model", ["model.pkl"])

Environment Variables

You can also configure using environment variables:

export SIMPLEML_API_KEY="your_api_key_here"

Error Handling

from simpleml.exceptions import SimpleMLError, AuthenticationError, NotFoundError

try:
    run = simpleml.get_run("invalid-run-id")
except NotFoundError:
    print("Run not found")
except AuthenticationError:
    print("Invalid API key")
except SimpleMLError as e:
    print(f"SimpleML error: {e}")

License

MIT License - see LICENSE file for details.

Metadata

Release files for simplemlplatform 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for simplemlplatform 1.0.1
File Size Uploaded
simplemlplatform-1.0.1.tar.gz 13.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for simplemlplatform 1.0.1
File Interpreter ABI Platform
simplemlplatform-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 27.2 kB

Release files / simplemlplatform-1.0.1.tar.gz

Download URL simplemlplatform-1.0.1.tar.gz
Size 13.6 kB
Tags Source
SHA-256 checksum
How to use checksums
46d79eef6f69e5b4c77cde1afacc978d89b9de6f0f7fc226b26c7607c9a7a562
BLAKE2b-256 checksum
How to use checksums
074184f77c5a0215ba4048c7c020ac514fb289ad7200b298e9497e60fa6809d2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.6

Release files / simplemlplatform-1.0.1-py3-none-any.whl

Download URL simplemlplatform-1.0.1-py3-none-any.whl
Size 13.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bc2ab7d6531cd874af3428f998d7d2193d2440f7029b2494abfd8a641ef5a5b7
BLAKE2b-256 checksum
How to use checksums
380d26829f1f075ea3a9e277caced6d67103841ae84ff9b489024561127eb4d7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.6

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page