From fb8e8a0a539c7b0a04c7ed3cd9c8ce337b85b426 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 24 Nov 2026 17:42:18 +0000 Subject: [PATCH 01/13] Prepare v0.9.0: Stable 1 (two notebooks, normalization v0.8.0, integrity fixes) Commit A of the release PR (owner decision: v0.9.0, a minor release). - pyproject version 0.9.0 (the package's __version__ comes from the metadata; src unchanged). - CHANGELOG: "Unreleased" becomes "v0.9.0 (24 November 2026)" with a summary; every entry kept. - MorphoBricks_Preprocessing and MorphoBricks_Preprocessing_Cellpose: current_version 0.9.0, RELEASE_TAG v0.9.0; notebook_latest_versions.yaml likewise. MorphoBricks_Cellpose (0.1.0) unchanged: it is retired by the owner after the Colab test. - README pins and status, AGENTS.md section 11, docs/colab-release-check.md: 0.9.0 (normalization stays 0.8.0). - Tests whose doubles hold the notebook's version: test_notebook_setup.py, test_notebook_installed_commit.py and installed_record.PINNED_VERSION: 0.9.0. - RELEASE_REF of all three notebooks is unchanged; commit B points it at this commit and records the call in RELEASE_CALLS, after #376 is merged. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01G3qp9AxjpGPw9xfWAUJNqc --- AGENTS.md | 12 +++++++++--- CHANGELOG.md | 17 ++++++++++++++++- README.md | 8 ++++---- docs/colab-release-check.md | 4 ++-- notebooks/MorphoBricks_Preprocessing.ipynb | 4 ++-- .../MorphoBricks_Preprocessing_Cellpose.ipynb | 4 ++-- notebooks/notebook_latest_versions.yaml | 4 ++-- pyproject.toml | 2 +- tests/installed_record.py | 2 +- tests/test_notebook_installed_commit.py | 16 ++++++++-------- tests/test_notebook_setup.py | 14 +++++++------- 11 files changed, 54 insertions(+), 33 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 442ed30f..f837823d 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1305,9 +1305,15 @@ jupyter lab notebooks/MorphoBricks_Preprocessing.ipynb --- -## 11. Status (current state, v0.8.0) - -- **Released:** v0.8.0 (19 November 2026), a minor release because of its breaking entries +## 11. Status (current state, v0.9.0) + +- **Released:** v0.9.0 (24 November 2026), a minor release, Stable 1: two notebooks + (`MorphoBricks_Preprocessing` and `MorphoBricks_Preprocessing_Cellpose`, #441; + `MorphoBricks_Cellpose` stays until the owner's Colab test), normalization pinned at v0.8.0 + (#471), the Spec pin at `232fb38` (fast mode, ADR 0006; draft file version 4), run integrity + checked at read and open (#480, #489, #490, #491) and the conversion and publication fixes + (#400, #447, #448, #467, #482, #488, #497); run manifest version 5 unchanged. + v0.8.0 (19 November 2026), a minor release because of its breaking entries (`imagecodecs` required, codecs without a measured bound refused; no format change): lazy windows (#339, `docs/design/lazy-windows.md`) with `window_map` / `map_windows` (#346), the array H&E tissue mask `he_tissue_mask_array` (#343), the `max_ram` worker planner (#341), window memory diff --git a/CHANGELOG.md b/CHANGELOG.md index 89c36057..af724ee1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,22 @@ The design is `docs/restart/preprocessing-design-v0.4.md` in MorphoFeature, on b are in [docs/plan.md](docs/plan.md) §12. (The v0.3 to v0.4 migration guide was removed in v0.5.1: no run before v0.5.1 is read.) -## Unreleased +## v0.9.0 (24 November 2026) + +**Stable 1: two notebooks, normalization v0.8.0, and the integrity fixes.** A minor release +(semantic versioning before 1.0, `docs/development.md`): the user-facing notebooks are now two, +`MorphoBricks_Preprocessing.ipynb` (images to a run ready for MorphoFeature) and +`MorphoBricks_Preprocessing_Cellpose.ipynb` (the same three cells, then Cellpose segmentation and +mask registration, #441); `MorphoBricks_Cellpose.ipynb` stays until the combined notebook has +passed the owner's Colab test. Normalization is pinned at v0.8.0 (#471, additive). The Spec pin +moves from `bf68d30` to `232fb38` (fast mode, Spec ADR 0006), so drafts written under the old pin +are refused (`spec_commit_mismatch`) and the draft file is version 4. The run manifest stays +version 5; a run's integrity is now checked when it is read and opened (the description's +section digests, unit records and channel coverage, #489, #490, #491), mask headers must be bound +to a fingerprint (#480), and conversion and publication no longer write through links, remove +files they did not write or leave a new description with an old design (#400, #447, #448, #467, +#482, #488, #497). NumPy 2.0 or later is required. CI runs minimal gates on pull requests and the +full matrix at release; the notebooks' `RELEASE_REF` moves only in the release PR. - **`binary_refusals` refuses unbound mask headers for the whole inventory before any read (#490, from the #502 review of #480).** It refused a file found without `bind=True` only when that file's turn came (`scan_fingerprints`), so the bound `binary` files before it were read first, the `MaskUnboundError` named one file, and an unbound file of a mask that is not `binary` passed. It now calls `refuse_unbound` on every file of the inventory first: every unbound file is named (`mask_header_unbound`) and nothing is read. Its docstring lists `MaskUnboundError` under Raises. The mask step's own inventories are found bound, so its behaviour is unchanged. `tests/test_binary_refusals_unbound.py`. - **The section-digest check is tested on runs of other shapes (#490).** #501's tests built runs from `v08` (with masks) only. `tests/test_manifest_section_digests.py` now also opens runs of `v01` (no masks), `v41` (fast mode) and `v43` (fast mode, RGB units with the header override), checks `section_digests()` against the published description's and that a wrong digest of each section is refused. Tests only; these runs already opened correctly. diff --git a/README.md b/README.md index 7db481ea..811e5caa 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ from there. ## Status -Pre-alpha; the current release is v0.8.0 (what is planned next is in +Pre-alpha; the current release is v0.9.0 (what is planned next is in [docs/roadmap.md](docs/roadmap.md)). Implemented and tested: - Folder discovery and validation, TIFF and OME-Zarr header inspection without reading pixels @@ -74,7 +74,7 @@ contract version 3 and an objects use with `RunInputs.read_objects`. See the ## Installation ```bash -pip install "git+https://github.com/CellMigrationLab/morphobricks-preprocessing.git@v0.8.0" +pip install "git+https://github.com/CellMigrationLab/morphobricks-preprocessing.git@v0.9.0" ``` For development, from a clone: @@ -84,7 +84,7 @@ pip install -e ".[dev]" ``` The optional `notebook` extra installs the widget dependencies for the notebook -(`pip install "morphobricks-preprocessing[notebook] @ git+https://github.com/CellMigrationLab/morphobricks-preprocessing.git@v0.8.0"`). +(`pip install "morphobricks-preprocessing[notebook] @ git+https://github.com/CellMigrationLab/morphobricks-preprocessing.git@v0.9.0"`). The notebook's first code cell (**1. Install**) can set this up automatically: it uses a nearby checkout or an installed package only when it is the pinned `RELEASE_REF` commit (never by version alone), and installs missing requirements into the active kernel. A standalone @@ -251,7 +251,7 @@ ruff format . pytest ``` -Coding conventions are described in [docs/development.md](docs/development.md). Planned work after v0.8.0 is in [docs/roadmap.md](docs/roadmap.md). +Coding conventions are described in [docs/development.md](docs/development.md). Planned work after v0.9.0 is in [docs/roadmap.md](docs/roadmap.md). ## License diff --git a/docs/colab-release-check.md b/docs/colab-release-check.md index 7e2592f2..0800c3b2 100644 --- a/docs/colab-release-check.md +++ b/docs/colab-release-check.md @@ -19,7 +19,7 @@ Write the date, the commit and any failure (as an issue number) next to each ite - **Time-lapse:** a small experiment of time-lapse images (optional; the tests cover it). **Before opening it.** `RELEASE_REF` in cell 1 is the release preparation commit, and cell 3's -`PreprocessingNotebook(...)` call is that commit's API (v0.8.0: `PreprocessingNotebook()`). The +`PreprocessingNotebook(...)` call is that commit's API (v0.9.0: `PreprocessingNotebook()`). The release PR moves `RELEASE_REF` and records the pair in `RELEASE_CALLS` of `tests/test_notebook_file.py`, which fails for a `RELEASE_REF` without one. @@ -43,7 +43,7 @@ again on the tagged commit. - [ ] One line: "… run cell 1 (Install MorphoBricks preprocessing) first …", no traceback; nothing is installed. 3. Run **cell 1**. - - [ ] It prints **Ready** with the preprocessing (0.8.0), normalization (0.8.0) and + - [ ] It prints **Ready** with the preprocessing (0.9.0), normalization (0.8.0) and ipywidgets versions and the pinned source, then names cells 2 and 3. No restart or ipywidgets upgrade is asked for; Drive is not mounted. - [ ] Run it again: nothing is installed again, the same versions. diff --git a/notebooks/MorphoBricks_Preprocessing.ipynb b/notebooks/MorphoBricks_Preprocessing.ipynb index b196ecbb..e8eb1c5c 100644 --- a/notebooks/MorphoBricks_Preprocessing.ipynb +++ b/notebooks/MorphoBricks_Preprocessing.ipynb @@ -83,11 +83,11 @@ "from urllib.request import url2pathname\n", "\n", "# LabConstrictor version identifiers.\n", - "current_version = \"0.8.0\"\n", + "current_version = \"0.9.0\"\n", "notebook_name = \"MorphoBricks_Preprocessing\"\n", "\n", "# A downloaded/Colab notebook installs this immutable source revision.\n", - "RELEASE_TAG = \"v0.8.0\"\n", + "RELEASE_TAG = \"v0.9.0\"\n", "RELEASE_REF = \"438a2d37625ae7941953fa831914aa5ef5572696\"\n", "REPOSITORY = \"https://github.com/CellMigrationLab/morphobricks-preprocessing.git\"\n", "EXTRAS = \"notebook\"\n", diff --git a/notebooks/MorphoBricks_Preprocessing_Cellpose.ipynb b/notebooks/MorphoBricks_Preprocessing_Cellpose.ipynb index 94b4d960..e89088db 100644 --- a/notebooks/MorphoBricks_Preprocessing_Cellpose.ipynb +++ b/notebooks/MorphoBricks_Preprocessing_Cellpose.ipynb @@ -91,11 +91,11 @@ "from urllib.request import url2pathname\n", "\n", "# LabConstrictor version identifiers.\n", - "current_version = \"0.8.0\"\n", + "current_version = \"0.9.0\"\n", "notebook_name = \"MorphoBricks_Preprocessing_Cellpose\"\n", "\n", "# A downloaded/Colab notebook installs this immutable source revision.\n", - "RELEASE_TAG = \"v0.8.0\"\n", + "RELEASE_TAG = \"v0.9.0\"\n", "RELEASE_REF = \"3af789160e9ce224a60da4582e9371f028ff47c5\"\n", "REPOSITORY = \"https://github.com/CellMigrationLab/morphobricks-preprocessing.git\"\n", "EXTRAS = \"notebook\"\n", diff --git a/notebooks/notebook_latest_versions.yaml b/notebooks/notebook_latest_versions.yaml index 1ee56047..5cd652cb 100644 --- a/notebooks/notebook_latest_versions.yaml +++ b/notebooks/notebook_latest_versions.yaml @@ -1,5 +1,5 @@ # Latest version of each notebook, read by LabConstrictor's version check by notebook_name. # Equal to the notebook's current_version and its RELEASE_TAG without the "v" (README, "Notebook"). -"MorphoBricks_Preprocessing": "0.8.0" +"MorphoBricks_Preprocessing": "0.9.0" "MorphoBricks_Cellpose": "0.1.0" -"MorphoBricks_Preprocessing_Cellpose": "0.8.0" +"MorphoBricks_Preprocessing_Cellpose": "0.9.0" diff --git a/pyproject.toml b/pyproject.toml index 9e6e6757..32b83dbd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "morphobricks-preprocessing" -version = "0.8.0" +version = "0.9.0" description = "MorphoBricks preprocessing brick: per-plane intensity histograms and normalization methods for microscopy TIFFs." readme = "README.md" license = "MIT" diff --git a/tests/installed_record.py b/tests/installed_record.py index 85f3584b..5f2955f8 100644 --- a/tests/installed_record.py +++ b/tests/installed_record.py @@ -10,7 +10,7 @@ import json DISTRIBUTION = "morphobricks-preprocessing" -PINNED_VERSION = "0.8.0" +PINNED_VERSION = "0.9.0" """The version both notebooks' RELEASE_REF commits hold.""" diff --git a/tests/test_notebook_installed_commit.py b/tests/test_notebook_installed_commit.py index 7698eda4..20733e43 100644 --- a/tests/test_notebook_installed_commit.py +++ b/tests/test_notebook_installed_commit.py @@ -41,7 +41,7 @@ both notebooks.""" PINNED = f"morphobricks-preprocessing[notebook] @ git+{REPOSITORY}@{RELEASE_REF}" MAIN = "de3f7a476da8a3dc49c81b20935a9a1a4831a435" -"""A commit of main whose version is the release's, 0.8.0 (the #371 review's example).""" +"""A commit of main (the #371 review's example, then of the release's version, 0.8.0).""" def _functions(text, names): @@ -72,7 +72,7 @@ def test_setup_reuses_the_matching_installed_release(cell_1, capsys): # noqa: F "morphobricks_preprocessing.notebook_ui", # cell 3 shows it ] out = capsys.readouterr().out - assert "Ready: preprocessing 0.8.0" in out + assert "Ready: preprocessing 0.9.0" in out assert "ipywidgets 7.7.1" in out @@ -87,7 +87,7 @@ def test_setup_replaces_a_mismatched_installed_release(cell_1): # noqa: F811 def test_the_banner_shows_the_installed_commit(cell_1, capsys): # noqa: F811 state = cell_1 state.start(INSTALL) - assert f"Ready: preprocessing 0.8.0 (commit {RELEASE_REF});" in capsys.readouterr().out + assert f"Ready: preprocessing 0.9.0 (commit {RELEASE_REF});" in capsys.readouterr().out assert state.namespace["SETUP_RECORD"]["preprocessing_commit"] == RELEASE_REF assert state.namespace["SETUP_RECORD"]["source"] == "installed package" @@ -115,11 +115,11 @@ def test_the_banner_shows_the_installed_commit(cell_1, capsys): # noqa: F811 @pytest.mark.parametrize("record", NOT_THE_RELEASE.values(), ids=NOT_THE_RELEASE) def test_setup_installs_the_release_over_another_commit(cell_1, record, capsys): # noqa: F811 state = cell_1 - state.direct_url = record # the installed version is 0.8.0, as the notebook's + state.direct_url = record # the installed version is 0.9.0, as the notebook's state.start(INSTALL) forced_then_installed(state.installs, PINNED) # each is installed: pip would keep it out = capsys.readouterr().out - assert f"morphobricks-preprocessing v0.8.0 ({RELEASE_REF[:12]})" in out + assert f"morphobricks-preprocessing v0.9.0 ({RELEASE_REF[:12]})" in out assert f"(commit {RELEASE_REF})" in out # what pip installed, read again after it assert state.namespace["SETUP_RECORD"]["preprocessing_commit"] == RELEASE_REF @@ -133,14 +133,14 @@ def test_setup_stops_when_the_install_leaves_another_commit(cell_1, monkeypatch) forced_then_installed(state.installs, PINNED) assert state.namespace["SETUP_RECORD"] == {} # A restart would not help (pip kept the files): the stop gives the command that does. - assert f"recorded {'2' * 40}, not v0.8.0 ({RELEASE_REF})" in str(stop.value) + assert f"recorded {'2' * 40}, not v0.9.0 ({RELEASE_REF})" in str(stop.value) assert "Restart" not in str(stop.value) command = f'{sys.executable} -m pip install --force-reinstall --no-deps "{PINNED}"' assert f"Replace it with: {command}, then run this cell again." in str(stop.value) def test_setup_replaces_the_same_version_from_another_commit_that_pip_keeps(cell_1, capsys): # noqa: F811 - # The #371 review (pip 24.1.2 and 26.3): pip takes 0.8.0 from another commit as already + # The #371 review (pip 24.1.2 and 26.3): pip takes 0.9.0 from another commit as already # satisfied, installs nothing and keeps its record, so cell 1 stopped on every run. The # pinned commit is now forced, without its dependencies, then the extras are installed. state = cell_1 @@ -151,7 +151,7 @@ def test_setup_replaces_the_same_version_from_another_commit_that_pip_keeps(cell assert ( f"Replacing the installed morphobricks-preprocessing with commit {RELEASE_REF[:12]}" in out ) - assert f"Ready: preprocessing 0.8.0 (commit {RELEASE_REF});" in out + assert f"Ready: preprocessing 0.9.0 (commit {RELEASE_REF});" in out assert state.namespace["SETUP_RECORD"]["preprocessing_commit"] == RELEASE_REF state.start(INSTALL, fresh=False) assert len(state.installs) == 2 # running the cell again installs nothing more diff --git a/tests/test_notebook_setup.py b/tests/test_notebook_setup.py index f27b052c..0257e744 100644 --- a/tests/test_notebook_setup.py +++ b/tests/test_notebook_setup.py @@ -109,7 +109,7 @@ def setup_environment(tmp_path, monkeypatch): drive=tmp_path / "content/drive", namespace={}, versions={ - "morphobricks-preprocessing": "0.8.0", + "morphobricks-preprocessing": "0.9.0", "morphobricks-normalization": "0.8.0", "ipywidgets": "7.7.1", }, @@ -172,7 +172,7 @@ def checkout_at(path): package.mkdir(parents=True) (package / "__init__.py").write_text("", encoding="utf-8") (path / "pyproject.toml").write_text( - '[project]\nname = "morphobricks-preprocessing"\nversion = "0.8.0"\n', + '[project]\nname = "morphobricks-preprocessing"\nversion = "0.9.0"\n', encoding="utf-8", ) return path @@ -189,7 +189,7 @@ def test_setup_installs_missing_package_from_the_exact_commit(setup_environment, assert target.startswith("morphobricks-preprocessing[notebook] @ git+") assert target.endswith("@" + namespace["RELEASE_REF"]) assert namespace["RELEASE_REF"] == "438a2d37625ae7941953fa831914aa5ef5572696" - assert "pinned v0.8.0 candidate" in capsys.readouterr().out + assert "pinned v0.9.0 candidate" in capsys.readouterr().out def test_setup_prefers_a_nearby_checkout(setup_environment, tmp_path, monkeypatch, capsys): @@ -272,7 +272,7 @@ def test_an_explicit_development_override_uses_the_checkout_and_says_so( assert sys.path[0] == str(checkout / "src") assert f"commit {OTHER_COMMIT}, uncommitted changes" in out assert "DEVELOPMENT OVERRIDE is on" in out - assert "DEVELOPMENT OVERRIDE on" in out.split("Notebook 0.8.0")[1] + assert "DEVELOPMENT OVERRIDE on" in out.split("Notebook 0.9.0")[1] record = namespace["SETUP_RECORD"] assert record["checkout_commit"] == OTHER_COMMIT assert record["checkout_has_uncommitted_changes"] is True @@ -416,7 +416,7 @@ def test_cell_1_installs_without_mounting_drive_or_showing_the_app( assert namespace["SETUP_RECORD"]["release_ref"] == RELEASE_REF out = capsys.readouterr().out assert ( - f"Ready: preprocessing 0.8.0 (commit {RELEASE_REF}); normalization 0.8.0; " + f"Ready: preprocessing 0.9.0 (commit {RELEASE_REF}); normalization 0.8.0; " "ipywidgets 7.7.1." in out ) assert "Next: run cell 2 (Mount Google Drive), then cell 3 (Run preprocessing)." in out @@ -434,8 +434,8 @@ def test_running_cell_1_again_installs_nothing_more(setup_environment, capsys): assert len(state.installs) == 1 assert "Installing notebook requirements" in first assert "Installing notebook requirements" not in again - assert "Ready: preprocessing 0.8.0" in again - assert state.namespace["SETUP_RECORD"]["preprocessing_version"] == "0.8.0" + assert "Ready: preprocessing 0.9.0" in again + assert state.namespace["SETUP_RECORD"]["preprocessing_version"] == "0.9.0" assert record["release_ref"] == state.namespace["SETUP_RECORD"]["release_ref"] From 1d7f241df018fc254ef782ebda8dda0ce4e7686f Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 24 Nov 2026 21:15:04 +0000 Subject: [PATCH 02/13] Record the v0.9.0 release run in docs/conformance.md The full python tools/check.py on the tree of the merge commit 32be653 (main at b683c7c with #376 and #283/#535): Ruff clean, 705 files formatted, pytest 8042 passed and 19 skipped, code rules passed; the Spec modules 2122 passed, 0 skipped; the notebook pin and version tests 49 passed. Docs only: this commit is the v0.9.0 preparation commit A that commit B pins. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01G3qp9AxjpGPw9xfWAUJNqc --- docs/conformance.md | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/docs/conformance.md b/docs/conformance.md index 78aec3f7..626874bf 100644 --- a/docs/conformance.md +++ b/docs/conformance.md @@ -6,6 +6,42 @@ real run; a skip is never counted as a pass. Owner rulings of 8 November 2026 (i "no skips" applies to the Spec conformance modules (`tests/test_spec_*.py`); a skip elsewhere in the suite is listed as **not run**, with its reason. +## Release record: v0.9.0 (24 November 2026) + +A G1-style record of the v0.9.0 release candidate, a minor release, Stable 1: two notebooks +(`MorphoBricks_Preprocessing` and `MorphoBricks_Preprocessing_Cellpose`, #441), normalization +pinned at v0.8.0 (#471), the Spec pin at `232fb38` (fast mode, Spec ADR 0006; draft file +version 4), run integrity checked at read and open (#480, #489, #490, #491), the conversion and +publication fixes (#400, #447, #448, #467, #482, #488, #497), the channel-tag override with its +per-unit review (#376) and the removal of a whole repeat or condition (#283). The run manifest +stays version 5. It does not decide a gate; deciding a gate is the owner's. + +| | | +|---|---| +| Release candidate | Measured on the tree of the merge commit `32be653a82521ab630d96d79e9cd5454bb14904e` (branch `claude/release-v0.9.0`: the first preparation commit `fb8e8a0`, from `main` at `75cde57`, merged with `main` at `b683c7c`, which adds #376 and #283/#535) before this record was added; the record changes only this file, and the commit that adds it is the v0.9.0 preparation commit A (`git diff 32be653 A -- src pyproject.toml` is empty). A keeps the notebooks' `RELEASE_REF` at their v0.8.0-era pins. Commit B then points the `RELEASE_REF` of all three notebooks at A and records the pair in `RELEASE_CALLS`. | +| Spec pin | `tests/spec_fixtures/PIN.toml`: MorphoBricks-Spec `232fb38880cc487510532d99dc71d46a27005f23` (moved from `bf68d30` in this release, ADR 0006) | +| Environment | Linux, Python 3.13.18, `pip install --no-cache-dir -e '.[dev,zarr,notebook]'` in a fresh venv (normalization 0.8.0, imagecodecs 2026.11.11, numpy 2.5.5, scipy 1.18.1, tifffile 2026.11.16, zarr 3.4.2, ipywidgets 8.1.9, pytest 9.2.0, ruff 0.17.6; scikit-image not installed); `PYTEST_ADDOPTS` unset; run as root on a case-sensitive file system | +| Commands | `python tools/check.py` (the whole suite in one run); `python -m pytest -q -p no:cacheprovider -rsxX tests/test_spec_*.py`; `python -m pytest -q -p no:cacheprovider -rsxX tests/test_notebook_setup.py tests/test_notebook_file.py` | +| `tools/check.py` | Ruff clean, Ruff format 705 files already formatted, pytest **8042 passed, 19 skipped** (not run, below), 0 failed, code rules passed (exit status 0) | +| Spec modules (`tests/test_spec_*.py`, 30 files) | **2122 passed, 0 skipped, 0 failed** | +| Notebook pin and version tests | `test_notebook_setup.py` and `test_notebook_file.py`: **49 passed**, 0 skipped (run on the tree of the merge commit) | + +**Not run (19 skips, none in the Spec modules):** 11 tests that need scikit-image (the `he-mask` +extra, not installed in this venv; CI's matrix installs it): `tests/test_he_tissue_array.py:27`, +`tests/test_he_tissue_consumer_gate.py:24`, `tests/test_he_tissue_mask.py:23`, +`tests/test_he_tissue_rule.py:24`, `tests/test_cli_tissue_mask.py:41`, `:61` and `:74`, +`tests/test_notebook_tissue_mask.py:33`, `:81`, `:99` and `:118`; the four environment skips +`tests/test_cli_log.py:166`, `tests/test_folder_rules.py:199` and `:230` (they need a +case-insensitive file system) and `tests/test_discovery.py:665` (cannot run as root); the +editable-install identity test `tests/test_code_identity.py:169`, which CI's `wheel-identity` +job runs on a wheel install; and the 3 release-only freshness tests (`tests/release_run.py:40`, +`test_release_only_the_preprocessing_pin_is_a_commit_with_this_code` for each pinned notebook), +which run in the release PR with `MORPHOBRICKS_RELEASE_RUN=1` once commit B has moved the pins. +The behaviours of these skips are **not verified by this run**. + +**Still the owner's:** the `release` label (the full matrix as a release run), the Colab and +JupyterLab browser check (`docs/colab-release-check.md`) at commit B, before tagging. + ## Release record: v0.8.0 (19 November 2026) A G1-style record of the v0.8.0 release candidate (first prepared as v0.7.1; renumbered by owner decision because of the breaking entries), a minor release: lazy windows From ad8abad55dc8baa4c55b55dc7fae5e213cb2a7f1 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 24 Nov 2026 21:37:30 +0000 Subject: [PATCH 03/13] Point the notebooks at the v0.9.0 preparation commit 1d7f241 RELEASE_REF = 1d7f241df018fc254ef782ebda8dda0ce4e7686f (RELEASE_TAG v0.9.0) in all three notebooks (MorphoBricks_Preprocessing, MorphoBricks_Preprocessing_Cellpose and MorphoBricks_Cellpose), with its PreprocessingNotebook() call recorded in RELEASE_CALLS and the test that asserts the ref: the same two-commit pattern as v0.8.0 (438a2d3, 1964746). Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01G3qp9AxjpGPw9xfWAUJNqc --- notebooks/MorphoBricks_Cellpose.ipynb | 2 +- notebooks/MorphoBricks_Preprocessing.ipynb | 2 +- notebooks/MorphoBricks_Preprocessing_Cellpose.ipynb | 2 +- tests/test_notebook_file.py | 2 ++ tests/test_notebook_setup.py | 2 +- 5 files changed, 6 insertions(+), 4 deletions(-) diff --git a/notebooks/MorphoBricks_Cellpose.ipynb b/notebooks/MorphoBricks_Cellpose.ipynb index e86b84a2..8a686c7d 100644 --- a/notebooks/MorphoBricks_Cellpose.ipynb +++ b/notebooks/MorphoBricks_Cellpose.ipynb @@ -93,7 +93,7 @@ "# Both are pinned: Cellpose to the release this notebook is made for, preprocessing to the\n", "# immutable source revision that holds this notebook's code.\n", "CELLPOSE_VERSION = \"4.2.1.1\"\n", - "RELEASE_REF = \"2405083dca90fd4c0e96faca42a9c490f182a706\"\n", + "RELEASE_REF = \"1d7f241df018fc254ef782ebda8dda0ce4e7686f\"\n", "REPOSITORY = \"https://github.com/CellMigrationLab/morphobricks-preprocessing.git\"\n", "EXTRAS = \"notebook,zarr\" if \"google.colab\" in sys.modules else \"notebook\"\n", "\n", diff --git a/notebooks/MorphoBricks_Preprocessing.ipynb b/notebooks/MorphoBricks_Preprocessing.ipynb index e8eb1c5c..178aef6f 100644 --- a/notebooks/MorphoBricks_Preprocessing.ipynb +++ b/notebooks/MorphoBricks_Preprocessing.ipynb @@ -88,7 +88,7 @@ "\n", "# A downloaded/Colab notebook installs this immutable source revision.\n", "RELEASE_TAG = \"v0.9.0\"\n", - "RELEASE_REF = \"438a2d37625ae7941953fa831914aa5ef5572696\"\n", + "RELEASE_REF = \"1d7f241df018fc254ef782ebda8dda0ce4e7686f\"\n", "REPOSITORY = \"https://github.com/CellMigrationLab/morphobricks-preprocessing.git\"\n", "EXTRAS = \"notebook\"\n", "\n", diff --git a/notebooks/MorphoBricks_Preprocessing_Cellpose.ipynb b/notebooks/MorphoBricks_Preprocessing_Cellpose.ipynb index e89088db..2fb974ec 100644 --- a/notebooks/MorphoBricks_Preprocessing_Cellpose.ipynb +++ b/notebooks/MorphoBricks_Preprocessing_Cellpose.ipynb @@ -96,7 +96,7 @@ "\n", "# A downloaded/Colab notebook installs this immutable source revision.\n", "RELEASE_TAG = \"v0.9.0\"\n", - "RELEASE_REF = \"3af789160e9ce224a60da4582e9371f028ff47c5\"\n", + "RELEASE_REF = \"1d7f241df018fc254ef782ebda8dda0ce4e7686f\"\n", "REPOSITORY = \"https://github.com/CellMigrationLab/morphobricks-preprocessing.git\"\n", "EXTRAS = \"notebook\"\n", "\n", diff --git a/tests/test_notebook_file.py b/tests/test_notebook_file.py index 61fa76fe..7a024938 100644 --- a/tests/test_notebook_file.py +++ b/tests/test_notebook_file.py @@ -138,6 +138,8 @@ def test_notebook_uses_stable_page_api_not_a_new_app_method(): "aa7ef1230b261531d06c3d5bafc0f933ca32beaf": "PreprocessingNotebook()", # v0.8.0: the same call. "438a2d37625ae7941953fa831914aa5ef5572696": "PreprocessingNotebook()", + # v0.9.0: the same call. + "1d7f241df018fc254ef782ebda8dda0ce4e7686f": "PreprocessingNotebook()", } CHECKOUT_CALL = "PreprocessingNotebook()" """The call of this checkout's code (every run described, no ``describe`` argument).""" diff --git a/tests/test_notebook_setup.py b/tests/test_notebook_setup.py index 0257e744..e45b6ceb 100644 --- a/tests/test_notebook_setup.py +++ b/tests/test_notebook_setup.py @@ -188,7 +188,7 @@ def test_setup_installs_missing_package_from_the_exact_commit(setup_environment, target = command[5] assert target.startswith("morphobricks-preprocessing[notebook] @ git+") assert target.endswith("@" + namespace["RELEASE_REF"]) - assert namespace["RELEASE_REF"] == "438a2d37625ae7941953fa831914aa5ef5572696" + assert namespace["RELEASE_REF"] == "1d7f241df018fc254ef782ebda8dda0ce4e7686f" assert "pinned v0.9.0 candidate" in capsys.readouterr().out From bac58a19260e35346d836bf9c801d4006880f456 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 24 Nov 2026 22:26:19 +0000 Subject: [PATCH 04/13] CI: the release-only check expects one passed case per pinned notebook The release run (45493175126) passed every test (8140 passed) but the release-only step failed: test_release_only_the_preprocessing_pin_is_a_commit_with_this_code is parametrized by notebook (#499), so JUnit names it name[notebook] and the exact-name lookup found nothing. The step now requires name[notebook] to have run and passed for every notebook that has a RELEASE_REF. Workflow only: src, pyproject and the pins are unchanged. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01G3qp9AxjpGPw9xfWAUJNqc --- .github/workflows/ci.yml | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 08f3ffdc..9c0e1025 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -127,13 +127,29 @@ jobs: if: env.MORPHOBRICKS_RELEASE_RUN == '1' shell: python run: | + import json + import pathlib import xml.etree.ElementTree as ET + # The test is parametrized by notebook (name[notebook]): every notebook with a + # RELEASE_REF must have its own case, run and passed. RELEASE_ONLY = {"test_release_only_the_preprocessing_pin_is_a_commit_with_this_code"} - cases = {c.get("name"): c for c in ET.parse("tests.xml").getroot().iter("testcase")} - for name in sorted(RELEASE_ONLY): - case = cases.get(name) - assert case is not None, f"{name} did not run" - assert len(case) == 0 or all(c.tag in ("system-out", "system-err") for c in case), ( - f"{name} did not pass: {[c.tag for c in case]}" + pinned = sorted( + path.stem + for path in pathlib.Path("notebooks").glob("*.ipynb") + if any( + "RELEASE_REF" in "".join(cell.get("source", "")) + for cell in json.loads(path.read_text(encoding="utf-8"))["cells"] + if cell.get("cell_type") == "code" ) - print(f"{name}: passed") + ) + assert pinned, "no notebook has a RELEASE_REF" + cases = {c.get("name"): c for c in ET.parse("tests.xml").getroot().iter("testcase")} + for base in sorted(RELEASE_ONLY): + for notebook in pinned: + name = f"{base}[{notebook}]" + case = cases.get(name) + assert case is not None, f"{name} did not run" + assert len(case) == 0 or all( + c.tag in ("system-out", "system-err") for c in case + ), f"{name} did not pass: {[c.tag for c in case]}" + print(f"{name}: passed") From e78156416129e2b3bb6418526e27049edb11b639 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 24 Nov 2026 23:22:54 +0000 Subject: [PATCH 05/13] Skip the both-spellings test where the file system ignores case (#500) The release run (45500961649) failed on macOS and Windows only here: the test makes Cells/ and cells/ side by side, which a case-insensitive file system cannot hold (FileExistsError). It now skips there, as the other case tests do. Test only: src, pyproject and the pins are unchanged. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01G3qp9AxjpGPw9xfWAUJNqc --- tests/test_segmentation_case_folder.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/test_segmentation_case_folder.py b/tests/test_segmentation_case_folder.py index c15489b8..78752841 100644 --- a/tests/test_segmentation_case_folder.py +++ b/tests/test_segmentation_case_folder.py @@ -74,6 +74,8 @@ def test_a_file_differing_only_in_case_is_refused_too(tmp_path): def test_both_spellings_present_are_refused_even_for_the_exact_one(tmp_path): (tmp_path / "Cells").mkdir() + if (tmp_path / "cells").is_dir(): # macOS, Windows: the same folder + pytest.skip("this file system ignores case: both spellings cannot exist") (tmp_path / "cells").mkdir() # only possible where case counts (Linux) with pytest.raises(SegmentationError, match=CODE): check_mask_type_folder(tmp_path, "Cells") From 62b27909b3c2964d72d19c9abd687bd0d0412e3f Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 25 Nov 2026 17:37:09 +0000 Subject: [PATCH 06/13] Record the v0.9.0 release run in docs/conformance.md The full python tools/check.py on the tree of the merge commit 5e11bc9 (main at c8c3808 with #528, #534, #543, #545, #544, #530, #548, #547 and #546): Ruff clean, 760 files formatted, pytest 8813 passed and 12 skipped, code rules passed; the Spec modules 2122 passed, 0 skipped; the notebook pin and version tests 49 passed. Docs only: this commit is the v0.9.0 preparation commit A that commit B pins. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01WX6rdMV1r5jUPUR94kxV5a --- docs/conformance.md | 40 +++++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/docs/conformance.md b/docs/conformance.md index 626874bf..b31a2fa7 100644 --- a/docs/conformance.md +++ b/docs/conformance.md @@ -13,34 +13,40 @@ A G1-style record of the v0.9.0 release candidate, a minor release, Stable 1: tw pinned at v0.8.0 (#471), the Spec pin at `232fb38` (fast mode, Spec ADR 0006; draft file version 4), run integrity checked at read and open (#480, #489, #490, #491), the conversion and publication fixes (#400, #447, #448, #467, #482, #488, #497), the channel-tag override with its -per-unit review (#376) and the removal of a whole repeat or condition (#283). The run manifest -stays version 5. It does not decide a gate; deciding a gate is the owner's. +per-unit review (#376), the removal of a whole repeat or condition (#283, #535), and the work +merged since: quick fixes A and B (#534, #530), the check-folder and calibration-target fixes +(#528), the follow-ups of #535 and #534 (#543), the linear strict description reader (#545), the +kernel and reader benchmarks (#544), the guided channel step and image-type form (#546), the +restore of an output folder's earlier work (#547) and the four-step Cellpose widget (#548). The +run manifest stays version 5. It does not decide a gate; deciding a gate is the owner's. | | | |---|---| -| Release candidate | Measured on the tree of the merge commit `32be653a82521ab630d96d79e9cd5454bb14904e` (branch `claude/release-v0.9.0`: the first preparation commit `fb8e8a0`, from `main` at `75cde57`, merged with `main` at `b683c7c`, which adds #376 and #283/#535) before this record was added; the record changes only this file, and the commit that adds it is the v0.9.0 preparation commit A (`git diff 32be653 A -- src pyproject.toml` is empty). A keeps the notebooks' `RELEASE_REF` at their v0.8.0-era pins. Commit B then points the `RELEASE_REF` of all three notebooks at A and records the pair in `RELEASE_CALLS`. | +| Release candidate | Measured on the tree of the merge commit `5e11bc9f7aeb5edc8d9d08f046cd5ea485555d1c` (branch `claude/release-v0.9.0` at `e781564`, merged with `main` at `c8c3808`, which adds #528, #534, #543, #545, #544, #530, #548, #547 and #546; no conflicts; the notebooks' `RELEASE_REF`, the `RELEASE_CALLS` entry and the pin assertion are back at their pre-pin values) before this record was added; the record changes only this file, and the commit that adds it is the v0.9.0 preparation commit A (`git diff 5e11bc9 A -- src pyproject.toml` is empty). A keeps the notebooks' `RELEASE_REF` at their v0.8.0-era pins. Commit B then points the `RELEASE_REF` of all three notebooks at A and records the pair in `RELEASE_CALLS`. | | Spec pin | `tests/spec_fixtures/PIN.toml`: MorphoBricks-Spec `232fb38880cc487510532d99dc71d46a27005f23` (moved from `bf68d30` in this release, ADR 0006) | -| Environment | Linux, Python 3.13.18, `pip install --no-cache-dir -e '.[dev,zarr,notebook]'` in a fresh venv (normalization 0.8.0, imagecodecs 2026.11.11, numpy 2.5.5, scipy 1.18.1, tifffile 2026.11.16, zarr 3.4.2, ipywidgets 8.1.9, pytest 9.2.0, ruff 0.17.6; scikit-image not installed); `PYTEST_ADDOPTS` unset; run as root on a case-sensitive file system | -| Commands | `python tools/check.py` (the whole suite in one run); `python -m pytest -q -p no:cacheprovider -rsxX tests/test_spec_*.py`; `python -m pytest -q -p no:cacheprovider -rsxX tests/test_notebook_setup.py tests/test_notebook_file.py` | -| `tools/check.py` | Ruff clean, Ruff format 705 files already formatted, pytest **8042 passed, 19 skipped** (not run, below), 0 failed, code rules passed (exit status 0) | +| Environment | Linux, Python 3.13.18, `pip install --no-cache-dir -e '.[dev,notebook,zarr,he-mask]'` in a fresh venv (CI's extras; normalization 0.8.0, imagecodecs 2026.11.11, numpy 2.5.5, scipy 1.18.1, tifffile 2026.11.16, zarr 3.4.2, scikit-image 0.26.0, ipywidgets 8.1.9, pytest 9.2.0, ruff 0.17.6); `PYTEST_ADDOPTS` unset; run as root on a case-sensitive file system | +| Commands | `python tools/check.py` (the whole suite in one run); `python -m pytest -q -p no:cacheprovider -rs tests/test_spec_*.py`; `python -m pytest -q -p no:cacheprovider -rs tests/test_notebook_setup.py tests/test_notebook_file.py` | +| `tools/check.py` | Ruff clean, Ruff format 760 files already formatted, pytest **8813 passed, 12 skipped** (not run, below), 0 failed, code rules passed (exit status 0) | | Spec modules (`tests/test_spec_*.py`, 30 files) | **2122 passed, 0 skipped, 0 failed** | | Notebook pin and version tests | `test_notebook_setup.py` and `test_notebook_file.py`: **49 passed**, 0 skipped (run on the tree of the merge commit) | -**Not run (19 skips, none in the Spec modules):** 11 tests that need scikit-image (the `he-mask` -extra, not installed in this venv; CI's matrix installs it): `tests/test_he_tissue_array.py:27`, -`tests/test_he_tissue_consumer_gate.py:24`, `tests/test_he_tissue_mask.py:23`, -`tests/test_he_tissue_rule.py:24`, `tests/test_cli_tissue_mask.py:41`, `:61` and `:74`, -`tests/test_notebook_tissue_mask.py:33`, `:81`, `:99` and `:118`; the four environment skips -`tests/test_cli_log.py:166`, `tests/test_folder_rules.py:199` and `:230` (they need a -case-insensitive file system) and `tests/test_discovery.py:665` (cannot run as root); the -editable-install identity test `tests/test_code_identity.py:169`, which CI's `wheel-identity` -job runs on a wheel install; and the 3 release-only freshness tests (`tests/release_run.py:40`, +**Not run (12 skips, none in the Spec modules):** `tests/test_he_tissue_consumer_gate.py:25` +(gate P3 needs fiberfeatures v0.7.0, not installed); the editable-install identity tests +`tests/test_code_identity.py:169`, `tests/test_he_tissue_array.py:286` and +`tests/test_he_tissue_mask.py:500` (preprocessing is an editable install here, never verified; +CI's `wheel-identity` job runs them on a wheel install); three tests that need a +case-insensitive file system, `tests/test_cli_log.py:166` and `tests/test_folder_rules.py:199` +and `:230`; two that cannot run as root, `tests/test_discovery.py:665` and +`tests/test_links_store_unreadable.py:48`; and the 3 release-only freshness tests +(`tests/release_run.py:40`, `test_release_only_the_preprocessing_pin_is_a_commit_with_this_code` for each pinned notebook), which run in the release PR with `MORPHOBRICKS_RELEASE_RUN=1` once commit B has moved the pins. -The behaviours of these skips are **not verified by this run**. +The scikit-image tests ran (the `he-mask` extra is installed). The behaviours of the skips are +**not verified by this run**. **Still the owner's:** the `release` label (the full matrix as a release run), the Colab and -JupyterLab browser check (`docs/colab-release-check.md`) at commit B, before tagging. +JupyterLab browser check (`docs/colab-release-check.md`) at commit B, and the Cellpose stepper +human test (`docs/testing/cellpose-stepper-human-test.md`), before tagging. ## Release record: v0.8.0 (19 November 2026) From ca3b3c681427ff0d8bfb482c725ad3b8aacc4490 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 25 Nov 2026 18:52:16 +0000 Subject: [PATCH 07/13] Point the notebooks at the v0.9.0 preparation commit 62b2790 RELEASE_REF = 62b27909b3c2964d72d19c9abd687bd0d0412e3f (RELEASE_TAG v0.9.0) in all three notebooks (MorphoBricks_Preprocessing, MorphoBricks_Preprocessing_Cellpose and MorphoBricks_Cellpose), with its PreprocessingNotebook() call recorded in RELEASE_CALLS and the test that asserts the ref: the same two-commit pattern as v0.8.0 (438a2d3, 1964746) and the earlier v0.9.0 pair (1d7f241, ad8abad). Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01WX6rdMV1r5jUPUR94kxV5a --- notebooks/MorphoBricks_Cellpose.ipynb | 2 +- notebooks/MorphoBricks_Preprocessing.ipynb | 2 +- notebooks/MorphoBricks_Preprocessing_Cellpose.ipynb | 2 +- tests/test_notebook_file.py | 2 ++ tests/test_notebook_setup.py | 2 +- 5 files changed, 6 insertions(+), 4 deletions(-) diff --git a/notebooks/MorphoBricks_Cellpose.ipynb b/notebooks/MorphoBricks_Cellpose.ipynb index 50f1a715..b1990bc8 100644 --- a/notebooks/MorphoBricks_Cellpose.ipynb +++ b/notebooks/MorphoBricks_Cellpose.ipynb @@ -93,7 +93,7 @@ "# Both are pinned: Cellpose to the release this notebook is made for, preprocessing to the\n", "# immutable source revision that holds this notebook's code.\n", "CELLPOSE_VERSION = \"4.2.1.1\"\n", - "RELEASE_REF = \"2405083dca90fd4c0e96faca42a9c490f182a706\"\n", + "RELEASE_REF = \"62b27909b3c2964d72d19c9abd687bd0d0412e3f\"\n", "REPOSITORY = \"https://github.com/CellMigrationLab/morphobricks-preprocessing.git\"\n", "EXTRAS = \"notebook,zarr\" if \"google.colab\" in sys.modules else \"notebook\"\n", "\n", diff --git a/notebooks/MorphoBricks_Preprocessing.ipynb b/notebooks/MorphoBricks_Preprocessing.ipynb index e8eb1c5c..c8c625cd 100644 --- a/notebooks/MorphoBricks_Preprocessing.ipynb +++ b/notebooks/MorphoBricks_Preprocessing.ipynb @@ -88,7 +88,7 @@ "\n", "# A downloaded/Colab notebook installs this immutable source revision.\n", "RELEASE_TAG = \"v0.9.0\"\n", - "RELEASE_REF = \"438a2d37625ae7941953fa831914aa5ef5572696\"\n", + "RELEASE_REF = \"62b27909b3c2964d72d19c9abd687bd0d0412e3f\"\n", "REPOSITORY = \"https://github.com/CellMigrationLab/morphobricks-preprocessing.git\"\n", "EXTRAS = \"notebook\"\n", "\n", diff --git a/notebooks/MorphoBricks_Preprocessing_Cellpose.ipynb b/notebooks/MorphoBricks_Preprocessing_Cellpose.ipynb index a0cf4d3d..3fc34ba5 100644 --- a/notebooks/MorphoBricks_Preprocessing_Cellpose.ipynb +++ b/notebooks/MorphoBricks_Preprocessing_Cellpose.ipynb @@ -96,7 +96,7 @@ "\n", "# A downloaded/Colab notebook installs this immutable source revision.\n", "RELEASE_TAG = \"v0.9.0\"\n", - "RELEASE_REF = \"3af789160e9ce224a60da4582e9371f028ff47c5\"\n", + "RELEASE_REF = \"62b27909b3c2964d72d19c9abd687bd0d0412e3f\"\n", "REPOSITORY = \"https://github.com/CellMigrationLab/morphobricks-preprocessing.git\"\n", "EXTRAS = \"notebook\"\n", "\n", diff --git a/tests/test_notebook_file.py b/tests/test_notebook_file.py index 61fa76fe..904c9aa8 100644 --- a/tests/test_notebook_file.py +++ b/tests/test_notebook_file.py @@ -138,6 +138,8 @@ def test_notebook_uses_stable_page_api_not_a_new_app_method(): "aa7ef1230b261531d06c3d5bafc0f933ca32beaf": "PreprocessingNotebook()", # v0.8.0: the same call. "438a2d37625ae7941953fa831914aa5ef5572696": "PreprocessingNotebook()", + # v0.9.0: the same call. + "62b27909b3c2964d72d19c9abd687bd0d0412e3f": "PreprocessingNotebook()", } CHECKOUT_CALL = "PreprocessingNotebook()" """The call of this checkout's code (every run described, no ``describe`` argument).""" diff --git a/tests/test_notebook_setup.py b/tests/test_notebook_setup.py index 0257e744..6c7a1ac2 100644 --- a/tests/test_notebook_setup.py +++ b/tests/test_notebook_setup.py @@ -188,7 +188,7 @@ def test_setup_installs_missing_package_from_the_exact_commit(setup_environment, target = command[5] assert target.startswith("morphobricks-preprocessing[notebook] @ git+") assert target.endswith("@" + namespace["RELEASE_REF"]) - assert namespace["RELEASE_REF"] == "438a2d37625ae7941953fa831914aa5ef5572696" + assert namespace["RELEASE_REF"] == "62b27909b3c2964d72d19c9abd687bd0d0412e3f" assert "pinned v0.9.0 candidate" in capsys.readouterr().out From b486baae021bf4259dd14f44e7f59b3798dae937 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 26 Nov 2026 06:07:48 +0000 Subject: [PATCH 08/13] Record the v0.9.0 release run in docs/conformance.md The full python tools/check.py on the tree of the merge commit 86d7674 (main at 316be56 with #566 and #567 on top of the earlier v0.9.0 PRs): Ruff clean, 761 files formatted, pytest 8832 passed and 12 skipped, code rules passed; the Spec modules 2122 passed, 0 skipped; the notebook pin and version tests 49 passed. Docs only: this commit is the v0.9.0 preparation commit A that commit B pins. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01WX6rdMV1r5jUPUR94kxV5a --- docs/conformance.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/conformance.md b/docs/conformance.md index b31a2fa7..6336735b 100644 --- a/docs/conformance.md +++ b/docs/conformance.md @@ -17,16 +17,16 @@ per-unit review (#376), the removal of a whole repeat or condition (#283, #535), merged since: quick fixes A and B (#534, #530), the check-folder and calibration-target fixes (#528), the follow-ups of #535 and #534 (#543), the linear strict description reader (#545), the kernel and reader benchmarks (#544), the guided channel step and image-type form (#546), the -restore of an output folder's earlier work (#547) and the four-step Cellpose widget (#548). The +restore of an output folder's earlier work (#547), the four-step Cellpose widget (#548), and the two blockers of the owner's Colab test, the restore and old-answers scan (#566) and Run progress during the pre-run checks with two linear speed-ups (#567). The run manifest stays version 5. It does not decide a gate; deciding a gate is the owner's. | | | |---|---| -| Release candidate | Measured on the tree of the merge commit `5e11bc9f7aeb5edc8d9d08f046cd5ea485555d1c` (branch `claude/release-v0.9.0` at `e781564`, merged with `main` at `c8c3808`, which adds #528, #534, #543, #545, #544, #530, #548, #547 and #546; no conflicts; the notebooks' `RELEASE_REF`, the `RELEASE_CALLS` entry and the pin assertion are back at their pre-pin values) before this record was added; the record changes only this file, and the commit that adds it is the v0.9.0 preparation commit A (`git diff 5e11bc9 A -- src pyproject.toml` is empty). A keeps the notebooks' `RELEASE_REF` at their v0.8.0-era pins. Commit B then points the `RELEASE_REF` of all three notebooks at A and records the pair in `RELEASE_CALLS`. | +| Release candidate | Measured on the tree of the merge commit `86d76749be9ad58de7dd4a7220a09f633216f170` (branch `claude/release-v0.9.0` at `ca3b3c6`, merged with `main` at `316be56`, which adds #566 and #567 to the earlier #528, #534, #543, #545, #544, #530, #548, #547 and #546; one conflict, in the CHANGELOG, both sides kept; the notebooks' `RELEASE_REF`, the `RELEASE_CALLS` entry and the pin assertion are back at their pre-pin values) before this record was added; the record changes only this file, and the commit that adds it is the v0.9.0 preparation commit A (`git diff 86d7674 A -- src pyproject.toml` is empty). A keeps the notebooks' `RELEASE_REF` at their v0.8.0-era pins. Commit B then points the `RELEASE_REF` of all three notebooks at A and records the pair in `RELEASE_CALLS`. | | Spec pin | `tests/spec_fixtures/PIN.toml`: MorphoBricks-Spec `232fb38880cc487510532d99dc71d46a27005f23` (moved from `bf68d30` in this release, ADR 0006) | | Environment | Linux, Python 3.13.18, `pip install --no-cache-dir -e '.[dev,notebook,zarr,he-mask]'` in a fresh venv (CI's extras; normalization 0.8.0, imagecodecs 2026.11.11, numpy 2.5.5, scipy 1.18.1, tifffile 2026.11.16, zarr 3.4.2, scikit-image 0.26.0, ipywidgets 8.1.9, pytest 9.2.0, ruff 0.17.6); `PYTEST_ADDOPTS` unset; run as root on a case-sensitive file system | | Commands | `python tools/check.py` (the whole suite in one run); `python -m pytest -q -p no:cacheprovider -rs tests/test_spec_*.py`; `python -m pytest -q -p no:cacheprovider -rs tests/test_notebook_setup.py tests/test_notebook_file.py` | -| `tools/check.py` | Ruff clean, Ruff format 760 files already formatted, pytest **8813 passed, 12 skipped** (not run, below), 0 failed, code rules passed (exit status 0) | +| `tools/check.py` | Ruff clean, Ruff format 761 files already formatted, pytest **8832 passed, 12 skipped** (not run, below), 0 failed, code rules passed (exit status 0) | | Spec modules (`tests/test_spec_*.py`, 30 files) | **2122 passed, 0 skipped, 0 failed** | | Notebook pin and version tests | `test_notebook_setup.py` and `test_notebook_file.py`: **49 passed**, 0 skipped (run on the tree of the merge commit) | From 3a1b073f85ce0fb40180575f996af07329ecae76 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 26 Nov 2026 06:30:49 +0000 Subject: [PATCH 09/13] Point the notebooks at the v0.9.0 preparation commit b486baa RELEASE_REF = b486baae021bf4259dd14f44e7f59b3798dae937 (RELEASE_TAG v0.9.0) in all three notebooks (MorphoBricks_Preprocessing, MorphoBricks_Preprocessing_Cellpose and MorphoBricks_Cellpose), with its PreprocessingNotebook() call recorded in RELEASE_CALLS and the test that asserts the ref: the same two-commit pattern as v0.8.0 (438a2d3, 1964746) and the earlier v0.9.0 cuts. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01WX6rdMV1r5jUPUR94kxV5a --- notebooks/MorphoBricks_Cellpose.ipynb | 2 +- notebooks/MorphoBricks_Preprocessing.ipynb | 2 +- notebooks/MorphoBricks_Preprocessing_Cellpose.ipynb | 2 +- tests/test_notebook_file.py | 2 ++ tests/test_notebook_setup.py | 2 +- 5 files changed, 6 insertions(+), 4 deletions(-) diff --git a/notebooks/MorphoBricks_Cellpose.ipynb b/notebooks/MorphoBricks_Cellpose.ipynb index 50f1a715..e367a26c 100644 --- a/notebooks/MorphoBricks_Cellpose.ipynb +++ b/notebooks/MorphoBricks_Cellpose.ipynb @@ -93,7 +93,7 @@ "# Both are pinned: Cellpose to the release this notebook is made for, preprocessing to the\n", "# immutable source revision that holds this notebook's code.\n", "CELLPOSE_VERSION = \"4.2.1.1\"\n", - "RELEASE_REF = \"2405083dca90fd4c0e96faca42a9c490f182a706\"\n", + "RELEASE_REF = \"b486baae021bf4259dd14f44e7f59b3798dae937\"\n", "REPOSITORY = \"https://github.com/CellMigrationLab/morphobricks-preprocessing.git\"\n", "EXTRAS = \"notebook,zarr\" if \"google.colab\" in sys.modules else \"notebook\"\n", "\n", diff --git a/notebooks/MorphoBricks_Preprocessing.ipynb b/notebooks/MorphoBricks_Preprocessing.ipynb index e8eb1c5c..73716b63 100644 --- a/notebooks/MorphoBricks_Preprocessing.ipynb +++ b/notebooks/MorphoBricks_Preprocessing.ipynb @@ -88,7 +88,7 @@ "\n", "# A downloaded/Colab notebook installs this immutable source revision.\n", "RELEASE_TAG = \"v0.9.0\"\n", - "RELEASE_REF = \"438a2d37625ae7941953fa831914aa5ef5572696\"\n", + "RELEASE_REF = \"b486baae021bf4259dd14f44e7f59b3798dae937\"\n", "REPOSITORY = \"https://github.com/CellMigrationLab/morphobricks-preprocessing.git\"\n", "EXTRAS = \"notebook\"\n", "\n", diff --git a/notebooks/MorphoBricks_Preprocessing_Cellpose.ipynb b/notebooks/MorphoBricks_Preprocessing_Cellpose.ipynb index a0cf4d3d..a4729ba9 100644 --- a/notebooks/MorphoBricks_Preprocessing_Cellpose.ipynb +++ b/notebooks/MorphoBricks_Preprocessing_Cellpose.ipynb @@ -96,7 +96,7 @@ "\n", "# A downloaded/Colab notebook installs this immutable source revision.\n", "RELEASE_TAG = \"v0.9.0\"\n", - "RELEASE_REF = \"3af789160e9ce224a60da4582e9371f028ff47c5\"\n", + "RELEASE_REF = \"b486baae021bf4259dd14f44e7f59b3798dae937\"\n", "REPOSITORY = \"https://github.com/CellMigrationLab/morphobricks-preprocessing.git\"\n", "EXTRAS = \"notebook\"\n", "\n", diff --git a/tests/test_notebook_file.py b/tests/test_notebook_file.py index 61fa76fe..c0934fcc 100644 --- a/tests/test_notebook_file.py +++ b/tests/test_notebook_file.py @@ -138,6 +138,8 @@ def test_notebook_uses_stable_page_api_not_a_new_app_method(): "aa7ef1230b261531d06c3d5bafc0f933ca32beaf": "PreprocessingNotebook()", # v0.8.0: the same call. "438a2d37625ae7941953fa831914aa5ef5572696": "PreprocessingNotebook()", + # v0.9.0: the same call. + "b486baae021bf4259dd14f44e7f59b3798dae937": "PreprocessingNotebook()", } CHECKOUT_CALL = "PreprocessingNotebook()" """The call of this checkout's code (every run described, no ``describe`` argument).""" diff --git a/tests/test_notebook_setup.py b/tests/test_notebook_setup.py index 0257e744..5229bcf3 100644 --- a/tests/test_notebook_setup.py +++ b/tests/test_notebook_setup.py @@ -188,7 +188,7 @@ def test_setup_installs_missing_package_from_the_exact_commit(setup_environment, target = command[5] assert target.startswith("morphobricks-preprocessing[notebook] @ git+") assert target.endswith("@" + namespace["RELEASE_REF"]) - assert namespace["RELEASE_REF"] == "438a2d37625ae7941953fa831914aa5ef5572696" + assert namespace["RELEASE_REF"] == "b486baae021bf4259dd14f44e7f59b3798dae937" assert "pinned v0.9.0 candidate" in capsys.readouterr().out From 22439276fc2a474f09c1a061333972040f952574 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 26 Nov 2026 07:59:23 +0000 Subject: [PATCH 10/13] Cellpose Preview: show only this Preview's result, cleared before each run The owner's Colab test of v0.9.0 (26 November 2026): some nuclei results of the first Preview stayed on screen after later Previews. The result (card and figures) was displayed into the step's output area and its clearing was left to the frontend; a Preview that failed (Cellpose, or the model's load) also kept the earlier result in `previewed`, and the Segment step's line still compared with it. The result now lives in one box of widgets (`CellposeWorkflow.preview_box`, the figures as PNG pictures), emptied (and its widgets closed) when Preview is pressed, before the model is loaded; when the channels or the output change; and when a Preview fails. While Cellpose runs, the box says "Running on the preview image...". A Preview still writes and records nothing. Regression tests: tests/test_notebook_cellpose_preview_stale.py. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01WX6rdMV1r5jUPUR94kxV5a --- CHANGELOG.md | 1 + .../notebook_cellpose.py | 52 ++++-- .../notebook_cellpose_form.py | 19 ++- .../notebook_cellpose_preview.py | 20 +++ tests/test_notebook_cellpose_preview_stale.py | 158 ++++++++++++++++++ 5 files changed, 238 insertions(+), 12 deletions(-) create mode 100644 tests/test_notebook_cellpose_preview_stale.py diff --git a/CHANGELOG.md b/CHANGELOG.md index 072997e2..c7ab0576 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ v0.5.1: no run before v0.5.1 is read.) ## Unreleased +- **Cellpose Preview shows only its own result (owner's Colab test of v0.9.0, 26 November 2026).** Some nuclei results of the first Preview stayed on screen after later ones. The result (the card and the figures) was displayed into the step's output area, and its clearing was left to the frontend; a Preview that failed (Cellpose, or the model's load) also kept the earlier result in `previewed` and the Segment step's line still compared with it. The result is now held by one box of widgets (`CellposeWorkflow.preview_box`, the figures as PNG pictures), emptied when Preview is pressed (before the model is loaded), when the channels or output change, and when a Preview fails. While Cellpose runs, the box says "Running on the preview image…". Nothing is written or recorded by a Preview, as before. `tests/test_notebook_cellpose_preview_stale.py`. - **The run shows its own folder and header check, and that check is no longer quadratic (owner Colab test of v0.9.0, 25 November 2026).** On a large mixed-layout experiment, *Run* showed "Preparing: checking the folders and the image headers again · 0:00 elapsed" for 10-15 minutes before the first image: the run checks every header again (bound to its fingerprint) with no progress reported, and the elapsed time was redrawn only on a progress report. The run now reports that check through `RunMode(checking=...)` (preflight's `(phase, done, total, path)`, operational only like `workers`; `run_experiment`'s parameters are unchanged), and the notebook shows each phase and each header of how many ("Preparing: reading the image headers again · 120 of 24,000"), with the elapsed time redrawn every second by `Wait.ticking()` while the run works. While it goes, the notebook says that a cell run meanwhile waits for it, and how to interrupt it. Two steps of the check were O(n²): each image's staging key took `MetadataReport.dtype` (a pass over every header) and the mask-name screen compared each image's name with every other one (`mask_names._mask_owner` now looks up the prefixes of the name). The outputs are byte for byte the same (`plane_histograms.csv`, `experiment_design.csv`, `image_qc.csv` of a 4,800-image three- and two-channel tree); the check before the first image took 30.0 s → 10.3 s for 12,000 images and 72-75 s → 24-27 s for 24,000 on local disk (`tests/test_run_checking_progress.py`). In a `verify_content` run (the notebook's default, and any run on a fresh output folder) the run then reads every image whole for its content SHA-256 before the first pixel is read: on Google Drive that pass, not the header check, is what took minutes (owner: about 200 images, 10-15 minutes). It is now reported too, as the phase `contents` (`run.phases.CONTENTS`, "Preparing: reading each image whole for its content SHA-256 · 12 of 200"); what is read and verified is unchanged. - **Earlier work that does not record its experiment folder no longer leaves the stepper at a dead end (owner's Colab test of v0.9.0 at ca3b3c6).** An output folder holding only saved answers (here an older version's `morphobricks.draft.json`) showed *"The experiment folder it is of is not recorded … Enter the experiment folder and click Check folder"*: the stepper has no *Check folder* button (its check, *Looks right: read all image headers*, stays disabled until **Scan the folders**), and entering the folder showed the same message again, with no scan and no picture. Now the experiment folder entered is scanned at once on the stepper (folder walk and one picture; nothing is written), the message names the stepper's own buttons, and the check, on the user's click, reads the saved answers as always. Saved answers written by another version of the software (`DraftFileError` `unknown_version`, `unknown_key` or `spec_commit_mismatch`; the owner's file is format 3, `unknown_version`) are not earlier work (`EarlierWork.old_answers`): one line says they are not used and the file is left as it is, and the experiment folder entered is scanned and shown as above (an early **Scan the folders** click, before the typed folder reached the kernel, is made good when it arrives). The same scan follows a record and a run that name different folders. Each message names the buttons of the layout shown (the stacked pages say **Check folder**). Tests: `tests/test_notebook_restore.py`. - **A saved repeat order is never replaced by an abandoned *Yes* (review of #546 at e40f1ad).** On a reopened per-repeat draft, picking *Yes*, filling its row with rep1's order and going back to *No, per repeat folder* showed rep1's order in every repeat row, under "Pre-answered from your saved tags", and one Submit published it for every unit. A row's own saved tags now rank above a broader choice of the session (`channel_scope.seed`: the row's choice, its saved tags, a broader choice, the header names), and the "Pre-answered" note goes at the first change of the answer or of a row. Tests: `tests/test_notebook_channel_guide_reopen.py`, `tests/test_channel_scope.py`. diff --git a/src/morphobricks_preprocessing/notebook_cellpose.py b/src/morphobricks_preprocessing/notebook_cellpose.py index d9a8c452..2f80bcfa 100644 --- a/src/morphobricks_preprocessing/notebook_cellpose.py +++ b/src/morphobricks_preprocessing/notebook_cellpose.py @@ -30,10 +30,10 @@ _card, ) from .notebook_cellpose_download import quiet_cellpose -from .notebook_cellpose_preview import MaskResult, preview_figures +from .notebook_cellpose_preview import MaskResult, preview_images from .notebook_progress import progress_html from .notebook_stop import CellStop -from .notebook_style import STYLE_CSS, table, tiles +from .notebook_style import STYLE_CSS, status, table, tiles from .run_inputs import Fov, RunInputs from .segmentation_cellpose_run import ( channel_layouts, @@ -117,6 +117,7 @@ def __init__(self) -> None: self.result: cp.BatchResult | None = None self.results: dict[str, cp.BatchResult] = {} self.previewed: list[MaskResult] = [] + self.preview_box = widgets.VBox() # the last Preview's result, and nothing else self.shown: list[str] = [] self.on_masks_written: Callable[[cp.BatchResult], object] | None = None self.register_with: str | None = None @@ -147,6 +148,20 @@ def drop_choice(self) -> None: """Forget the channels, the mask types and every loaded model (the choice changed).""" self.picker = self.loaded = self.nuclei_loaded = self.nuclei_settings = None self.mask_types = {} + self.clear_preview() # a preview of other channels says nothing of the next ones + + def clear_preview(self) -> None: + """Take the last Preview's result off the screen and out of :attr:`previewed`.""" + self.previewed = [] + shown, self.preview_box.children = self.preview_box.children, () + for widget in shown: # their pictures leave the kernel too + widget.close() + + def _mount_preview(self) -> None: + """Show :attr:`preview_box` in the cell that previews (a form shows it on its page).""" + if not self.shown: + display(widgets.HTML(STYLE_CSS)) + display(self.preview_box) def model_for(self, output: str) -> tuple[cp.LoadedModel, cp.Settings]: """Return the model and the settings that segment the masks of ``output``. @@ -382,8 +397,21 @@ def _load_model( def preview(self, image: str = "") -> None: """Segment one image and show it with the outlines; nothing is written (cell 6). - For Both, the image is segmented twice, the cells and the nuclei, each shown. + For Both, the image is segmented twice, the cells and the nuclei, each shown. Every + result of an earlier Preview is taken off the screen first (:meth:`clear_preview`), and + a Preview that fails shows none: what is shown is always this Preview's result. While + Cellpose runs, one line says which model runs. """ + self.clear_preview() + self._mount_preview() + try: + self._preview(image) + except BaseException: # a refusal, any error or an interrupt: no result is shown + self.clear_preview() + raise + + def _preview(self, image: str) -> None: + """Segment ``image`` and put this Preview's result in :attr:`preview_box`.""" self._need("model") targets = self.picker.current_targets() fovs = self.inputs.fovs() @@ -395,24 +423,26 @@ def preview(self, image: str = "") -> None: ) fov = by_path[image.strip()] if image.strip() else (self.first_without_mask() or fovs[0]) check_manifest(self.inputs, self.run_manifest_sha256) # the run opened, still + models = [self.model_for(target.output) for target in targets] + names = " and ".join(dict.fromkeys(loaded.name for loaded, _ in models)) + running = status("info", f"Running {names} on the preview image…") + self.preview_box.children = (widgets.HTML(f"
{running}
"),) results, lines = [], [] - for target in targets: - loaded, settings = self.model_for(target.output) + for target, (loaded, settings) in zip(targets, models, strict=True): stack = target.plan.read(fov) labels, flows = cp.evaluate(loaded, settings, stack) named = tuple(zip(target.channel_ids, target.roles, strict=True)) result = MaskResult(OUTPUT_NAMES[target.output], stack, named, labels, flows) results.append(result) lines.append(f"{result.name}: {result.objects} objects; diameter {_diameter(settings)}") - self._show( - _card("info", f"Preview of {fov.relative_path} (nothing is written)", tuple(lines)) - ) + card = _card("info", f"Preview of {fov.relative_path} (nothing is written)", tuple(lines)) try: - figures = preview_figures(results) + pictures = preview_images(results) except ValueError as exc: raise SegmentationError(str(exc)) from exc - for figure in figures: - display(figure) + self.shown.append(card.value) + self.clear_preview() # the line of the model running + self.preview_box.children = (card, *pictures) self.previewed = results def first_without_mask(self) -> Fov | None: diff --git a/src/morphobricks_preprocessing/notebook_cellpose_form.py b/src/morphobricks_preprocessing/notebook_cellpose_form.py index 771abc56..e9bdb37b 100644 --- a/src/morphobricks_preprocessing/notebook_cellpose_form.py +++ b/src/morphobricks_preprocessing/notebook_cellpose_form.py @@ -400,11 +400,28 @@ def preview_form(self) -> StepForm: cards, "Preview", "eye", - lambda: self._with_form_settings(lambda: self._preview_and_note(image.value or "")), + lambda: self._preview_from_form(image.value or ""), {"preview_image": image}, ) + # Under the button's output (the model's loading), the last Preview's result only. + form.body.children = [*form.body.children, self.preview_box] return self._keep("preview", form) + def _mount_preview(self) -> None: + """Show the preview's box in the cell, unless the Preview form already holds it.""" + if "preview" not in self.forms: + super()._mount_preview() + + def _preview_from_form(self, image: str) -> None: + """Press of **Preview**: take the last result off first, then load if needed and preview. + + Cleared before the model is checked or loaded, so a refused or failed load leaves no + earlier result on screen, nor the Segment step's line saying what it used. + """ + self.clear_preview() + self._previewed_with = None + self._with_form_settings(lambda: self._preview_and_note(image)) + def segment_form(self) -> StepForm: """Show the form of cell 7: overwrite (off by default) and the button that segments.""" overwrite = widgets.Checkbox(value=False, description="Replace masks that already exist") diff --git a/src/morphobricks_preprocessing/notebook_cellpose_preview.py b/src/morphobricks_preprocessing/notebook_cellpose_preview.py index 2aa7c8a5..0c18d881 100644 --- a/src/morphobricks_preprocessing/notebook_cellpose_preview.py +++ b/src/morphobricks_preprocessing/notebook_cellpose_preview.py @@ -9,13 +9,20 @@ A preview holds a list of :class:`MaskResult`: one now, a cell mask or a nuclei mask; the *Both* output (#440) adds a second result and the figures follow, with no change here. + +The figures are shown as PNG pictures in widgets (:func:`preview_images`), never displayed into +an output area: the preview's box then holds the last Preview's result only, in every frontend +(owner, 26 November 2026: in Colab, nuclei figures of the first Preview stayed on screen after +later ones). """ from __future__ import annotations import importlib +import io from dataclasses import dataclass +import ipywidgets as widgets import numpy as np from matplotlib.figure import Figure @@ -90,3 +97,16 @@ def segmentation_figure(result: MaskResult) -> Figure: def preview_figures(results: list[MaskResult]) -> list[Figure]: """Return the preview's figures: the channels, then Cellpose's panels, for each result.""" return [figure for r in results for figure in (channel_figure(r), segmentation_figure(r))] + + +def figure_image(figure: Figure) -> widgets.Image: + """Return ``figure`` as a PNG picture widget, at most 99% of its box wide..""" + buffer = io.BytesIO() + figure.savefig(buffer, format="png", bbox_inches="tight") + layout = widgets.Layout(max_width="99%", height="auto") + return widgets.Image(value=buffer.getvalue(), format="png", layout=layout) + + +def preview_images(results: list[MaskResult]) -> list[widgets.Image]: + """Return the figures of :func:`preview_figures` as picture widgets, in the same order.""" + return [figure_image(figure) for figure in preview_figures(results)] diff --git a/tests/test_notebook_cellpose_preview_stale.py b/tests/test_notebook_cellpose_preview_stale.py new file mode 100644 index 00000000..fd99b877 --- /dev/null +++ b/tests/test_notebook_cellpose_preview_stale.py @@ -0,0 +1,158 @@ +"""Every Preview shows its own result only: nothing of an earlier Preview stays (owner, 26 Nov). + +The owner's Colab report: some nuclei results of the first Preview were not cleared after +pressing Preview several times. The result was displayed into the step's output area, and +its clearing was left to the frontend; a Preview that failed (the model, or its load) also +left the earlier result in ``previewed`` and the Segment step's line saying what "the last +Preview" used. The result is now held by one box of widgets (``workflow.preview_box``), +emptied before each Preview starts, before the model is loaded, and when the channels change; +a failed Preview leaves it empty. These cases drive ``segmentation_app`` headless with the +stand-in Cellpose (``tests/cellpose_stub.py``) on a run whose every image has DNA and TUB. +""" + +import ipywidgets as widgets +import pytest + +from cellpose_stub import install, two_channel_run +from morphobricks_preprocessing.notebook_cellpose_app import segmentation_app +from morphobricks_preprocessing.segmentation_record import record_path + + +@pytest.fixture +def stub(monkeypatch, tmp_path): + return install(monkeypatch, tmp_path) + + +@pytest.fixture +def run(tmp_path): + return two_channel_run(tmp_path / "run") + + +def walk(widget): + yield widget + for child in getattr(widget, "children", ()): + yield from walk(child) + + +def texts(widget): + return " ".join(str(w.value) for w in walk(widget) if isinstance(w, widgets.HTML)) + + +def pictures(widget): + return [w for w in walk(widget) if isinstance(w, widgets.Image)] + + +def choose(app, output): + form = app.workflow.forms["channels"] + form.fields["output"].value = output + form.button.click() + assert form.refusal == "", form.refusal + picker = app.workflow.picker + picker.cell.value = "TUB" + if output == "both": + picker.nuclear.value = "DNA" + + +def both_previewed(run): + """An app whose Preview showed the cells and the nuclei of Both once.""" + app = segmentation_app(run.out, run.masks) + choose(app, "both") + app.workflow.forms["model"].fields["device"].value = "cpu" + press_preview(app) + assert [r.name for r in app.workflow.previewed] == ["Cell mask", "Nuclei mask"] + assert "Segment will use what the last Preview used" in app.workflow._summary.value + return app + + +def press_preview(app): + form = app.workflow.forms["preview"] + form.submit() + assert form.refusal == "", form.refusal + return form + + +def snapshot(folder): + if not folder.exists(): + return None + return sorted((str(p.relative_to(folder)), p.stat().st_mtime_ns) for p in folder.rglob("*")) + + +def test_the_preview_page_holds_the_last_previews_result_only(run, stub): + app = both_previewed(run) + workflow = app.workflow + assert "Nuclei mask" in texts(workflow.preview_box) + page = app.stepper.pages[2] # Model and preview + assert sum(w is workflow.preview_box for w in walk(page)) == 1 + assert len(pictures(page)) == 4 # channels and Cellpose's panels, for cells and nuclei + workflow.forms["model"].fields["diameter"].value = "17" + press_preview(app) + shown = texts(workflow.preview_box) + assert shown.count("Preview of") == 1 and shown.count("Nuclei mask") == 1 + assert "diameter 17" in shown and len(pictures(page)) == 4 + + +def test_a_preview_of_cells_only_shows_no_nuclei_of_the_preview_of_both(run, stub): + app = both_previewed(run) + workflow = app.workflow + choose(app, "cells") # the output changed: the Both preview goes at once + assert workflow.previewed == [] + assert workflow.preview_box.children == () + press_preview(app) + assert [r.name for r in workflow.previewed] == ["Cell mask"] + assert "Nuclei" not in texts(workflow.preview_box) + assert len(pictures(workflow.preview_box)) == 2 + assert "Nuclei" not in texts(app.stepper.pages[2]) + + +def test_a_preview_whose_model_fails_leaves_no_earlier_result(run, stub): + app = both_previewed(run) + workflow = app.workflow + + def fail_nuclei(stack): + if stack.shape[0] == 1: + raise RuntimeError("out of memory") + + stub.fail = fail_nuclei + with pytest.raises(RuntimeError, match="out of memory"): # the output area shows it + workflow.forms["preview"].submit() + assert workflow.previewed == [] + assert "not previewed yet" in workflow._summary.value + assert workflow.preview_box.children == () + + +def test_a_preview_whose_model_does_not_load_leaves_no_earlier_result(run, stub): + app = both_previewed(run) + workflow = app.workflow + workflow.forms["model"].fields["device"].value = "cuda" # no GPU: the load is refused + form = workflow.forms["preview"] + form.submit() + assert form.refusal and workflow.loaded is None + assert workflow.previewed == [] + assert "not previewed yet" in workflow._summary.value + assert workflow.preview_box.children == () + + +def test_a_line_names_the_model_while_cellpose_runs_on_the_preview_image(run, stub): + app = segmentation_app(run.out, run.masks) + choose(app, "both") + model = app.workflow.forms["model"].fields + model["device"].value = "cpu" + model["separate_nuclei"].value, model["nuclei_model"].value = True, "cpsam" + seen = [] + stub.fail = lambda stack: seen.append(texts(app.workflow.preview_box)) + press_preview(app) + assert seen and all("on the preview image" in line for line in seen) + assert all("cpsam_v2 and cpsam" in line for line in seen) + assert "on the preview image" not in texts(app.workflow.preview_box) # replaced by the result + + +def test_previews_write_nothing(run, stub): + before = snapshot(run.masks) + app = both_previewed(run) + app.workflow.forms["model"].fields["diameter"].value = "17" + press_preview(app) + choose(app, "cells") + press_preview(app) + assert snapshot(run.masks) == before + assert app.workflow.results == {} and app.workflow.result is None + assert all(not record_path(run.masks, t).exists() for t in ("Cells", "Nuclei")) From 1d43cd3d2af2bbf300e2af94e3887e86605b364f Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 26 Nov 2026 11:52:16 +0000 Subject: [PATCH 11/13] Cellpose Preview: also clear it when the channels or the model fields change Review of #576: the channel dropdowns are live (Preview and Segment re-read them with current_targets()), but changing them after a Preview left the result on screen and in `previewed`; with a Both preview shown, removing the nuclear channel kept "Nuclei" on screen. The same was true of the model step's fields, which Preview and Segment also read when pressed. The preview is now also cleared when a channel dropdown, a channel number or By tag/number changes (ChannelPicker.on_edit; Segment's line then says "not previewed yet"), when a field of the model step changes (Segment's line still names what changed since the last Preview), and in the cell-by-cell workflow when the settings change, a model is loaded or the nuclei go back to the cells' model. The style sheet is shown once even when the first Preview fails (it was keyed on a card having been shown). figure_image's docstring: one period. Regression tests: tests/test_notebook_cellpose_preview_stale.py (5 new). Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01WX6rdMV1r5jUPUR94kxV5a --- CHANGELOG.md | 2 +- .../notebook_cellpose.py | 32 ++++++++-- .../notebook_cellpose_channels.py | 9 +++ .../notebook_cellpose_form.py | 12 +++- .../notebook_cellpose_preview.py | 2 +- tests/test_notebook_cellpose_preview_stale.py | 60 +++++++++++++++++++ 6 files changed, 108 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c7ab0576..fde1758b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ v0.5.1: no run before v0.5.1 is read.) ## Unreleased -- **Cellpose Preview shows only its own result (owner's Colab test of v0.9.0, 26 November 2026).** Some nuclei results of the first Preview stayed on screen after later ones. The result (the card and the figures) was displayed into the step's output area, and its clearing was left to the frontend; a Preview that failed (Cellpose, or the model's load) also kept the earlier result in `previewed` and the Segment step's line still compared with it. The result is now held by one box of widgets (`CellposeWorkflow.preview_box`, the figures as PNG pictures), emptied when Preview is pressed (before the model is loaded), when the channels or output change, and when a Preview fails. While Cellpose runs, the box says "Running on the preview image…". Nothing is written or recorded by a Preview, as before. `tests/test_notebook_cellpose_preview_stale.py`. +- **Cellpose Preview shows only its own result (owner's Colab test of v0.9.0, 26 November 2026).** Some nuclei results of the first Preview stayed on screen after later ones. The result (the card and the figures) was displayed into the step's output area, and its clearing was left to the frontend; a Preview that failed (Cellpose, or the model's load) also kept the earlier result in `previewed` and the Segment step's line still compared with it. The result is now held by one box of widgets (`CellposeWorkflow.preview_box`, the figures as PNG pictures), emptied when Preview is pressed (before the model is loaded); when the output or a mask type changes; when a channel dropdown, a channel number or By tag/number changes (Preview and Segment re-read them; Segment's line then says "not previewed yet"); when a field of the model step changes (model, device, diameter, thresholds, batch size, the nuclei's own model; Segment's line still names what changed since the last Preview); when a model is loaded; and when a Preview fails. The example image dropdown does not clear it: the result names its image. While Cellpose runs, the box says "Running on the preview image…". Nothing is written or recorded by a Preview, as before. `tests/test_notebook_cellpose_preview_stale.py`. - **The run shows its own folder and header check, and that check is no longer quadratic (owner Colab test of v0.9.0, 25 November 2026).** On a large mixed-layout experiment, *Run* showed "Preparing: checking the folders and the image headers again · 0:00 elapsed" for 10-15 minutes before the first image: the run checks every header again (bound to its fingerprint) with no progress reported, and the elapsed time was redrawn only on a progress report. The run now reports that check through `RunMode(checking=...)` (preflight's `(phase, done, total, path)`, operational only like `workers`; `run_experiment`'s parameters are unchanged), and the notebook shows each phase and each header of how many ("Preparing: reading the image headers again · 120 of 24,000"), with the elapsed time redrawn every second by `Wait.ticking()` while the run works. While it goes, the notebook says that a cell run meanwhile waits for it, and how to interrupt it. Two steps of the check were O(n²): each image's staging key took `MetadataReport.dtype` (a pass over every header) and the mask-name screen compared each image's name with every other one (`mask_names._mask_owner` now looks up the prefixes of the name). The outputs are byte for byte the same (`plane_histograms.csv`, `experiment_design.csv`, `image_qc.csv` of a 4,800-image three- and two-channel tree); the check before the first image took 30.0 s → 10.3 s for 12,000 images and 72-75 s → 24-27 s for 24,000 on local disk (`tests/test_run_checking_progress.py`). In a `verify_content` run (the notebook's default, and any run on a fresh output folder) the run then reads every image whole for its content SHA-256 before the first pixel is read: on Google Drive that pass, not the header check, is what took minutes (owner: about 200 images, 10-15 minutes). It is now reported too, as the phase `contents` (`run.phases.CONTENTS`, "Preparing: reading each image whole for its content SHA-256 · 12 of 200"); what is read and verified is unchanged. - **Earlier work that does not record its experiment folder no longer leaves the stepper at a dead end (owner's Colab test of v0.9.0 at ca3b3c6).** An output folder holding only saved answers (here an older version's `morphobricks.draft.json`) showed *"The experiment folder it is of is not recorded … Enter the experiment folder and click Check folder"*: the stepper has no *Check folder* button (its check, *Looks right: read all image headers*, stays disabled until **Scan the folders**), and entering the folder showed the same message again, with no scan and no picture. Now the experiment folder entered is scanned at once on the stepper (folder walk and one picture; nothing is written), the message names the stepper's own buttons, and the check, on the user's click, reads the saved answers as always. Saved answers written by another version of the software (`DraftFileError` `unknown_version`, `unknown_key` or `spec_commit_mismatch`; the owner's file is format 3, `unknown_version`) are not earlier work (`EarlierWork.old_answers`): one line says they are not used and the file is left as it is, and the experiment folder entered is scanned and shown as above (an early **Scan the folders** click, before the typed folder reached the kernel, is made good when it arrives). The same scan follows a record and a run that name different folders. Each message names the buttons of the layout shown (the stacked pages say **Check folder**). Tests: `tests/test_notebook_restore.py`. - **A saved repeat order is never replaced by an abandoned *Yes* (review of #546 at e40f1ad).** On a reopened per-repeat draft, picking *Yes*, filling its row with rep1's order and going back to *No, per repeat folder* showed rep1's order in every repeat row, under "Pre-answered from your saved tags", and one Submit published it for every unit. A row's own saved tags now rank above a broader choice of the session (`channel_scope.seed`: the row's choice, its saved tags, a broader choice, the header names), and the "Pre-answered" note goes at the first change of the answer or of a row. Tests: `tests/test_notebook_channel_guide_reopen.py`, `tests/test_channel_scope.py`. diff --git a/src/morphobricks_preprocessing/notebook_cellpose.py b/src/morphobricks_preprocessing/notebook_cellpose.py index 2f80bcfa..e8dab93c 100644 --- a/src/morphobricks_preprocessing/notebook_cellpose.py +++ b/src/morphobricks_preprocessing/notebook_cellpose.py @@ -119,14 +119,14 @@ def __init__(self) -> None: self.previewed: list[MaskResult] = [] self.preview_box = widgets.VBox() # the last Preview's result, and nothing else self.shown: list[str] = [] + self.styled = False # the style sheet is shown (once, by the first step or Preview) self.on_masks_written: Callable[[cp.BatchResult], object] | None = None self.register_with: str | None = None self.folders_refused = "" # the masks folder refusal of the last Open the run, or "" def _show(self, widget: widgets.Widget) -> None: """Display ``widget`` (the style sheet goes first, once).""" - if not self.shown: - display(widgets.HTML(STYLE_CSS)) + self._style() self.shown.append(getattr(widget, "value", "")) display(widget) @@ -150,6 +150,10 @@ def drop_choice(self) -> None: self.mask_types = {} self.clear_preview() # a preview of other channels says nothing of the next ones + def channels_edited(self) -> None: + """Take the preview off: a channel dropdown or number changed (Preview re-reads them).""" + self.clear_preview() + def clear_preview(self) -> None: """Take the last Preview's result off the screen and out of :attr:`previewed`.""" self.previewed = [] @@ -159,10 +163,15 @@ def clear_preview(self) -> None: def _mount_preview(self) -> None: """Show :attr:`preview_box` in the cell that previews (a form shows it on its page).""" - if not self.shown: - display(widgets.HTML(STYLE_CSS)) + self._style() display(self.preview_box) + def _style(self) -> None: + """Display the style sheet, the first time only.""" + if not self.styled: + self.styled = True + display(widgets.HTML(STYLE_CSS)) + def model_for(self, output: str) -> tuple[cp.LoadedModel, cp.Settings]: """Return the model and the settings that segment the masks of ``output``. @@ -252,6 +261,7 @@ def choose_channels( self.drop_choice() self.mask_types, self.mask_type = types, next(iter(types.values())) self.picker = ChannelPicker(self.inputs, output) + self.picker.on_edit(self.channels_edited) # the dropdowns are live: Preview re-reads them lines = tuple( f"{OUTPUT_NAMES[o]}, mask type {t}: {len(todo[o])} of {len(self.inputs.fovs())} " "images have no mask yet" @@ -273,7 +283,10 @@ def set_settings( Normalisation is not a choice: it is always Cellpose's own, per image (1st to 99th percentile of each channel). """ - self.settings = _settings(diameter, flow_threshold, cellprob_threshold, batch_size) + settings = _settings(diameter, flow_threshold, cellprob_threshold, batch_size) + if settings != self.settings: # a preview with other settings is taken off + self.clear_preview() + self.settings = settings @stops def set_nuclei_settings( @@ -285,7 +298,10 @@ def set_nuclei_settings( ) -> None: """Check the settings of a separate nuclei model (output Both, cell 5's Advanced).""" self._need_both() - self.nuclei_settings = _settings(diameter, flow_threshold, cellprob_threshold, batch_size) + settings = _settings(diameter, flow_threshold, cellprob_threshold, batch_size) + if settings != self.nuclei_settings: # a preview with other settings is taken off + self.clear_preview() + self.nuclei_settings = settings @stops def load( @@ -302,6 +318,7 @@ def load( if self.settings is None: raise SegmentationError("Set the settings first: press Load the model.") self.loaded = None + self.clear_preview() # a preview of the model loaded before is taken off self.loaded = self._load_model( model, custom_model_file, device, download_weights, install_dino, self.settings ) @@ -323,6 +340,7 @@ def load_nuclei( "step)." ) self.nuclei_loaded = None + self.clear_preview() # a preview of the nuclei model loaded before is taken off self.nuclei_loaded = self._load_model( model, custom_model_file, device, download_weights, install_dino, self.nuclei_settings ) @@ -339,6 +357,8 @@ def _need_both(self) -> None: def same_model_for_nuclei(self) -> None: """Segment the nuclei of Both with the model and the settings of the cells.""" + if self.nuclei_loaded is not None or self.nuclei_settings is not None: + self.clear_preview() # a preview of the nuclei's own model is taken off self.nuclei_loaded = self.nuclei_settings = None def _load_model( diff --git a/src/morphobricks_preprocessing/notebook_cellpose_channels.py b/src/morphobricks_preprocessing/notebook_cellpose_channels.py index 8a9ffb9d..053a6e76 100644 --- a/src/morphobricks_preprocessing/notebook_cellpose_channels.py +++ b/src/morphobricks_preprocessing/notebook_cellpose_channels.py @@ -9,6 +9,7 @@ from __future__ import annotations import html +from collections.abc import Callable from dataclasses import dataclass import ipywidgets as widgets @@ -205,6 +206,14 @@ def current_plan(self) -> SegmentationPlan: """ return self.current_targets()[0].plan + def on_edit(self, callback: Callable[[], object]) -> None: + """Call ``callback`` whenever a dropdown, a channel number or the By choice changes. + + Not when a step re-reads the choice (:meth:`current_targets`): only an edit. + """ + for field in (*self.dropdowns, *self.number_fields, self.by): + field.observe(lambda _: callback(), names="value") + def current_targets(self) -> tuple[MaskTarget, ...]: """Resolve the dropdowns as they are now and return every mask to make, or refuse. diff --git a/src/morphobricks_preprocessing/notebook_cellpose_form.py b/src/morphobricks_preprocessing/notebook_cellpose_form.py index e9bdb37b..5c1f22c1 100644 --- a/src/morphobricks_preprocessing/notebook_cellpose_form.py +++ b/src/morphobricks_preprocessing/notebook_cellpose_form.py @@ -293,6 +293,12 @@ def _drop_choice(self, fields: dict[str, widgets.Widget], changed: widgets.HTML) "warn", f"Changed: press Choose the channels again, then {then}." ) + def channels_edited(self) -> None: + """Take the preview off; Segment's line no longer says it used these channels.""" + super().channels_edited() + self._previewed_with = None + self._refresh_summary() + def drop_choice(self) -> None: """Forget the channels, the mask types and every loaded model (the choice changed).""" super().drop_choice() @@ -460,7 +466,11 @@ def _preview_and_note(self, image: str) -> None: self._refresh_summary() def _model_fields_changed(self) -> None: - """Update what shows the model form's values: Segment's line and the step strip.""" + """Take the preview off (Preview and Segment read these fields), then update the line. + + What the last Preview used is kept: Segment's line still says what changed since. + """ + self.clear_preview() self._refresh_summary() for callback in self.on_change: callback() diff --git a/src/morphobricks_preprocessing/notebook_cellpose_preview.py b/src/morphobricks_preprocessing/notebook_cellpose_preview.py index 0c18d881..3a39533e 100644 --- a/src/morphobricks_preprocessing/notebook_cellpose_preview.py +++ b/src/morphobricks_preprocessing/notebook_cellpose_preview.py @@ -100,7 +100,7 @@ def preview_figures(results: list[MaskResult]) -> list[Figure]: def figure_image(figure: Figure) -> widgets.Image: - """Return ``figure`` as a PNG picture widget, at most 99% of its box wide..""" + """Return ``figure`` as a PNG picture widget, at most 99% of its box wide.""" buffer = io.BytesIO() figure.savefig(buffer, format="png", bbox_inches="tight") layout = widgets.Layout(max_width="99%", height="auto") diff --git a/tests/test_notebook_cellpose_preview_stale.py b/tests/test_notebook_cellpose_preview_stale.py index fd99b877..b006149f 100644 --- a/tests/test_notebook_cellpose_preview_stale.py +++ b/tests/test_notebook_cellpose_preview_stale.py @@ -15,6 +15,7 @@ from cellpose_stub import install, two_channel_run from morphobricks_preprocessing.notebook_cellpose_app import segmentation_app +from morphobricks_preprocessing.notebook_cellpose_channels import BY_NUMBER from morphobricks_preprocessing.segmentation_record import record_path @@ -156,3 +157,62 @@ def test_previews_write_nothing(run, stub): assert snapshot(run.masks) == before assert app.workflow.results == {} and app.workflow.result is None assert all(not record_path(run.masks, t).exists() for t in ("Cells", "Nuclei")) + + +# Review of #576: the channel dropdowns are live (Preview and Segment re-read them), and so are +# the model step's fields; any change takes the preview off, as a change of output does. + + +def test_removing_the_nuclear_channel_takes_the_preview_of_both_off(run, stub): + app = both_previewed(run) + workflow = app.workflow + workflow.picker.nuclear.value = "" + assert workflow.previewed == [] + assert workflow.preview_box.children == () + assert "Nuclei" not in texts(app.stepper.pages[2]) + assert "not previewed yet" in workflow._summary.value + + +def test_changing_the_cell_channel_takes_the_preview_off(run, stub): + app = both_previewed(run) + workflow = app.workflow + workflow.picker.cell.value = "DNA" + assert workflow.previewed == [] + assert workflow.preview_box.children == () + assert "not previewed yet" in workflow._summary.value + workflow.picker.cell.value = "TUB" + press_preview(app) # a new Preview shows its own result again + assert [r.name for r in workflow.previewed] == ["Cell mask", "Nuclei mask"] + + +def test_a_channel_number_takes_the_preview_off(run, stub): + app = both_previewed(run) + workflow = app.workflow + workflow.picker.by.value = BY_NUMBER + assert workflow.previewed == [] and workflow.preview_box.children == () + + +def test_changing_a_model_setting_takes_the_preview_off_and_names_the_change(run, stub): + app = both_previewed(run) + workflow = app.workflow + workflow.forms["model"].fields["diameter"].value = "17" + assert workflow.previewed == [] + assert workflow.preview_box.children == () + assert "Changed since the last Preview" in workflow._summary.value + + +def test_the_style_sheet_is_shown_once_after_a_failed_first_preview(run, stub, monkeypatch): + from morphobricks_preprocessing import notebook_cellpose + from morphobricks_preprocessing.notebook_style import STYLE_CSS + + sheets = [] + monkeypatch.setattr( + notebook_cellpose, + "display", + lambda w: sheets.append(w) if getattr(w, "value", None) == STYLE_CSS else None, + ) + workflow = notebook_cellpose.CellposeWorkflow() + workflow._mount_preview() # a first Preview, refused: no card shown + workflow._mount_preview() + workflow._show(widgets.HTML("a card")) + assert len(sheets) == 1 From 338629cff2116952224ec60a98ac78b672f88ff6 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 26 Nov 2026 16:45:47 +0000 Subject: [PATCH 12/13] Record the v0.9.0 release run in docs/conformance.md The full python tools/check.py on the tree of the merge commit 8125f83 (the release branch with the head 1d43cd3 of #576 merged; main is not merged): Ruff clean, 762 files formatted, pytest 8843 passed and 12 skipped, code rules passed; the Spec modules 2122 passed, 0 skipped; the notebook pin and version tests 49 passed. Docs only: this commit is the v0.9.0 preparation commit A that commit B pins. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01WX6rdMV1r5jUPUR94kxV5a --- docs/conformance.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/conformance.md b/docs/conformance.md index 6336735b..60c3f78d 100644 --- a/docs/conformance.md +++ b/docs/conformance.md @@ -17,16 +17,16 @@ per-unit review (#376), the removal of a whole repeat or condition (#283, #535), merged since: quick fixes A and B (#534, #530), the check-folder and calibration-target fixes (#528), the follow-ups of #535 and #534 (#543), the linear strict description reader (#545), the kernel and reader benchmarks (#544), the guided channel step and image-type form (#546), the -restore of an output folder's earlier work (#547), the four-step Cellpose widget (#548), and the two blockers of the owner's Colab test, the restore and old-answers scan (#566) and Run progress during the pre-run checks with two linear speed-ups (#567). The +restore of an output folder's earlier work (#547), the four-step Cellpose widget (#548), and the two blockers of the owner's Colab test, the restore and old-answers scan (#566) and Run progress during the pre-run checks with two linear speed-ups (#567), and the owner's Cellpose test blocker, Preview showing only its own result (#576). The run manifest stays version 5. It does not decide a gate; deciding a gate is the owner's. | | | |---|---| -| Release candidate | Measured on the tree of the merge commit `86d76749be9ad58de7dd4a7220a09f633216f170` (branch `claude/release-v0.9.0` at `ca3b3c6`, merged with `main` at `316be56`, which adds #566 and #567 to the earlier #528, #534, #543, #545, #544, #530, #548, #547 and #546; one conflict, in the CHANGELOG, both sides kept; the notebooks' `RELEASE_REF`, the `RELEASE_CALLS` entry and the pin assertion are back at their pre-pin values) before this record was added; the record changes only this file, and the commit that adds it is the v0.9.0 preparation commit A (`git diff 86d7674 A -- src pyproject.toml` is empty). A keeps the notebooks' `RELEASE_REF` at their v0.8.0-era pins. Commit B then points the `RELEASE_REF` of all three notebooks at A and records the pair in `RELEASE_CALLS`. | +| Release candidate | Measured on the tree of the merge commit `8125f8383b02a7b4ab826608a45f28d74b4f3e91` (branch `claude/release-v0.9.0` at `3a1b073`, merged with the head `1d43cd3` of #576, branch `claude/cellpose-preview-stale` on `main` at `316be56`; `main` itself is not merged, so #568, #572 and later work stay out of v0.9.0; the release branch holds #528, #534, #543, #545, #544, #530, #548, #547, #546, #566 and #567; one conflict, in the CHANGELOG, both sides kept; `git diff 3a1b073 A -- src` is exactly #576's source change, four `notebook_cellpose*.py` files; the notebooks' `RELEASE_REF`, the `RELEASE_CALLS` entry and the pin assertion are back at their pre-pin values) before this record was added; the record changes only this file, and the commit that adds it is the v0.9.0 preparation commit A (`git diff 8125f8383b02a7b4ab826608a45f28d74b4f3e91 A -- src pyproject.toml` is empty). A keeps the notebooks' `RELEASE_REF` at their v0.8.0-era pins. Commit B then points the `RELEASE_REF` of all three notebooks at A and records the pair in `RELEASE_CALLS`. | | Spec pin | `tests/spec_fixtures/PIN.toml`: MorphoBricks-Spec `232fb38880cc487510532d99dc71d46a27005f23` (moved from `bf68d30` in this release, ADR 0006) | | Environment | Linux, Python 3.13.18, `pip install --no-cache-dir -e '.[dev,notebook,zarr,he-mask]'` in a fresh venv (CI's extras; normalization 0.8.0, imagecodecs 2026.11.11, numpy 2.5.5, scipy 1.18.1, tifffile 2026.11.16, zarr 3.4.2, scikit-image 0.26.0, ipywidgets 8.1.9, pytest 9.2.0, ruff 0.17.6); `PYTEST_ADDOPTS` unset; run as root on a case-sensitive file system | | Commands | `python tools/check.py` (the whole suite in one run); `python -m pytest -q -p no:cacheprovider -rs tests/test_spec_*.py`; `python -m pytest -q -p no:cacheprovider -rs tests/test_notebook_setup.py tests/test_notebook_file.py` | -| `tools/check.py` | Ruff clean, Ruff format 761 files already formatted, pytest **8832 passed, 12 skipped** (not run, below), 0 failed, code rules passed (exit status 0) | +| `tools/check.py` | Ruff clean, Ruff format 762 files already formatted, pytest **8843 passed, 12 skipped** (not run, below), 0 failed, code rules passed (exit status 0) | | Spec modules (`tests/test_spec_*.py`, 30 files) | **2122 passed, 0 skipped, 0 failed** | | Notebook pin and version tests | `test_notebook_setup.py` and `test_notebook_file.py`: **49 passed**, 0 skipped (run on the tree of the merge commit) | From 669a1f9db0ce576579570f78f8b1758450f946eb Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 26 Nov 2026 17:09:32 +0000 Subject: [PATCH 13/13] Point the notebooks at the v0.9.0 preparation commit 338629c RELEASE_REF = 338629cff2116952224ec60a98ac78b672f88ff6 (RELEASE_TAG v0.9.0) in all three notebooks (MorphoBricks_Preprocessing, MorphoBricks_Preprocessing_Cellpose and MorphoBricks_Cellpose), with its PreprocessingNotebook() call recorded in RELEASE_CALLS and the test that asserts the ref: the same two-commit pattern as v0.8.0 (438a2d3, 1964746) and the earlier v0.9.0 cuts. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01WX6rdMV1r5jUPUR94kxV5a --- notebooks/MorphoBricks_Cellpose.ipynb | 2 +- notebooks/MorphoBricks_Preprocessing.ipynb | 2 +- notebooks/MorphoBricks_Preprocessing_Cellpose.ipynb | 2 +- tests/test_notebook_file.py | 2 ++ tests/test_notebook_setup.py | 2 +- 5 files changed, 6 insertions(+), 4 deletions(-) diff --git a/notebooks/MorphoBricks_Cellpose.ipynb b/notebooks/MorphoBricks_Cellpose.ipynb index 50f1a715..cba78027 100644 --- a/notebooks/MorphoBricks_Cellpose.ipynb +++ b/notebooks/MorphoBricks_Cellpose.ipynb @@ -93,7 +93,7 @@ "# Both are pinned: Cellpose to the release this notebook is made for, preprocessing to the\n", "# immutable source revision that holds this notebook's code.\n", "CELLPOSE_VERSION = \"4.2.1.1\"\n", - "RELEASE_REF = \"2405083dca90fd4c0e96faca42a9c490f182a706\"\n", + "RELEASE_REF = \"338629cff2116952224ec60a98ac78b672f88ff6\"\n", "REPOSITORY = \"https://github.com/CellMigrationLab/morphobricks-preprocessing.git\"\n", "EXTRAS = \"notebook,zarr\" if \"google.colab\" in sys.modules else \"notebook\"\n", "\n", diff --git a/notebooks/MorphoBricks_Preprocessing.ipynb b/notebooks/MorphoBricks_Preprocessing.ipynb index e8eb1c5c..7acfcc6d 100644 --- a/notebooks/MorphoBricks_Preprocessing.ipynb +++ b/notebooks/MorphoBricks_Preprocessing.ipynb @@ -88,7 +88,7 @@ "\n", "# A downloaded/Colab notebook installs this immutable source revision.\n", "RELEASE_TAG = \"v0.9.0\"\n", - "RELEASE_REF = \"438a2d37625ae7941953fa831914aa5ef5572696\"\n", + "RELEASE_REF = \"338629cff2116952224ec60a98ac78b672f88ff6\"\n", "REPOSITORY = \"https://github.com/CellMigrationLab/morphobricks-preprocessing.git\"\n", "EXTRAS = \"notebook\"\n", "\n", diff --git a/notebooks/MorphoBricks_Preprocessing_Cellpose.ipynb b/notebooks/MorphoBricks_Preprocessing_Cellpose.ipynb index a0cf4d3d..34e6d175 100644 --- a/notebooks/MorphoBricks_Preprocessing_Cellpose.ipynb +++ b/notebooks/MorphoBricks_Preprocessing_Cellpose.ipynb @@ -96,7 +96,7 @@ "\n", "# A downloaded/Colab notebook installs this immutable source revision.\n", "RELEASE_TAG = \"v0.9.0\"\n", - "RELEASE_REF = \"3af789160e9ce224a60da4582e9371f028ff47c5\"\n", + "RELEASE_REF = \"338629cff2116952224ec60a98ac78b672f88ff6\"\n", "REPOSITORY = \"https://github.com/CellMigrationLab/morphobricks-preprocessing.git\"\n", "EXTRAS = \"notebook\"\n", "\n", diff --git a/tests/test_notebook_file.py b/tests/test_notebook_file.py index 61fa76fe..0e5a6f19 100644 --- a/tests/test_notebook_file.py +++ b/tests/test_notebook_file.py @@ -138,6 +138,8 @@ def test_notebook_uses_stable_page_api_not_a_new_app_method(): "aa7ef1230b261531d06c3d5bafc0f933ca32beaf": "PreprocessingNotebook()", # v0.8.0: the same call. "438a2d37625ae7941953fa831914aa5ef5572696": "PreprocessingNotebook()", + # v0.9.0: the same call. + "338629cff2116952224ec60a98ac78b672f88ff6": "PreprocessingNotebook()", } CHECKOUT_CALL = "PreprocessingNotebook()" """The call of this checkout's code (every run described, no ``describe`` argument).""" diff --git a/tests/test_notebook_setup.py b/tests/test_notebook_setup.py index 0257e744..12828e7c 100644 --- a/tests/test_notebook_setup.py +++ b/tests/test_notebook_setup.py @@ -188,7 +188,7 @@ def test_setup_installs_missing_package_from_the_exact_commit(setup_environment, target = command[5] assert target.startswith("morphobricks-preprocessing[notebook] @ git+") assert target.endswith("@" + namespace["RELEASE_REF"]) - assert namespace["RELEASE_REF"] == "438a2d37625ae7941953fa831914aa5ef5572696" + assert namespace["RELEASE_REF"] == "338629cff2116952224ec60a98ac78b672f88ff6" assert "pinned v0.9.0 candidate" in capsys.readouterr().out