Metadata-Version: 2.4
Name: yellow-belt-imaging
Version: 0.1.0
Summary: A textual TUI for driving the full_containerized meerkat-pipeline image under apptainer/singularity (the APPTAINER.md flow)
Author-email: Tim Molteno <tim@elec.ac.nz>
License-Expression: MIT
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: textual>=1.0
Requires-Dist: textual-fspicker>=1.0

# yellow_belt_imaging — the TUI

A [textual](https://textual.textualize.io/) terminal interface for driving the
full_containerized pipeline image under **apptainer** (or singularity) — the
[APPTAINER.md](../APPTAINER.md) flow with widgets on it: environment checks,
the configuration form, the SIF build, the run and its live output.

## Install and run

```bash
pip install full_containerized/yellow_belt_imaging_tui   # or -e for development
yellow_belt_imaging                                      # the console script
python -m yellow_belt_imaging                            # same thing
```

## What it does

* **checks the environment first**: apptainer is preferred, singularity is the
  fallback — the version shows on the status line and Run/Build stay disabled
  when neither is on PATH;
* **the configuration form**: MS_PATH (raw `*.ms`), OUT_PATH (relative paths
  are fine under apptainer), the optional `BEAMS_DIR` (read-only source cubes)
  and `BEAM_CUBE_DIR` (writable beam products — the on-demand source-cube
  render and its ~5.4 GB BDS cache land here) — each with a **Browse…**
  directory picker (`textual-fspicker`: navigate into the directory, press
  Select) — plus `RAM_GB` (the budget that sets the resolution), `NCPU`,
  `BAND`, the image tag and SIF path, and switches for
  `UVMAX_USE_PROFILE_CAP`, `VALIDATE` and validate-only (`-d`);
* **Check** validates the configuration before anything runs (path existence,
  the writable MS parent, RAM_GB/NCPU as whole numbers, BEAM_CUBE_DIR ≠
  BEAMS_DIR) and reports the SIF, the image reference and where the BDS cache
  will go;
* **Build SIF** runs `apptainer build $HOME/meerkat-pipeline.sif
  docker://ghcr.io/tmolteno/meerkat-pipeline:<tag>` with the tmpdir moved off
  a small `/tmp`, streaming the output;
* **Run pipeline** runs `apptainer run -B <ms dir> <sif>` with the full
  environment (including the cab-image cache redirect), streams the pipeline
  into the log pane, and **Cancel** SIGTERMs (then SIGKILLs) the whole run.
* **Remembers your parameters**: every Run or Build launch writes the full
  configuration to `.meerkat_tui_param` in the working directory, and the next
  launch pre-populates the form from it (a missing or corrupt file falls back
  to the defaults).  The file is gitignored in the repository.
* **Copy output** (`ctrl+o` or the button): puts the whole output pane on the
  terminal clipboard (OSC 52; most terminals — macOS's stock Terminal.app is
  the notable exception).  For mouse selection while the app runs, hold
  **shift** and drag — terminals pass shift-drags through to their own
  selection even when a TUI claims the mouse (xterm, GNOME Terminal, kitty,
  iTerm2, Windows Terminal).

Everything the TUI does is the headless equivalent documented in
[APPTAINER.md](../APPTAINER.md); the child environment and command lines come
from `yellow_belt_imaging/runner.py`, which is unit-testable without a display
(see `tests/test_yellow_belt_imaging_tui.py` in the repository root).

## Releases (PyPI, Trusted Publishing)

`.github/workflows/yellow-belt-imaging.yml` publishes on a
`yellow-belt-imaging-vX.Y.Z` tag (which must match the pyproject version): it
builds the sdist + wheel, smoke-tests the wheel's entry point and imports, and
uploads to PyPI with **Trusted Publishing** (OIDC — no API token; the workflow
itself is the credential, `environment: pypi`).

One-time setup on PyPI: register the Trusted Publisher (on the project's
*Publishing* page, or as a *pending publisher* for the first release) with

| field | value |
|---|---|
| owner | `tmolteno` |
| repository | `meerkat_imaging` |
| workflow filename | `yellow-belt-imaging.yml` |
| environment | `pypi` |

then

```bash
git tag -a yellow-belt-imaging-v0.1.0 -m "yellow-belt-imaging v0.1.0"
git push origin yellow-belt-imaging-v0.1.0
```

Bump the version in this pyproject.toml in the same work block as the tag.
