Skip to main content

Official Python SDK for Tyko Labs - Track experiments, manage models, and version datasets

Project description

Tyko Client - Python SDK

Official Python SDK for Tyko Labs.

Track experiments, manage models, and version datasets with a simple, intuitive API.

Hierarchy

Tyko uses a three-level hierarchy to organize your ML work:

Project → Experiment → Run
  • Project: Top-level container for your ML project (e.g., "mnist-classifier")
  • Experiment: Groups related runs for comparison (e.g., "hyperparameter-search")
  • Run: A single training execution with parameters, metrics, and artifacts

Installation

Install via pip:

pip install tyko

Quick Start

from tyko import TykoClient

client = TykoClient()

# Simplest usage - just project name (uses "default" experiment)
# Environment info (Python version, CPU, GPU, etc.) is auto-captured
with client.start_run(project="my-ml-project") as run:
    run.params["learning_rate"] = 0.001
    run.params["batch_size"] = 32
    # ... your training code ...

# With params at creation time
with client.start_run(
    project="my-ml-project",
    experiment="hyperparameter-search",
    params={"learning_rate": 0.01, "batch_size": 64}
) as run:
    # Params are already set, can add more during the run
    run.params["epochs"] = 100
    # ... your training code ...

Environment Capture

Environment information is automatically captured when you start a run:

  • Python version
  • Operating system/platform
  • CPU count
  • RAM size (if psutil is installed)
  • GPU count and names (if torch is available)

You can also manually add environment details:

with client.start_run(project="ml-experiments") as run:
    # Add custom environment info
    run.environment["git_commit"] = "abc123"
    run.environment["cuda_version"] = "12.1"

To use the standalone function:

from tyko import capture_environment

env = capture_environment()
print(env)  # {'python_version': '3.12.1', 'platform': 'Linux-...', ...}

Metric Logging

Log metrics during training using run.log():

with client.start_run(project="image-classifier") as run:
    run.params["learning_rate"] = 0.001
    run.params["batch_size"] = 32

    for epoch in range(100):
        train_loss = train_epoch(model, train_data)
        val_loss, val_acc = evaluate(model, val_data)

        # Log multiple metrics at once
        run.log({
            "train/loss": train_loss,
            "eval/loss": val_loss,
            "eval/accuracy": val_acc,
            "epoch": epoch,
        })

Metric Naming Conventions

Use prefixes with slashes for grouped visualization in the dashboard:

Pattern Example Dashboard Grouping
prefix/metric train/loss, train/accuracy Grouped under "train"
prefix/metric eval/loss, eval/accuracy Grouped under "eval"
Plain name epoch, step Ungrouped

This allows the dashboard to organize metrics into logical groups automatically.

Configuration

API Key

Set your API key via environment variable (recommended):

export TYKO_API_KEY="your-api-key"

Or pass it explicitly:

client = TykoClient(api_key="your-api-key")

If the server has anonymous access enabled (ALLOW_ANONYMOUS=true), no API key is needed:

client = TykoClient(api_url="https://your-server.com")

Server URL

For self-hosted deployments, set the server URL:

export TYKO_API_URL="https://your-server.com"

Or:

client = TykoClient(api_url="https://your-server.com")

Development

Prerequisites

  • Python 3.11+
  • uv package manager

Setup

cd packages/tyko-client
uv sync

Testing

.venv/bin/pytest --cov=src/tyko --cov-report=term-missing

Linting

# Check code style
.venv/bin/ruff check src/

# Format code
.venv/bin/black src/

# Type checking
.venv/bin/mypy src/

Building

make build

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

tyko-0.1.22.tar.gz (32.6 kB view details)

Uploaded Source

Built Distribution

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

tyko-0.1.22-py3-none-any.whl (22.0 kB view details)

Uploaded Python 3

File details

Details for the file tyko-0.1.22.tar.gz.

File metadata

  • Download URL: tyko-0.1.22.tar.gz
  • Upload date:
  • Size: 32.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Hatch/1.16.5 cpython/3.12.13 HTTPX/0.28.1

File hashes

Hashes for tyko-0.1.22.tar.gz
Algorithm Hash digest
SHA256 07ebfe922007b138bd05e7439cfa13c1aa72c8c54a34c1b3bf5317ee8dfd34d1
MD5 f7915f1bfe3eca03e704655166519646
BLAKE2b-256 be896b7288ca382d2bf4368f9bc7a79d0bcd461c9e1e33cdc3ace20f1fb8d4b8

See more details on using hashes here.

File details

Details for the file tyko-0.1.22-py3-none-any.whl.

File metadata

  • Download URL: tyko-0.1.22-py3-none-any.whl
  • Upload date:
  • Size: 22.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Hatch/1.16.5 cpython/3.12.13 HTTPX/0.28.1

File hashes

Hashes for tyko-0.1.22-py3-none-any.whl
Algorithm Hash digest
SHA256 d81274d57d30b0684e79b8f02db686404488c082fa896ef17d26237ad5ef8dcd
MD5 c5ddb6f49e2f592a5c1c26758f7802d7
BLAKE2b-256 792a68188cc7b709b4d7ef6230d78d8f4f3d8480bfde953c8aa0804d9d13b09a

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