Skip to content

Commit

Permalink
Merge branch 'main' into bugfix/337-ds-point-transformation
Browse files Browse the repository at this point in the history
  • Loading branch information
Sonja-Stockhaus authored Nov 26, 2024
2 parents 78840c7 + 01fc627 commit b2985d1
Show file tree
Hide file tree
Showing 10 changed files with 63 additions and 65 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python: ["3.9", "3.10"]
python: ["3.10", "3.12"]
os: [ubuntu-latest]

env:
Expand Down Expand Up @@ -49,7 +49,7 @@ jobs:
pip install pytest-cov
- name: Install dependencies
run: |
pip install --pre -e ".[dev,test]"
pip install --pre -e ".[dev,test,pre]"
- name: Test
env:
MPLBACKEND: agg
Expand Down
4 changes: 2 additions & 2 deletions .mypy.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[mypy]
python_version = 3.9
python_version = 3.10
plugins = numpy.typing.mypy_plugin

ignore_errors = False
Expand All @@ -25,4 +25,4 @@ no_warn_no_return = True

show_error_codes = True
show_column_numbers = True
error_summary = True
error_summary = True
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ fail_fast: false
default_language_version:
python: python3
default_stages:
- commit
- push
- pre-commit
- pre-push
minimum_pre_commit_version: 2.16.0
ci:
skip: []
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ maintainers = [
urls.Documentation = "https://spatialdata.scverse.org/projects/plot/en/latest/index.html"
urls.Source = "https://github.com/scverse/spatialdata-plot.git"
urls.Home-page = "https://github.com/scverse/spatialdata-plot.git"
requires-python = ">=3.9"
requires-python = ">=3.10"
dynamic= [
"version" # allow version to be set by git tags
]
Expand Down Expand Up @@ -75,7 +75,7 @@ filterwarnings = [

[tool.black]
line-length = 120
target-version = ['py39']
target-version = ['py310']
include = '\.pyi?$'
exclude = '''
(
Expand Down Expand Up @@ -158,7 +158,7 @@ lint.select = [
"PGH", # pygrep-hooks
]
lint.unfixable = ["B", "UP", "C4", "BLE", "T20", "RET"]
target-version = "py39"
target-version = "py310"
[tool.ruff.lint.per-file-ignores]
"tests/*" = ["D", "PT", "B024"]
"*/__init__.py" = ["F401", "D104", "D107", "E402"]
Expand Down
9 changes: 4 additions & 5 deletions src/spatialdata_plot/pl/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from collections import OrderedDict
from copy import deepcopy
from pathlib import Path
from typing import Any, Union
from typing import Any

import matplotlib.pyplot as plt
import numpy as np
Expand All @@ -14,14 +14,13 @@
import spatialdata as sd
from anndata import AnnData
from dask.dataframe import DataFrame as DaskDataFrame
from datatree import DataTree
from geopandas import GeoDataFrame
from matplotlib.axes import Axes
from matplotlib.colors import Colormap, Normalize
from matplotlib.figure import Figure
from spatialdata import get_extent
from spatialdata._utils import _deprecation_alias
from xarray import DataArray
from xarray import DataArray, DataTree

from spatialdata_plot._accessor import register_spatial_data_accessor
from spatialdata_plot.pl.render import (
Expand Down Expand Up @@ -62,7 +61,7 @@
# replace with
# from spatialdata._types import ColorLike
# once https://github.com/scverse/spatialdata/pull/689/ is in a release
ColorLike = Union[tuple[float, ...], str]
ColorLike = tuple[float, ...] | str


@register_spatial_data_accessor("pl")
Expand Down Expand Up @@ -952,7 +951,7 @@ def show(
if wanted_labels_on_this_cs:
if (table := params_copy.table_name) is not None:
colors = sc.get.obs_df(sdata[table], params_copy.color)
if isinstance(colors.dtype, pd.CategoricalDtype):
if isinstance(colors[params_copy.color].dtype, pd.CategoricalDtype):
_maybe_set_colors(
source=sdata[table],
target=sdata[table],
Expand Down
8 changes: 4 additions & 4 deletions src/spatialdata_plot/pl/render.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import warnings
from collections import abc
from copy import copy
from typing import Union

import dask
import datashader as ds
Expand All @@ -15,7 +14,6 @@
import scanpy as sc
import spatialdata as sd
from anndata import AnnData
from datatree import DataTree
from matplotlib.cm import ScalarMappable
from matplotlib.colors import ListedColormap, Normalize
from scanpy._settings import settings as sc_settings
Expand All @@ -24,6 +22,8 @@
from spatialdata.transformations import get_transformation, set_transformation
from spatialdata.transformations.transformations import Identity, Sequence

from xarray import DataTree

from spatialdata_plot._logging import logger
from spatialdata_plot.pl.render_params import (
FigParams,
Expand Down Expand Up @@ -55,7 +55,7 @@
to_hex,
)

_Normalize = Union[Normalize, abc.Sequence[Normalize]]
_Normalize = Normalize | abc.Sequence[Normalize]


def _render_shapes(
Expand Down Expand Up @@ -466,7 +466,7 @@ def _render_points(
if col_for_color is not None:
cols = sc.get.obs_df(adata, col_for_color)
# maybe set color based on type
if isinstance(cols.dtype, pd.CategoricalDtype):
if isinstance(cols[col_for_color].dtype, pd.CategoricalDtype):
_maybe_set_colors(
source=adata,
target=adata,
Expand Down
4 changes: 2 additions & 2 deletions src/spatialdata_plot/pl/render_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from collections.abc import Callable, Sequence
from dataclasses import dataclass
from typing import Literal, Union
from typing import Literal

from matplotlib.axes import Axes
from matplotlib.colors import Colormap, ListedColormap, Normalize
Expand All @@ -14,7 +14,7 @@
# replace with
# from spatialdata._types import ColorLike
# once https://github.com/scverse/spatialdata/pull/689/ is in a release
ColorLike = Union[tuple[float, ...], str]
ColorLike = tuple[float, ...] | str


@dataclass
Expand Down
Loading

0 comments on commit b2985d1

Please sign in to comment.