Skip to main content

Runprint (qr)

Production-Grade, Local-First Experiment & Reproducibility Platform for AI & Scientific Research

"Run anything. Capture everything needed to reproduce it."

License: Apache-2.0 Python 3.9+ PyPI version Tests: 119 passed Platform

Runprint (qr) is an ultra-lightweight, zero-telemetry reproducibility tracker and experiment supervisor for Machine Learning and computational science. It runs seamlessly outside your code (as an invisible CLI supervisor) or inside your code (via a clean, IDE-friendly Python SDK).

Runprint Hub UI

All manifests, uncommitted code diffs, logs, metrics, hardware specs, and environment locks are preserved in a clean .qr/ folder inside your workspace. No cloud accounts, no external databases, no telemetry.

                        qr run -- <command>
                                │
                                ▼
                    ┌───────────────────────┐
                    │     Runprint (qr)     │
                    └───────────┬───────────┘
                                │
             ┌──────────────────┼──────────────────┐
             ▼                  ▼                  ▼
      Git State & Diff     Dependencies        Hardware & OS
        (uncommitted)      (AST + Lock)        (CPU, GPU, RAM)
             │                  │                  │
             └──────────────────┼──────────────────┘
                                ▼
              .qr/runs/QR-YYMMDD-HHMM-[Base62]-v1/
                                │
           ┌────────────────────┼────────────────────┐
           ▼                    ▼                    ▼
      manifest.json       metrics.jsonl        stdout / stderr
      config.json         artifacts.json       git.diff patch
                                │
                                ▼
                     Local SQLite & Lineage
                                │
             ┌──────────────────┼──────────────────┐
             ▼                  ▼                  ▼
           qr ui             qr diff            qr rerun
       (Live Web Hub)    (Side-by-Side)   (--reproduce / worktree)

📑 Table of Contents


⚡ Why Runprint?

Pain Point in ML & Research How Runprint (qr) Solves It
"Which code generated this checkpoint?" Automatically snapshots Git commit, branch, and uncommitted working tree diffs (git.diff) into the run folder without modifying Git index.
"The environment broke after 2 weeks" Analyzes direct AST imports (direct-packages.txt) + captures complete environment lock (pip-freeze.txt).
"Cloud MLOps tools are too heavy / require server setup" 100% local-first, self-contained inside .qr/. Zero cloud, zero Docker daemon requirement, zero telemetry.
"Run ID collisions when running on Kaggle/Colab/Slurm" Hybrid 26-character Run ID: QR-YYMMDD-HHMM-[8 Base62 Entropy]-vN with multi-layered container entropy harvesting.
"Can you reproduce this paper/experiment exactly?" qr rerun <id> --reproduce automatically recreates the exact git commit, applies diffs in a temporary worktree, and runs in a restored virtualenv.

💡 Real-World Use Case: 3-Minute Walkthrough

Here is how a real ML workflow unfolds with Runprint from day-to-day hacking to 1-click reproduction:

Scenario

You are fine-tuning a PyTorch ResNet model on train.py. You made quick uncommitted code tweaks in VS Code, adjusted learning rate to 1e-4, added CosineAnnealing, and want to know how it performs.

Step 1: Run your script (Zero Code Modification)

No need to commit Git, no need to push to any server:

qr run --tag fine-tune -- python train.py --lr 0.0001 --batch-size 32

qr instantly prints:

[!] Working tree contains uncommitted changes. Snapshotting diff:
  - train.py
  - configs/model.yaml

Run QR-261008-1230-7x9mK2pA-v1 [fine-tune] started (12:30:15)
Epoch 1/10 | loss: 0.421 | val_acc: 0.884
...
Epoch 10/10 | loss: 0.112 | val_acc: 0.952
Run completed: exit=0, duration=42.1s, restorability=95/100 (HIGHLY_RESTORABLE)

Step 2: Track metrics & checkpoints with Python SDK (Optional)

In train.py, add a few lines to stream metrics and register checkpoints:

import qr

# Log config and streaming epoch metrics
qr.log_config({"lr": 0.0001, "batch_size": 32, "model": "resnet50"})

for epoch in range(10):
    loss, val_acc = train_one_epoch()
    qr.metric({"loss": loss, "val_acc": val_acc}, epoch=epoch)

# Register checkpoint with auto-checksum
qr.artifact("checkpoints/best.pt", kind="weights")

Step 3: Explore & compare in Web UI

Launch the built-in UI:

qr ui
  • Open http://127.0.0.1:8765 to inspect live SVG metric curves.
  • View Sister Runs (runs with same code but different learning rates).
  • Click [ Compare ] to see parameter deltas side-by-side.

Step 4: The Nightmare Scenario Solved: 1-Click Reproduction

Three weeks later: Your Git repo is on a different branch, your code was edited, packages were updated, but a reviewer or colleague asks:

"Can you reproduce the exact output from run QR-261008-1230-7x9mK2pA-v1?"

Simply run:

qr rerun QR-261008-1230-7x9mK2pA-v1 --reproduce

