Skip to main content

Yanjú

Yanjú (Yoruba for "to solve" / "bring order to chaos") is a local, disposable debugging harness. It drops engineers into containerized, intentionally broken apps so they can practice reading logs, fixing config, and shipping a working service — not trivia.

v0.1 points at yanju-scenarios: broken-proxy (Nginx → FastAPI under k6 load) and broken-playbook (Ansible deploys a Jinja nginx template onto a web host). The CLI does not ship scene files; it fetches a scene folder and copies only the editable surface into your working directory.

Requirements

  • Python 3.11+
  • Docker Engine with Compose v2 (docker compose)

Install

uv tool install yanju
# or: python3 -m pip install yanju

The wheel is the CLI engine only. Scene files come from yanju-scenarios at runtime (or a local checkout).

Quick start

yanju check
yanju scene            # or: yanju scene --all   then   yanju init broken-proxy
yanju play

Edit the copied files in your IDE. Re-run yanju play after config changes so the stack recreates and hidden tests run. Use --persist to leave the stack up while you debug. Then:

yanju status
yanju verify
yanju reset

init copies the editable surface into the current directory (for broken-proxy: app/, nginx/, compose; for broken-playbook: app/, ansible/, compose) and writes a README from brief.problem / brief.outcome. Hidden eval/ tests, the k6 overlay, and lab SSH keys stay in the scene checkout (cache or local yanju-scenarios/), not in your cwd.

Commands

Command What it does
yanju check Docker ping, RAM/CPU (warn below 2 GB / 2 CPUs). Pulls images for the current workspace scene if one is initialized
yanju init <scenario> Copy workspace, git init + baseline commit. --force stops the previous stack, then replaces the workspace
yanju scene List the catalog (index.yaml) and pick one to initialize. --all lists without initializing
yanju play Start or recreate the stack, run hidden tests, stop containers if they fail. Logs stay at .yanju/logs/stack.log. --persist leaves the stack running (previous default). --follow streams logs after the stack stays up
yanju help How to apply edits, logs, and verify
yanju logs Tail captured logs (Ctrl+C detaches). --no-follow for a one-shot dump
yanju status Container health, ports, CPU/memory, whether k6 is running
yanju verify Hidden pytest against the scenario verify.base_url plus a git diff. PASS/FAIL is tests only; app/ edits warn
yanju stop compose down -v; keep workspace files and .yanju/ logs
yanju reset compose down -v, restore files to the init commit, keep .yanju/

Scenes

Scenes live in a separate yanju-scenarios catalog, not this package. Yanjú reads index.yaml, fetches that scene folder, and copies workspace.copy into cwd.

A source checkout of this repo uses ./yanju-scenarios when present. Otherwise the CLI clones the remote in yanju/catalog.yaml. Overrides:

  • YANJU_SCENES_DIR — path to a local checkout
  • YANJU_SCENES_REPO / YANJU_SCENES_REF — git URL and branch/tag to clone into ~/.cache/yanju/scenes/ (or YANJU_SCENES_CACHE)

Default remote: https://github.com/xyluz/yanju-scenarios.git.

Adding a scenario

Add a folder to yanju-scenarios (not this CLI) with:

  • scenario.yaml — name, brief.problem, brief.outcome, images, workspace.copy, compose project, health service, verify URL, optional chaos command
  • docker-compose.yaml — the whole stack (PHP-FPM, MySQL, Redis, … are fine)
  • files listed in workspace.copy
  • optional docker-compose.k6.yaml overlay (not copied to the candidate)
  • optional chaos/ hook
  • eval/ pytest files that read YANJU_BASE_URL
  • a row in index.yaml

The harness never imports scenario Python and never assumes FastAPI or Nginx.

Development

python3 -m pip install -e ".[dev]"
python3 -m pytest tests -v

The default suite does not need Docker.

Release files for yanju 0.1.0

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

Source distribution (sdist)

Source distribution for yanju 0.1.0
File Size Uploaded
yanju-0.1.0.tar.gz 25.1 kB Details

Built distribution (wheel)

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

Total release size: 45.3 kB

Release files / yanju-0.1.0.tar.gz

Download URL yanju-0.1.0.tar.gz
Size 25.1 kB
Tags Source
SHA-256 checksum
How to use checksums
6dbfecf22b2311930d99415a21c6dad6e0527eddfb21f5123b550212b0df7a74
BLAKE2b-256 checksum
How to use checksums
1f5349c4336a0d6663bf41d950b3f2ee25b2d71f5ebe99575e3029b6cf26f466
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.3

Release files / yanju-0.1.0-py3-none-any.whl

Download URL yanju-0.1.0-py3-none-any.whl
Size 20.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
acc481523c5f10ba14a1bfdf94bcc4a63d91a2fd9066395a4852fdbc1656efc7
BLAKE2b-256 checksum
How to use checksums
090ec10ada373b78da4b283adde22432f4187b6c3cdf595b1e5b7cb8524c8596
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.3

Release history Release notifications | RSS feed

0.1.1

2 release files

This release

0.1.0 This release

2 release files

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