feat(cli): rewrite CLI in Python with Typer and Rich#18
Merged
jcardozo-eth merged 18 commits intomainfrom Feb 18, 2026
Merged
Conversation
Remove the gomod2nix pre-commit hook as part of the CLI rewrite from Go to Python.
Remove the entire Go-based CLI implementation (Cobra + Lipgloss) including commands, internal packages, Go module files, Nix flake, goreleaser config, and package.nix. The CLI is being rewritten in Python with Typer + Rich.
Replace the Go CLI with a Python implementation using Typer 0.15+ and Rich 13+. The new CLI is a UV workspace member (`cli/`) with entry point `dap = "dap_cli.app:main"`. Commands implemented: - dev: test, lint, typecheck, check (with --scope core|cli|all) - env: welcome, tools, env, clean, reset - hints: uv, dagster, direnv (usage guidance) - k8s: up, down, restart, status, logs, shell Features: - ETH Zurich brand colours with light/dark terminal detection - Centralized Rich console with NO_COLOR and CI support - Grouped help output with custom TyperGroup - Comprehensive test suite with mocked subprocess calls
Add `cli/` as a UV workspace member so the Python CLI is installed alongside the pipeline. Add `dagster-dg-cli` dependency and `tool.dg` configuration for project-scoped Dagster CLI support.
Remove the dap-cli flake input, Go packages, and gomod2nix overlay. Consolidate from four shells (default, minimal, k8s, cli-dev) to two (default with k8s tools, minimal with just Python + uv). The CLI is now a Python package installed by uv, not a Nix-built Go binary.
Add a composite action that installs Nix with Determinate Systems installer, enables magic-nix-cache, and exports the devshell environment to GitHub Actions via direnv.
Simplify CI and CLI workflows to use the new composite action and run `dap check --scope core` / `dap check --scope cli` instead of raw nix develop commands. Remove the Go-based goreleaser release workflow (no longer needed).
Add readinessProbe and startupProbe to the Dagster webserver in local values to prevent routing traffic before the server is ready and allow sufficient time for initial startup.
Update README with new command reference, dev toolchain overview, environment variables (DAP_THEME, NO_COLOR), and Python project structure. Remove all Go references (Go prereq, goreleaser, Cobra, Charmbracelet). Rewrite cli/CONTRIBUTING.md with Typer/Rich architecture, TUI conventions, and Python testing patterns.
Cache tool version results in `.venv/.dap-tool-cache.json` with a SHA-256 fingerprint of uv.lock, flake.lock, and flake.nix. The cache is invalidated when any of these files change and cleared by `dap clean`. Removes the `--quick` flag from `dap welcome` since cached lookups are effectively instant.
Replace the `.dev/scripts/uv-sync.sh` wrapper with a direct `uv sync --extra dev --all-packages` call.
Auto-fetch nix-direnv if not installed globally to avoid slow flake re-evaluation on every shell entry.
Remove the main-only branch filter so CLI quality checks run on every push that touches cli/, not just main and pull requests.
Include .github/workflows/cli.yml in the paths filter so workflow edits themselves trigger the pipeline.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Python CLI for DAP built on Typer and Rich, with ETH Zurich branded terminal output, grouped help, tool version caching, and a full test suite. Replaces the previous Go implementation; simplifies the Nix flake and CI accordingly.
CLI features
Command surface
Four command groups, accessible via
dap <command>ordap k8s <subcommand>:test,lint,typecheck,check--scope core/cli/all)welcome,tools,env,clean,resetuv,dagster,direnvk8s up/down/restart/status/logs/shelldap --helpuses a customGroupedCommandsclass that organizes commands under section headers instead of a flat listdap welcomedisplays the DAP-O logo, project info, and detected tool versionsdap dev check --scope cliruns only CLI checks (ruff + pytest);--scope coreruns only pipeline checks; default runs bothThemed output (
theme.py)All output goes through a centralized Rich
Console(writing to stderr) with:COLORFGBGdetection orDAP_THEME=light|darkoverride)success(green),error(red),warning(bronze),info(petrol),title(bold blue),hint(grey),command(bold blue)OK(checkmark),FAIL(cross),WARN(exclamation),ARROW(right arrow),DASH(em dash)NO_COLORand CI support — color disabled automatically in CI or whenNO_COLORis setTool version cache (
utils/cache.py)dap welcomeanddap toolsdetect versions of Python, uv, kubectl, Helm, etc. Results are cached to a JSON file with a configurable TTL (default 1 hour), so repeated runs skip the subprocess calls. Cache auto-invalidates on TTL expiry and handles file corruption gracefully.Developer experience
The
dapCLI gives every operator of this repository — human developers, coding agents, and CI pipelines — a single, predictable interface for common tasks.Onboarding.
dap welcomeshows installed tools, active versions, and environment health at a glance. Hint commands (dap uv,dap dagster,dap direnv) provide cheat sheets without leaving the terminal.Common tasks.
dap checkruns lint, typecheck, and test in sequence with live progress and clear pass/fail output.dap k8s upencodes a multi-step workflow so the right flags and ordering are always applied.Agents and automation.
NO_COLORand CI detection ensure clean output in non-interactive contexts. CI calls the same commands developers run locally, so there is one definition of "passing" everywhere.Build and infrastructure changes
cli/as a workspace member.uv syncinstalls both the pipeline and CLI in one step — no separate build artifact.default,minimal). Go toolchain removed.setup-nix-envreusable composite action shared byci.ymlandcli.yml. GoReleaser release workflow removed.values-local.yamlgains readiness and startup probes for the webserver.Testing
dap check --scope cliruns the full CLI quality pipeline: ruff (linting and format checking), mypy (static type checking), and pytest (unit and behavioral tests). This is the same command used in CI.The test suite (~430 lines, 3 files) uses
typer.testing.CliRunnerandunittest.mock:test_commands.py— structural tests (all commands registered, help text present) and behavioral tests for dev/env/hints commandstest_k8s.py— unit tests for helper functions, behavioral tests fordown,status, andwaitlogictest_cache.py— roundtrip serialization, TTL invalidation, corruption recovery, integration withwelcomeTerminal output
dap welcomedap --helpdap check --scope cli