CairnML SDK
The CairnML SDK is the Python library you add to your training scripts. It records what a run does (parameters, metrics, logs and artifacts), sends runs to remote agents through job queues, and versions datasets so that every run knows the exact data it used.
New to CairnML? Read Start here first: it explains the four parts (server, SDK, agent, web app), which are required, and the order of setup.
Features
- Track a training script with a few lines: parameters, metrics, logs and artifacts are recorded on your server.
- Send a recorded run to an agent on another machine through a job queue.
- Version datasets with git, with the files in DVC storage or in GitHub LFS, and record the dataset commit on every run.
- Read public datasets through adapters from the dataset registry, with the source revision recorded.
Prerequisites
- Python 3.9 or newer
- git, for datasets
- A running CairnML server
Installation
pip install cairnml
For the dataset tools as well:
pip install "cairnml[dataset]"
Two more extras add optional features:
cairnml[gpu]reads NVIDIA GPU utilisation, memory and power for the resource monitor (NVIDIA's bindings andgpustat). AMD GPUs need the ROCm installation; seedocs/amd-gpu-monitoring.md.cairnml[plot]sends matplotlib figures as interactive plotly plots. Without it, figures are sent as images.
To run the SDK's tests from a checkout, install it into a virtual environment together with pytest, then run the tests (the same commands CI runs):
python3 -m venv .venv && . .venv/bin/activate
python -m pip install -e ".[dataset]" pytest
python -m pytest -q tests
Connect to your server
cairnml init http://<server-ip>
<server-ip> is the address of the server, for example http://localhost or http://192.168.1.20. Add a port only if the server does not use port 80. The command works out where the API and the web app are (<address>/cairnml/api and <address>/cairnml/).
Your browser opens the sign-in page. When the command prints enrolled as ..., this machine is connected. Each machine has its own key, so no access key is copied to it.
The browser sign-in receives its reply on 127.0.0.1:8765. The identity provider accepts only this redirect address for the CairnML client. Set CAIRNML_LOGIN_PORT to another port only if the identity provider also accepts that redirect address; 0 lets the system pick a free port, which the identity provider rejects today. If another program on the machine holds the port, cairnml init says so and signs in with a code instead (see --device). On a machine without a browser, cairnml init --device always uses the code.
Environment variables are named CAIRNML_*; the ClearML-era TRAINS_* names are no longer read, so a TRAINS_* variable has no effect (see docs/environment.md for every variable). The configuration file ~/trains.conf (from the ClearML-based original) still works and prints a deprecation warning once; rename it to ~/.cairnml/cairnml.conf. cairnml init writes ~/.cairnml/cairnml.conf, next to the device key; the earlier ~/cairnml.conf is still read.
Commands
Everything is one command, cairnml, with a subcommand for each tool. cairnml <command> --help shows the arguments of a command.
| Command | What it does |
|---|---|
cairnml init <server> |
Enrol this machine with the server. --name names the machine, --force enrols again. |
cairnml whoami |
Show who this machine signs in as |
cairnml logout |
Revoke this machine's enrolment and remove its key |
cairnml devices list |
List the devices enrolled under your sign-in: id, name, owner, last seen and state. An admin sees every device |
cairnml devices revoke <id> |
Revoke an enrolled device, so its key stops working. Asks first; --yes skips the question |
cairnml doctor |
Check the configuration, the server, the SDK version against the server minimum, the sign-in, the device key, the queues (a queue without a listening worker is a warning) and the object storage (port 9000), one line per check. Exits with 1 when a check fails |
cairnml dataset ... |
Versioned datasets on git, with the files in DVC or in GitHub LFS (needs cairnml[dataset]). create makes a dataset in one call |
cairnml task ... |
Launch any codebase on a machine running cairnml-agent |
cairnml param-search ... |
Search for the best parameters for your models |
cairnml debug ... |
Debugging tools for the SDK |
Getting started
Track a script:
from cairnml import Task
task = Task.init(project_name="demo", task_name="first run")
task.connect({"lr": 0.001})
task.get_logger().report_scalar("loss", "train", value=0.5, iteration=1)
Run the recorded task on an agent:
task.execute_remotely(queue_name="default")
The run appears in the web app under its project, with its parameters, metrics and artifacts.
A task waits in its queue until a worker listens to it. execute_remotely logs a warning when no worker listens to the queue, for example after a typing error in its name. To check it yourself:
from cairnml import queues
for queue in queues.list_queues():
print(queue.name)
print(queues.workers_for_queue("default")) # [] when no agent listens to it
The web app
Open http://<server-ip>/cairnml/ and sign in. The menu has these sections:
- Dashboard: projects and recent tasks
- Projects: the tasks and models of each project
- Datasets: dataset versions
- Pipelines and Reports
- Workers & Queues: the machines running agents, and the jobs waiting for them
- Settings
Access data
Read a dataset from a repository of your own, at a commit:
from cairnml.datasets import Dataset
data = Dataset.get("https://github.com/acme/cars-data.git", "3f2a9c1") # a commit, tag or branch
print(data.path) # a local folder with the files
Read a public dataset from the dataset registry. The adapter turns its files into samples with images and labelled boxes:
from cairnml.datasets import Dataset
data = Dataset.get_external(
"coco-fashion",
repo="https://github.com/gianlucapargaetzi/cairnml-dataset-registry",
)
for sample in data.samples("train"):
image = sample.modality("image") # a path
boxes = sample.label("bbox2d") # [{"box": [x1, y1, x2, y2], "label": "shoe"}, ...]
Both calls record the dataset and its revision on the run. To create a dataset of your own, see docs/datasets.md.
Datasets: git, with the files in DVC or in LFS
A dataset is a git repository with a data/ folder. Git holds the metadata and the commit is the version: a run records the repository, the commit and the content hash, so it always shows the data it used. The files are held in one of two places, chosen once when the dataset is created and recorded in its dataset.yaml:
storage: s3(the default): DVC holds the files in the dataset storage of the CairnML server. A dataset is read withDataset.get, which needs the short-lived keys the server gives.storage: lfs: the files are in the GitHub LFS of the dataset repository. Nothing but git and git-lfs is needed. A dataset is fetched withgit clone <repository>,git checkout <commit>andgit lfs pull;Dataset.fetch_commands()returns these commands.
Every commit carries a footprint (dataset.lock.json): the record that the data was checked in the format dataset.yaml declares. A dataset repository's default branch takes changes only through pull requests that pass the verify check.
Create a dataset in one call, with the GitHub command line logged in:
cairnml dataset create cars-data --from ./measurements --storage lfs
cairnml dataset doctor # checks the GitHub settings, including the branch protection
create also protects the default branch of the new repository (pull requests required, no force pushes or deletions). This needs administration rights on the repository; without them it warns and carries on. Pass --no-protect to skip it. See docs/datasets.md.
Next steps
The CairnML examples walk through a first run, a full training run, and the same training on a dataset from the registry.
Having problems
- Check the open issues.
- If your problem is not listed, open a new issue with the command you ran, your Python version and the full error message.
License
Apache License 2.0, see LICENSE. Unofficial fork of ClearML, see DISCLAIMER.md.
Metadata
Release files for cairnml 0.0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cairnml-0.0.6.tar.gz | 1.0 MB | With provenance | Details for cairnml-0.0.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cairnml-0.0.6-py3-none-any.whl | Python 3 | none | any | Details for cairnml-0.0.6-py3-none-any.whl |
Total release size: 2.2 MB
Release files / cairnml-0.0.6.tar.gz
| Download URL | cairnml-0.0.6.tar.gz |
|---|---|
| Size | 1.0 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
91961b99852dba05ac149c40cc6dc98ad2d3e66ccdf46aa787646d58ea853d0b
|
|
BLAKE2b-256 checksum How to use checksums |
87e4572abd79d7f9c1152b16e7047568feb2ae47d9a3b94032cccb2afcf62b73
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.
Transparency logRelease files / cairnml-0.0.6-py3-none-any.whl
| Download URL | cairnml-0.0.6-py3-none-any.whl |
|---|---|
| Size | 1.2 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
985fc547a8fd25791171b04dd2c945b857ec2f13abcf32c0eaa0f98f5d06aa79
|
|
BLAKE2b-256 checksum How to use checksums |
0844f2bd7c2af93d9c5232dff08816aebb673da10f402ffe19729c0cc82343e5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.
Transparency logSecurity for cairnml 0.0.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for cairnml-0.0.6.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.