Skip to content

v0.22.0

Choose a tag to compare

@mortenoh mortenoh released this 25 Apr 21:27
· 51 commits to main since this release
v0.22.0
486581a

A focused release that polishes the chapkit CLI for users coming from R or with little Python background, removes unused surface, and ships clearer scaffolded projects. Several breaking changes - read the upgrade notes if you depend on chapkit run / chapkit migrate / the task module / --with-monitoring.

Breaking changes

  • Init template names renamed. --template ml -> --template fn-py, --template ml-shell -> --template shell-py. New --template shell-r for R models on chapkit-r-inla. The old names error cleanly. (#41)
  • chapkit run and chapkit migrate moved under chapkit mlproject. Canonical forms are now chapkit mlproject run / chapkit mlproject migrate. The old top-level commands stay registered as hidden backwards-compat aliases (so the chapkit-py base image's existing CMD keeps working) but documentation and tests use the new path. (#41)
  • Task module removed. chapkit.task (TaskRegistry, TaskExecutor, TaskRouter, ...) is gone, along with the task init template, the task example, and docs/guides/task-execution.md. Nothing internal used it; the only consumer was the template that scaffolded projects which used it. If you import chapkit.TaskRegistry etc. anywhere, those imports will break. (#41)
  • --with-monitoring flag removed. The scaffolded service still exposes /metrics (Prometheus format) by default - .with_monitoring() is unconditional now. Layer Prometheus + Grafana yourself via the new docs/guides/monitoring.md. (#42)
  • Postman collection removed from the scaffold. FastAPI's auto-generated /docs (Swagger UI) covers the same use case for free; users who specifically want Postman can import /openapi.json. (#42)
  • Default scaffolded host port changed from 8000 to 9090 to dodge the usual busy ports (8000 = FastAPI default, chap-core itself; 8080 = generic). Container-internal port stays 8000. (#41)
  • Scaffolded compose service name is now the project slug, not api - so the service's docker-DNS hostname is unique when used as a chap-core overlay alongside other models. (#41)

CLI

  • New --template shell-r scaffold built on ghcr.io/dhis2-chap/chapkit-r-inla:latest with platform-pinned amd64 (Rosetta-friendly), R script stubs in scripts/{train.R, predict.R}, and a Config class that R scripts read via yaml::yaml.load_file(\"config.yml\"). (#41)
  • Init Dockerfile rewritten on top of ghcr.io/dhis2-chap/chapkit-py:latest (was a heavy multi-stage build from raw uv base) and uses uv sync --frozen --no-dev --no-install-project for reproducible builds. (#41)
  • Scaffolded compose.yml ships with commented blocks for GHCR image pulls and chap-core registration env, so flipping a service into a chap-core overlay is one uncomment. (#41)
  • chapkit init --help now shows usage examples in its epilog; top-level chapkit --help opens with a Quick Start block pointing at the three init templates. (#42)
  • chapkit test opens with a banner showing which URL it's hitting, so accidental i'm testing the wrong thing is visible immediately. (#42, #42)
  • chapkit mlproject group is hidden from --help when there's no MLproject file in the cwd; init is hidden inside chapkit projects; test is hidden outside them. (#41)
  • chapkit init no longer emits a Postman collection. (#42)

Generated projects

  • New top-of-file banner in main.py explaining What is this file? and what users typically edit (Config class, ServiceInfo, train/predict scripts) - a gentler intro for users who aren't deep in Python. (#42)
  • AssessedStatus colour system documented in three places at once: the enum docstring, an inline comment in generated main.py, and a colour table in the scaffolded README's Customization section. (#42)
  • Scaffolded README has a What you'll edit and What you need installed section template-aware (shell-r leads with Docker; shell-py / fn-py mention Python + uv). (#42)
  • model.rds placeholder for shell-r (was incorrectly model.pickle even for R scripts). (#42)

Examples directory cleanup

  • Removed: examples/quickstart/, examples/full_featured/, examples/config_basic/, examples/artifact_manager/, examples/custom_migrations/, examples/vega_visualization/, examples/task_execution/. The first five were redundant with chapkit init / docs; the last two were untested showcase code. (#41)
  • Surviving examples (artifact, config, config_artifact, dataframe_usage, library_usage, ml_class, ml_functional, ml_pipeline, ml_shell) are pattern-focused and most are exercised by the test suite.

Documentation

  • New R Quickstart - 10-minute path from `chapkit init --template shell-r` to a running chapkit service. (#42)
  • New Shell-runner Contract documenting the workspace lifecycle, file inventory, and `config.yml` shape per scaffolding path. (#42)
  • New Monitoring guide with a drop-in Prometheus + Grafana compose overlay for the scaffolded `/metrics` endpoint. (#42)
  • Removed the Task Execution guide.
  • Sweep across all 19 .md files for stale references after the refactor: ~60 `localhost:8000` -> `localhost:9090`, `/workspace/data` -> `/work/data`, removed-feature pointers updated. (#43, #43)
  • `mkdocs build --strict` now passes clean. (#44, #44)

Verification

All three init templates verified end-to-end before tagging:

Template Build Health `chapkit test --verbose`
`fn-py` OK OK ALL TESTS PASSED
`shell-py` OK OK ALL TESTS PASSED
`shell-r` (chapkit-r-inla, Rosetta) OK OK ALL TESTS PASSED