Skip to content

Commit 9501a9e

Browse files
committed
compat fix
1 parent 4d44782 commit 9501a9e

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,3 +144,6 @@ data
144144
# pixi
145145
.pixi
146146
pixi.lock
147+
148+
# version file
149+
_version.py

src/squidpy/_compat.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,12 @@
2020
]
2121

2222
# See https://github.com/scverse/squidpy/issues/1061 for more details
23-
_SET_DEFAULT_COLORS_FOR_CATEGORICAL_OBS_CHANGED = Version(version("scanpy")) >= Version("0.12.0rc1")
24-
25-
if _SET_DEFAULT_COLORS_FOR_CATEGORICAL_OBS_CHANGED:
23+
# scanpy around version 0.11.x- 0.12.x changed the function name from set_default_colors_for_categorical_obs to _set_default_colors_for_categorical_obs
24+
# and then changed it back
25+
# so to not track with versioning we use the underscore version first (current), fall back to non-underscore for older/future versions
26+
try:
2627
from scanpy.plotting._utils import _set_default_colors_for_categorical_obs as set_default_colors_for_categorical_obs
27-
else:
28+
except ImportError:
2829
from scanpy.plotting._utils import set_default_colors_for_categorical_obs
2930

3031

0 commit comments

Comments
 (0)