Skip to content

napari/settings: replace single checkbox with per-output retention group + presets (Slice 3 of #245)#252

Merged
aelefebv merged 1 commit into
dechaofrom
slice-3-napari-settings-retention
May 12, 2026
Merged

napari/settings: replace single checkbox with per-output retention group + presets (Slice 3 of #245)#252
aelefebv merged 1 commit into
dechaofrom
slice-3-napari-settings-retention

Conversation

@aelefebv

Copy link
Copy Markdown
Owner

Summary

  • New IntermediateRetentionGroup widget (in nellie_napari/nellie_settings.py) replaces the single "Remove intermediate files" checkbox: 4-radio preset row + 8 stage-grouped subgroups holding 14 checkboxes (one per key in DROPPABLE_KEYS).
  • SettingsConfig schema: remove_intermediates: boolcleanup_drop_keys: frozenset[str]. to_config/apply_config updated.
  • "Custom" preset radio is informational (auto-selected when checkbox state diverges from any named preset; not user-clickable).
  • 17 new tests in tests/test_napari_settings.py pin the contract via the public drop_keys() / set_drop_keys(...) API.
  • Friendly checkbox labels include the raw key in parens; tooltips describe source stage + downstream consumers.

⚠️ The processor (nellie_processor.py) still reads the now-removed remove_intermediates_checkbox attribute. Slice 4 (#249) re-wires it. No test exercises that path, so the suite stays green.

Closes #248. Builds on #246 (Slice 1).

Test plan

  • uv run pytest tests/test_napari_settings.py tests/test_run_cleanup.py tests/test_verifier_iminfo.py -q — 90 passed
  • uv run pytest -q --ignore=tests/test_*_perf.py — 715 passed, 0 regressions
  • Reviewer: open the napari plugin in the Settings tab → verify the new collapsible group renders, presets snap correctly, custom preset auto-selects on individual toggle

🤖 Generated with Claude Code

…oup + presets (Slice 3 of #245)

Replaces the legacy "Remove intermediate files" checkbox with a new
``IntermediateRetentionGroup`` widget composed of:

- A preset radio row at top (Keep everything / Masks + CSVs only /
  CSVs only / Custom). Custom is auto-selected when the per-output
  selection diverges from any named preset; not user-clickable.
- Eight stage-grouped subgroups (Filter, Label, Network, Markers,
  Tracking, Voxel reassignment, Hierarchy, Pipeline input) holding
  one checkbox per key in ``DROPPABLE_KEYS``. Checkbox semantics:
  **checked = drop**. Each checkbox carries a tooltip describing
  the source stage and downstream consumers (re-run implications).

Selecting a named preset radio sets the per-output checkboxes to
match the preset's drop set. Toggling any individual checkbox
flips the radio to "Custom"; toggling back to the preset's exact
drop set re-selects the preset.

``SettingsConfig`` schema change: ``remove_intermediates: bool`` →
``cleanup_drop_keys: frozenset[str]``. ``to_config`` reads the
widget's ``drop_keys()``; ``apply_config`` calls
``set_drop_keys(...)`` which also syncs the preset radio.

17 new tests in ``tests/test_napari_settings.py`` pin: default
state ("Keep everything", empty drop set); checkbox count and
membership; tooltips present; preset → drop-set mapping (×3);
``set_drop_keys`` round-trip (×3); preset radio reflects loaded
drop set (named + Custom); checkbox toggle after preset switches
to Custom (and back); unknown / CSV keys rejected;
``SettingsConfig`` field schema and round-trip.

Note: ``nellie_processor.py`` still references the now-removed
``remove_intermediates_checkbox``; that attribute lookup will
fail at runtime in ``run_feature_export`` until Slice 4 (#249)
re-wires it. No tests exercise that path so the regression suite
stays green (715 passed).

Closes #248

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant