fix: full scanpy 1.13 compatibility layer - #760
Merged
Conversation
timtreis
force-pushed
the
fix/scanpy113-compat
branch
from
August 7, 2026 13:56
6d18fa7 to
e62e952
Compare
timtreis
force-pushed
the
fix/scanpy113-compat
branch
from
August 7, 2026 14:04
e62e952 to
06c2c0d
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #760 +/- ##
==========================================
+ Coverage 79.60% 79.63% +0.03%
==========================================
Files 18 18
Lines 4657 4665 +8
Branches 1032 1032
==========================================
+ Hits 3707 3715 +8
Misses 599 599
Partials 351 351
🚀 New features to boost your workflow:
|
timtreis
force-pushed
the
fix/scanpy113-compat
branch
from
August 7, 2026 14:24
06c2c0d to
28c7142
Compare
timtreis
force-pushed
the
fix/scanpy113-compat
branch
2 times, most recently
from
August 7, 2026 14:34
18069cb to
51e49a8
Compare
scanpy 1.13 reorganized its plotting internals, breaking spatialdata-plot on pre-release scanpy. Consolidate every reliance on scanpy internals into one version-tolerant module, _scanpy_compat, that imports each symbol from the new location with a fallback to the old: - palettes default_20/28/102 scanpy.plotting.palettes -> .legacy.palettes - _add_categorical_legend scanpy.plotting._tools... -> .legacy._tools... - add_colors_for_categorical_... scanpy.plotting._utils -> .legacy._utils - vector_friendly() settings._vector_friendly removed in 1.13; default False Route all src call sites (render.py, utils.py, _color.py, _palette.py) and the one test that referenced scanpy's palette module (test_palette.py) through _scanpy_compat. The settings import uses the stable public `from scanpy import settings`, and the fallbacks catch ModuleNotFoundError (not the broader ImportError) so a broken-but-present legacy module surfaces instead of being silently masked. Behaviour is unchanged: relocated palettes/helpers are frozen copies (identical values and signatures). vector_friendly() keeps honouring sc.set_figure_params on older scanpy and defaults to False on >=1.13 where the flag no longer exists. Verified: passes on scanpy 1.11.4 (fallback) and 1.13.0a1 (legacy path); CI py3.14-pre is green (882 passed).
timtreis
force-pushed
the
fix/scanpy113-compat
branch
from
August 7, 2026 15:04
51e49a8 to
ce185c0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Goal
Make spatialdata-plot fully compatible with scanpy 1.13 (the pre-release used in the
py3.14-preCI env), which reorganized its plotting internals and brokeimport spatialdata_plotand several render paths.Complete scanpy-internal surface (audited across
src/)default_20/28/102plotting.palettes→plotting.legacy.palettes_add_categorical_legendplotting._tools.scatterplots→plotting.legacy._tools...add_colors_for_categorical_sample_annotationplotting._utils→plotting.legacy._utilssettings._vector_friendlyvector_friendly()helper, defaults toFalse, still honourssc.set_figure_paramson older scanpysc.get.obs_df,settings.figdir,sc.set_figure_params,sc.pl.set_rcParams_defaultsAll of it is consolidated into one version-tolerant module,
_scanpy_compat, and every call site (render.py,utils.py,_color.py,_palette.py) routes through it — so the reliance on scanpy internals lives in exactly one place.Why behaviour is unchanged
The relocated palettes/helpers are frozen copies:
default_*hash identically across 1.11.4 and 1.13.0a1, and_add_categorical_legend/add_colors_...have identical signatures in the old andlegacylocations.vector_friendly()reproduces scanpy's historical default.Verification
AttributeError/ImportError(visualtest_plot_*only run on the GH runner). CI'spy3.14-preis the authoritative visual check.Notes
Follow-up to the merged #759 (palettes-only).
py3.14-preiscontinue-on-error(non-gating); this is scanpy-1.13 readiness.