Skip to content

fix(labels): restore render float-dtype guard for spatialdata <0.8 - #751

Merged
timtreis merged 1 commit into
mainfrom
fix/sdata-08-compat
Aug 7, 2026
Merged

fix(labels): restore render float-dtype guard for spatialdata <0.8#751
timtreis merged 1 commit into
mainfrom
fix/sdata-08-compat

Conversation

@timtreis

@timtreistimtreis commented Jul 10, 2026

Copy link
Copy Markdown
Member

Problem

#758 (merged) removed _render_labels' float-dtype guard, assuming spatialdata always rejects float labels at the model boundary. That only holds on spatialdata >= 0.8. The library still declares spatialdata >= 0.3, and on spatialdata < 0.8 Labels2DModel.parseaccepts float labels — so with the guard gone, render_labels again crashes deep in skimage with a cryptic TypeError (the #606 regression). This PR corrects that.

Changes

  • render.py — restore the render-time float-dtype ValueError guard (safety net for spatialdata < 0.8; >= 0.8 rejects earlier at the model boundary).
  • test_render_labels.py — re-add test_render_labels_rejects_float_dtype, now version-agnostic: asserts an "integer dtype" error at whichever layer enforces it (spatialdata on >= 0.8; our guard on < 0.8).
  • test_render_shapes.pysort_index() the queried shapes before rendering the random-shuffling test, so the overlapping circles' draw order (and baseline) is stable across spatialdata's 0.8 query-order change; baseline regenerated.

measure_obs float coverage stays as the version-independent _stream_label_centroid_stats unit test added in #758.

@timtreistimtreis changed the title test: make float-dtype label tests compatible with spatialdata 0.8 (keep >=0.3)test: make float-dtype label tests compatible with spatialdata 0.8Jul 10, 2026
@codecov-commenter

codecov-commenter commented Jul 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.60%. Comparing base (227434d) to head (ba46b8b).
⚠️ Report is 8 commits behind head on main.

Files with missing linesPatch %Lines
src/spatialdata_plot/pl/render.py0.00%1 Missing and 1 partial ⚠️
Additional details and impacted files
@@ Coverage Diff @@## main #751 +/- ##
=======================================
Coverage 79.59% 79.60% =======================================
Files 17 18 +1 Lines 4641 4657 +16 Branches 1029 1032 +3 =======================================
+ Hits 3694 3707 +13 - Misses 598 599 +1 - Partials 349 351 +2 
Files with missing linesCoverage Δ
src/spatialdata_plot/pl/render.py89.41% <0.00%> (-0.21%)⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@timtreis

Copy link
Copy Markdown
MemberAuthor

Blocked by scverse/spatialdata#1150 so we can remove the local measure_obs again

#758 removed the render-time float-dtype guard on the assumption that
spatialdata always rejects float labels at the model boundary. That only
holds on spatialdata >=0.8; the library still supports spatialdata >=0.3,
where float labels parse fine and would again crash deep in skimage with a
cryptic TypeError (#606). Restore the guard so the clear error holds across
the whole supported range.
- render.py: re-add the float-dtype ValueError guard.
- test_render_labels.py: re-add test_render_labels_rejects_float_dtype in a
version-agnostic form (assert an "integer dtype" error is raised at
whichever layer enforces it: spatialdata on >=0.8, our guard on <0.8).
- test_render_shapes.py: sort queried shapes before render so the overlap
draw order (and the baseline) is stable across spatialdata's query-order
change in 0.8; regenerate the baseline accordingly.
The measure_obs float coverage stays as the version-independent
_stream_label_centroid_stats unit test added in #758.
@timtreis
timtreisforce-pushed the fix/sdata-08-compat branch from 8097f73 to ba46b8bCompareAugust 7, 2026 13:53
@timtreistimtreis changed the title test: make float-dtype label tests compatible with spatialdata 0.8fix(labels): restore render float-dtype guard for spatialdata <0.8 (corrective to #758)Aug 7, 2026
@timtreistimtreis changed the title fix(labels): restore render float-dtype guard for spatialdata <0.8 (corrective to #758)fix(labels): restore render float-dtype guard for spatialdata <0.8Aug 7, 2026
@timtreis
timtreis merged commit 43a0124 into mainAug 7, 2026
7 of 8 checks passed
@timtreis
timtreis deleted the fix/sdata-08-compat branch August 7, 2026 14:03
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@timtreis@codecov-commenter