Animus DataLab Python SDK
Project description
Animus DataLab Python SDK
This directory contains the Python SDK used by CI and pipelines to publish metadata to Animus DataPilot.
Install
pip install animus-datalab
Local development:
pip install -e python
Local development (from the Animus monorepo root):
pip install -e sdk/python
Environment Variables
ANIMUS_GATEWAY_URL(default:http://localhost:8080)ANIMUS_AUTH_TOKEN(optional,Bearertoken for gateway auth)ANIMUS_CI_WEBHOOK_SECRET(optional; required if usingpost_ci_webhook)DATAPILOT_URL/RUN_ID/TOKEN(provided to training containers by Animus; used byRunTelemetryLogger.from_env())
Experiments Usage
from animus_sdk import ExperimentsClient
client = ExperimentsClient(gateway_url="http://localhost:8080")
exp = client.create_experiment(
name="baseline",
description="Baseline training run",
metadata={"team": "ml", "project": "fraud"},
)
run = client.create_run(
experiment_id=exp["experiment_id"],
dataset_version_id="YOUR_DATASET_VERSION_ID",
status="succeeded",
params={"lr": 1e-3},
metrics={"accuracy": 0.91},
)
client.post_ci_webhook(
payload={
"run_id": run["run_id"],
"provider": "github_actions",
"context": {"workflow": "train.yml", "job": "train"},
}
)
CI image registration (signed)
Register a built image digest (used by the training execution API to bind runs to git + image digest):
import os
from animus_sdk import ExperimentsClient
client = ExperimentsClient(gateway_url=os.environ.get("ANIMUS_GATEWAY_URL"))
client.post_ci_report(
payload={
"image_digest": "sha256:...",
"repo": "ghcr.io/acme/train",
"commit_sha": "deadbeef...",
"pipeline_id": "build-123",
"provider": "github_actions",
}
)
Execute training run
from animus_sdk import ExperimentsClient
client = ExperimentsClient(gateway_url="http://localhost:8080")
resp = client.execute_run(
experiment_id="YOUR_EXPERIMENT_ID",
dataset_version_id="YOUR_DATASET_VERSION_ID",
image_ref="ghcr.io/acme/train@sha256:...",
)
print(resp["run_id"])
Live Telemetry (training containers)
Training containers launched by Animus receive DATAPILOT_URL, RUN_ID, and TOKEN.
Use RunTelemetryLogger to emit append-only metrics and events without blocking training.
from animus_sdk import RunTelemetryLogger
logger = RunTelemetryLogger.from_env(timeout_seconds=2.0)
logger.log_status(status="starting")
for step in range(100):
loss = 1.0 / (step + 1)
logger.log_metric(step=step, name="loss", value=loss)
logger.log_progress(step=step, total_steps=100, percent=(step + 1) / 100.0)
logger.log_status(status="finished")
logger.close(flush=True, timeout_seconds=5.0)
Dataset download (training containers)
import os
from animus_sdk import DatasetRegistryClient
datasets = DatasetRegistryClient(gateway_url=os.environ["DATAPILOT_URL"], auth_token=os.environ["TOKEN"])
datasets.download_dataset_version(dataset_version_id=os.environ["DATASET_VERSION_ID"], dest_path="/tmp/dataset.zip")
Run artifacts (training/evaluation containers)
import os
from animus_sdk import ExperimentsClient
exp = ExperimentsClient(gateway_url=os.environ["DATAPILOT_URL"], auth_token=os.environ["TOKEN"])
exp.upload_run_artifact(
run_id=os.environ["RUN_ID"],
kind="model",
file_path="/tmp/model.json",
name="model",
metadata={"format": "json"},
)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file animus_datalab-1.0.0.tar.gz.
File metadata
- Download URL: animus_datalab-1.0.0.tar.gz
- Upload date:
- Size: 12.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f0f185642156e65dcad238e16f18d162d8c2390abb22c310cf320ea87d47f59d
|
|
| MD5 |
d1d88797c9a66ba6c6531b47eeffc5e5
|
|
| BLAKE2b-256 |
263db6445d75b085ce89dcabcba52aae7abe3e412e8fdabbf506fa90e3776f7a
|
File details
Details for the file animus_datalab-1.0.0-py3-none-any.whl.
File metadata
- Download URL: animus_datalab-1.0.0-py3-none-any.whl
- Upload date:
- Size: 12.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1e7304c6338fd5b26f38481bf9df892b236fd50782ecb9b9b394fa0b7dd0145a
|
|
| MD5 |
f3431c4e6732d64ff166bd95f4f95811
|
|
| BLAKE2b-256 |
53aef4a9ba311911bcc1b0859785a5db5208d28f059c6b49a7ce01b0b9fc8521
|