Runprint automatically:

  1. Clones the exact historical Git commit into a clean, isolated temporary worktree.
  2. Applies the uncommitted git.diff captured from that day.
  3. Automatically restores the exact Python virtual environment from .qr/runs/<run_id>/environment/pip-freeze.txt.
  4. Executes the training command and outputs QR-261008-1230-7x9mK2pA-v2!

📦 Installation

# Recommended from PyPI
pip install runprint

# Or install latest from GitHub
pip install git+https://github.com/minhquang0407/Runprint.git

(Both qr and runprint commands are registered globally. You can also run python -m qr).


🚀 Quickstart in 60 Seconds

# 1. Initialize Runprint in your project repository
qr init

# 2. Run any command (Bash, Python, C++, etc.)
qr run -- python train.py --epochs 10

# 3. Launch the Web UI Hub
qr ui

🎯 The Two Ways to Use Runprint

Runprint offers two complementary execution models depending on whether you prefer terminal commands or IDE-centric scripts.

Way 1: Zero-Code CLI Wrapper (Terminal-First)

Zero lines of code changed. Runprint supervises the process from the outside:

# Basic run
qr run -- python train.py

# With tags and notes
qr run --tag baseline --notes "Testing AdamW optimizer" -- python train.py

# List recent runs
qr list

# Compare two runs side-by-side
qr diff QR-261008-1230-7x9mK2pA-v1 QR-261008-1245-3kL8wQ9Z-v1

Way 2: In-Code Python SDK (IDE & Script-First)

If you run code using the Run / Debug button in VS Code, PyCharm, or Jupyter without a terminal wrapper, place qr.init() at the top of your script:

import qr

def main():
    # 1. Initialize at the very start (auto-creates run & streams logs to Web UI)
    qr.init(tag="cifar10_baseline", params={"lr": 0.001, "batch_size": 32})
    
    # 2. Declare input datasets (auto SHA-256 fingerprinting)
    qr.input_dataset("cifar10", "data/cifar10")
    
    # 3. Real-time metric streaming (fsynced safely, zero data loss on OOM/crash)
    for epoch in range(10):
        # ... your training step ...
        qr.log({"loss": 0.24, "val_acc": 0.945}, epoch=epoch)
        
    # 4. Register outputs (models, figures, weights)
    qr.artifact("checkpoints/model.pt", kind="weights")

if __name__ == "__main__":
    main()

Universal Logger: qr.log() automatically infers types (dict ➔ metric, str ➔ note). You can also pass explicit types: qr.log({"lr": 1e-3}, type="config") or qr.log("model.pt", type="artifact").


🌐 Interactive Web UI Hub (qr ui)

Launch the local dashboard anytime with qr ui:

# Default (port 8765, opens browser automatically)
qr ui

# Custom port or headless mode
qr ui --port 9000 --no-browser

What You Get in the UI:

  • Hierarchical DAG & Tree View: Group runs by Script Entrypoint ➔ Git Commit ➔ Sister Runs & Versions.
  • Live SSE Terminal Streaming: Real-time terminal log viewer (stdout/stderr) with search & auto-scroll.
  • Dynamic Metric Charts: Interactive SVG loss & accuracy curves with Min/Max/Latest summary cards.
  • Sister Runs & Lineage: Detects hyperparameter sweeps sharing the same code base and enables 1-click side-by-side diffing.
  • Deep Hardware & OS Diagnostics: Inspect CPU cores/cache, RAM bus speed (MHz/MTs) per slot, GPU VRAM & compute capabilities, plus 1-Click Markdown Paper Exporter.
  • GUI Script Launcher (+ New Run): AST automatically parses script CLI arguments into interactive forms with provenance duplicate warnings.

🧬 Hybrid Run ID Architecture

Runprint uses a deterministic, human-readable, time-sortable Hybrid Run ID:

$$\mathbf{QR\text{-}YYMMDD\text{-}HHMM\text{-}[Entropy_Base62]\text{-}vN}$$

  • Format: QR-261008-1230-7x9mK2pA-v1 (exactly 26 characters).
  • Human-Readable & Time-Sortable: YYMMDD-HHMM indicates execution timestamp at a glance and sorts naturally via ASCII.
  • Collision-Proof Distributed Entropy: 8 Base62 characters ($62^8 \approx 2.18 \times 10^{14}$ states) generated via BLAKE2b from multi-tier container metadata (KAGGLE_CONTAINER_NAME, COLAB_GPU, SLURM_JOB_ID, PID, OS CSPRNG, nanosecond clock). Multi-node runs will never collide.
  • Lineage Tracking: Reruns automatically increment linear versions (-v1 ➔ -v2 ➔ -v3).
  • Shorthand Resolution: qr rerun QR-261008-1230-7x9mK2pA automatically finds the latest version and creates the next.

🛠️ CLI Command Cheatsheet

