Skip to content

Fill position_id per image (D02) and require Python 3.11 (D01) - #19

Merged
IvanHCenalmor merged 2 commits into
mainfrom
claude/funny-ptolemy-a9rxd1
Oct 26, 2026
Merged

IvanHCenalmor merged 2 commits into
mainfrom
claude/funny-ptolemy-a9rxd1

Conversation

@guijacquemet

@guijacquemet guijacquemet commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Two MorphoBricks alignment changes, one commit each. The branch name is fixed for this work, so both are in this PR instead of the usual one PR per change.

Commit 1: fill position_id (D02, audit finding X02)

plane_histograms.csv had a position_id column that this brick never filled, and the run manifest had no position identity per file.

  • discovery:
    • New public position_id(image). It returns the image name without .tif/.tiff/.zarr (any case) and without a preceding .ome, so img_01.ome.tif gives img_01. It is re-exported from the package.
    • New error duplicate_position_id: two images in one leaf folder that share an identifier, ignoring case, are refused.
  • run: every CSV row now carries position_id, including rows from converted TIFFs. Rows reused from an earlier table with blank position_id are filled from the path without reading pixels.
  • manifest: new optional per-file key position_id (FileEntry.position_id). Manifests written before this change read it as null.
  • Docs: contract §1, §5, §8 and §9; plan §6, §10 and §12 question 20; user guide §2, §6 and §8; AGENTS.md.

Commit 2: require Python 3.11 (D01)

  • requires-python >=3.11 and Ruff target py311. Ruff then asks for two upgrades:
    • datetime.UTC
    • Severity as a StrEnum. It is only read through .value, so text output is unchanged.
  • Notebook Step 0 and its test refuse Python 3.10.
  • The CI matrix is now 3.11 and 3.13. The 3.11 jobs pin zarr>=2.18,<3, because zarr 3 also supports 3.11 and the zarr 2 path would otherwise go untested. Before, the 3.10 jobs covered zarr 2.
  • AGENTS, the development guide and the user guide now say 3.11.

Decisions implemented

These are the MorphoBricks owner decisions of 2026-10-26 (CellMigrationLab/MorphoFeature#6, decision ledger):

  • D02: the canonical FOV key is condition + biological_repeat + technical_repeat + position_id. position_id falls back to the file stem only when one file is exactly one position. That always holds here, because several series and position-like axes are already errors.
  • D01: every brick requires Python ≥3.11.

Versioning: the CSV columns and schema_version 2 are unchanged. The manifest stays at version 1 with one optional key.

Notes for review

  • The normalization contract §8.2 said position_id is "never inferred from file names". That conflicts with D02 and is corrected in Require Python 3.11; position_id follows the MorphoBricks FOV key morphobricks-normalization#4, together with Python 3.11 there.
  • Excluding one of two duplicate images does not clear duplicate_position_id; the message says to rename or move one.
  • a.tif and a.ome.tif in one folder used to both convert to a.ome.zarr. That pair is now refused.
  • Not verified: CI on Windows and macOS. All results below are local runs on Linux.

Tests (local)

Python zarr ruff check ruff format --check pytest
3.11.17 2.18.7 All checks passed 53 files already formatted 754 passed, 14 skipped
3.13.17 3.4.1 767 passed, 1 skipped
  • On 3.11 the skips are the OME-NGFF 0.5 tests that need zarr 3, plus the POSIX-permission test. On 3.13 only the permission test skips; the sandbox ignores file modes.
  • Without commit 1's source change, 8 of its new tests fail.

Do not merge without the owner's go-ahead.

🤖 Generated with Claude Code

https://claude.ai/code/session_01U6vJfhGWQ7pTpsJhw48Zf7

Cross-brick decision D02 (audit finding X02): a field of view is
identified in every brick by condition + biological_repeat +
technical_repeat + position_id, with position_id falling back to the
image file stem only when one file is exactly one position. Here it
always is, so:

- discovery.position_id: the image name without .tif/.tiff/.zarr and a
  preceding .ome; exported from the package.
- New error duplicate_position_id: two images in one leaf folder with
  the same identifier, ignoring case (img_01.tif and img_01.ome.zarr),
  are refused instead of guessed.
- Every plane_histograms.csv row carries position_id; rows reused from
  an earlier table with it blank are filled without reading pixels.
  CSV columns and schema version 2 unchanged.
- run_manifest.json: optional per-file key position_id (null when
  absent); manifest version stays 1, like earlier optional keys.
- Contract §1/§5/§8/§9, plan §6/§10/§12 question 20, user guide and
  AGENTS.md updated; tests for equal names in two technical repeats,
  duplicate refusal, manifest round trip, OME-Zarr and converted
  images, and refilling an earlier table.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01U6vJfhGWQ7pTpsJhw48Zf7
- requires-python >=3.11 and Ruff target py311; the two upgrades Ruff
  then asks for: datetime.UTC, and Severity as a StrEnum (it is only read
  through .value, so text output is unchanged).
- Notebook Step 0 and its test now refuse Python 3.10.
- CI matrix 3.11 and 3.13; the 3.11 jobs pin zarr 2.18 so both zarr
  majors stay tested, as the 3.10 jobs did before.
- AGENTS, development guide and user guide say 3.11.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01U6vJfhGWQ7pTpsJhw48Zf7
@guijacquemet guijacquemet changed the title Fill position_id per image and record it in the run manifest (D02) Fill position_id per image (D02) and require Python 3.11 (D01) Oct 26, 2026
@IvanHCenalmor
IvanHCenalmor merged commit b1e252d into main Oct 26, 2026
7 checks passed
@IvanHCenalmor
IvanHCenalmor deleted the claude/funny-ptolemy-a9rxd1 branch October 26, 2026 14:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants