← All projects

Zetten

Documentation ↗GitHub Repository ↗
What it is

Zetten is an open-source, Python-native task runner written in Rust designed to replace monolithic Makefiles. It provides sub-10ms startup, discovers active virtual environments automatically without shell initialization, and outputs structured execution logs suitable for both human developers and AI coding agents.

Why I built it

On projects mixing Python services, frontend assets, and Docker containers, Makefiles quickly devolve into fragile 200-line shell wrappers with awkward syntax and file-timestamp bugs. Meanwhile, wrappers like poetry run or pipenv run add noticeable startup latency (~800ms) on every invocation. I wanted a fast, standalone binary that parses project metadata natively, tracks explicit task dependencies in a clean DAG, and yields deterministic, agent-parseable JSON or clean text output.

Architecture
  CLI Command (e.g., 'zetten run test')
                │
                ▼
      ┌──────────────────┐
      │  Rust CLI Core   │ ◄─── Configuration (zetten.toml)
      └─────────┬────────┘
                │
         Project Detection
                ▼
      ┌──────────────────────────────────────────────┐
      │ Environment Resolver                         │
      │ ├─ Inspects pyproject.toml / uv.lock         │
      │ ├─ Discovers active .venv without shell init │
      │ └─ Builds directed acyclic task graph (DAG)  │
      └─────────────────┬────────────────────────────┘
                        │
                  Task Execution
                        ▼
      ┌──────────────────────────────────────────────┐
      │ Fast Process Runner                          │
      │ ├─ Sub-10ms cold launch                      │
      │ ├─ Strict environment isolation              │
      │ └─ Structured stream (human / agent modes)   │
      └──────────────────────────────────────────────┘
Sample Configuration (zetten.toml)
# Explicit, typed task dependencies with automatic .venv binding
[tasks.test]
description = "Run unit & integration test suite"
command = "pytest tests/ -v --color=no"
deps = ["lint"]
env = { PYTHONUNBUFFERED = "1" }

[tasks.lint]
description = "Ruff linting and formatting check"
command = "ruff check . && ruff format --check ."
What broke and what I learned

Handling edge cases in cross-platform virtualenv detection was surprisingly subtle: Windows virtualenv structures differ from POSIX paths, and nested virtualenvs created by uv, poetry, and conda each have distinct activation semantics. I also learned that AI coding agents require deterministic task feedback; passing ANSI color codes or unstructured stdout makes LLM tooling loops hallucinate and misinterpret test failure boundaries.

Numbers & Benchmarks
  • Cold startup latency: 6.8ms(benchmarked via hyperfine against make at 2.1ms and poetry run at ~820ms)
  • Binary footprint: 4.2MB(statically linked Rust binary with zero external runtime dependencies)
  • Incremental evaluation: < 1ms(DAG validation and dependency resolution before task dispatch)
Links
← Back to Projects