Command Purpose Example
qr init Initialize .qr/ workspace in repo qr init
qr run Execute command & snapshot state qr run --tag exp1 -- python train.py
qr ui Launch local Web UI Dashboard qr ui --port 8765
qr list List experiment history & status qr list --limit 10 --tag baseline
qr show Display run manifest & audit score qr show QR-261008-1230-7x9mK2pA-v1
qr rerun 1-Click reproduction in isolated worktree qr rerun <run_id> --reproduce
qr diff Side-by-side compare parameters & metrics qr diff <run_id_1> <run_id_2>
qr env Inspect environment drift & cached venvs qr env diff <run_id> / qr env clean --all
qr doctor Scan repository & auto-repair orphaned runs qr doctor --fix
qr sync Rebuild SQLite index or import from remote qr sync --from /path/to/backup/.qr/runs

🐍 Python SDK Method Reference

Method Shorthand What It Does
qr.init(tag=..., params=...) qr.activate() Initializes experiment run at script start (for IDE runs)
qr.log(data, type=...) — Smart universal logging dispatcher
qr.log_metric(dict, epoch, step) qr.metric() Records numerical metrics with adaptive rate-limiting fsync
qr.log_config(dict) qr.params() Logs hyperparameter configuration
qr.log_dataset(name, uri) qr.dataset(), qr.input_dataset() Registers dataset with auto streaming SHA-256
qr.log_artifact(path, kind) qr.artifact() Registers model checkpoints or output files
qr.log_note(text) qr.note() Appends timestamped research observation
qr.seed(seed, deterministic=True) — Enforces seed across Python, NumPy, PyTorch & cuDNN
qr.is_main_process() — Returns True on Rank 0 in PyTorch DDP / distributed training
with qr.timer("name"): — Measures execution duration of a code block
with qr.run() as run: — Context manager for hyperparameter sweeps / trials

🔬 Core Concepts & Restorability Score

0–100 Restorability Score Rubric

Every run receives a machine-checked reproducibility audit score:

Pillar Points What It Checks
Source Code 35 pts Valid Git commit (+10), clean tree or uncommitted diff patch (+15), untracked source files archived (+10)
Environment 35 pts Pinned Python version (+10), package lockfile recorded (+15), zero non-standard local dependencies (+10)
Data & Inputs 30 pts Pure compute (+30), OR declared datasets (+10) with verified SHA-256 fingerprints (+20)
  • 90 – 100: HIGHLY_RESTORABLE 🟢
  • 70 – 89: PARTIALLY_RESTORABLE 🟡
  • < 70: LOW_RESTORABILITY 🔴

📂 Storage Layout

Everything is kept transparently inside .qr/ in your repository:

my-project/
├── train.py
├── configs/
├── .git/
└── .qr/
    ├── project.json                 # Project configuration
    ├── index.sqlite                 # Fast local SQLite cache (WAL mode, auto-synced)
    ├── envs/                        # Cached virtualenvs for reproduction
    ├── worktrees/                   # Temporary git checkouts for isolated reruns
    └── runs/
        └── QR-261008-1230-7x9mK2pA-v1/
            ├── manifest.json        # Machine-readable provenance manifest
            ├── config.json          # Parsed hyperparameters & config
            ├── git.diff             # Complete uncommitted diff patch
            ├── stdout.log           # Full stdout stream
            ├── stderr.log           # Full stderr stream
            ├── metrics.jsonl        # Streaming metric records with timestamps
            ├── artifacts.json       # Registered artifacts & SHA-256 checksums
            ├── notes.jsonl          # Timestamped experiment notes
            └── environment/
                ├── direct-packages.txt   # Core packages imported by script (AST)
                └── pip-freeze.txt        # Full environment freeze (100% lock)

🛡️ Quality Assurance & Security

  • 119 Automated Tests (100% Pass Rate): Comprehensive test suite validating process supervision, Git dirty diffing, AST import resolution, container entropy generation, and isolated worktree reproduction. See TESTING.md.
  • 100% Air-Gapped & Offline: Zero network calls, zero telemetry, zero data exfiltration. Fully compliant with enterprise air-gapped environments. See SECURITY.md.

📄 License

Licensed under the Apache License, Version 2.0.

Metadata

Release files for runprint 0.1.12

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

Source distribution (sdist)

Source distribution for runprint 0.1.12
File Size Uploaded Provenance Actions
runprint-0.1.12.tar.gz 203.8 kB Without provenance Details for runprint-0.1.12.tar.gz

Built distribution (wheel)

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

Total release size: 411.0 kB

Release files / runprint-0.1.12.tar.gz

Download URL runprint-0.1.12.tar.gz
Size 203.8 kB
Tags Source
SHA-256 checksum
How to use checksums
2369b176169c8f11526b4bc581dcb93aec4deb66a255a5524713cb86d7f55201
BLAKE2b-256 checksum
How to use checksums
31d4a71cc5423b210cdc3864f0872e16b65d02b28f207bf9b5be1c26b83244c6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / runprint-0.1.12-py3-none-any.whl

Download URL runprint-0.1.12-py3-none-any.whl
Size 207.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ee80cf08e69b3c938de9a7f0d2d34f6521f2ebabf6f021f189b8100c48d6b2fe
BLAKE2b-256 checksum
How to use checksums
0b073448779f23fe2606de263ff717566d4ea5175fb1f549c9002460ce3ebe11
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Security for runprint 0.1.12

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A 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.

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