Skip to content

Modernize ci setup #434

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 0 additions & 60 deletions .flake8

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.12
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ jobs:
PYTHON: ${{ matrix.python }}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v3
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}

Expand Down
21 changes: 7 additions & 14 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,19 @@ minimum_pre_commit_version: 2.16.0
ci:
skip: []
repos:
- repo: https://github.com/psf/black
rev: 25.1.0
hooks:
- id: black
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v4.0.0-alpha.8
- repo: https://github.com/rbubley/mirrors-prettier
rev: v3.5.1
hooks:
- id: prettier
- repo: https://github.com/asottile/blacken-docs
rev: 1.19.1
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.11.2
hooks:
- id: blacken-docs
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- id: ruff-format
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.15.0
hooks:
- id: mypy
additional_dependencies: [numpy, types-requests]
exclude: tests/|docs/
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.11.0
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
19 changes: 9 additions & 10 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
# https://docs.readthedocs.io/en/stable/config-file/v2.html
version: 2
build:
os: ubuntu-20.04
os: ubuntu-24.04
tools:
python: "3.10"
python: "3.12"
commands:
- asdf plugin add uv
- asdf install uv latest
- asdf global uv latest
- uv venv
- uv pip install .[docs,pre]
- .venv/bin/python -m sphinx -T -b html -d docs/_build/doctrees -D language=en docs $READTHEDOCS_OUTPUT/html
sphinx:
configuration: docs/conf.py
fail_on_warning: false
python:
install:
- method: pip
path: .
extra_requirements:
- docs
- pre
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@

The `spatialdata-plot` package extends `spatialdata` with a declarative plotting API that enables to quickly visualize `spatialdata` objects and their respective elements (i.e. `images`, `labels`, `points` and `shapes`).

SpatialData’s plotting capabilities allow to quickly visualise all contained modalities. The user can specify which elements should be rendered (images, labels, points, shapes) and specify certain parameters for each layer, such as for example the intent to color shapes by a gene’s expression profile or which color to use for which image channel. When the plot is then eventually displayed, all transformations, alignments and coordinate systems are internally processed to form the final visualisation. In concordance with the general SpatialData philosophy, all modalities of the major spatial technologies are supported out of the box.
SpatialData’s plotting capabilities allow to quickly visualise all contained modalities.
The user can specify which elements should be rendered (images, labels, points, shapes) and specify certain parameters for each layer, such as for example the intent to color shapes by a gene’s expression profile or which color to use for which image channel.
When the plot is then eventually displayed, all transformations, alignments and coordinate systems are internally processed to form the final visualisation.
In concordance with the general SpatialData philosophy, all modalities of the major spatial technologies are supported out of the box.

<img src='https://raw.githubusercontent.com/scverse/spatialdata-plot/main/docs/spatialdata-plot.png'/>

Expand All @@ -36,15 +39,13 @@ Python installed, we recommend installing [Mambaforge](https://github.com/conda-

There are several alternative options to install spatialdata-plot:

<!--
1) Install the latest release of `spatialdata-plot` from `PyPI <https://pypi.org/project/spatialdata-plot/>`_:
1. Install the latest release of `spatialdata-plot` from `PyPI <https://pypi.org/project/spatialdata-plot/>`\_:

```bash
pip install spatialdata-plot
```
-->

1. Install the latest development version:
2. Install the latest development version:

```bash
pip install git+https://github.com/scverse/spatialdata-plot.git@main
Expand Down
Empty file removed docs/_static/.gitkeep
Empty file.
Empty file removed docs/_templates/.gitkeep
Empty file.
1 change: 0 additions & 1 deletion docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
:maxdepth: 1
:caption: API

preprocessing.rst
plotting.rst

```
44 changes: 0 additions & 44 deletions docs/conf.py.rej

This file was deleted.

8 changes: 0 additions & 8 deletions docs/preprocessing.rst

This file was deleted.

34 changes: 7 additions & 27 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -73,27 +73,6 @@ filterwarnings = [
# "ignore:.*U.*mode is deprecated:DeprecationWarning",
]

[tool.black]
line-length = 120
target-version = ['py310']
include = '\.pyi?$'
exclude = '''
(
/(
\.eggs
| \.git
| \.hg
| \.mypy_cache
| \.tox
| \.venv
| _build
| buck-out
| build
| dist
)/
)
'''

[tool.jupytext]
formats = "ipynb,md"

Expand All @@ -110,6 +89,7 @@ version-file = "_version.py"
allow-direct-references = true

[tool.ruff]
line-length = 120
exclude = [
".git",
".tox",
Expand All @@ -119,7 +99,8 @@ exclude = [
"dist",
"setup.py",
]
lint.ignore = [
[tool.ruff.lint]
ignore = [
# Do not assign a lambda expression, use a def -> lambda expression assignments are convenient
"E731",
# allow I, O, l as variable names -> I is the identity matrix, i, j, k, l is reasonable indexing notation
Expand All @@ -137,8 +118,7 @@ lint.ignore = [
# Missing docstring in magic method
"D105",
]
line-length = 120
lint.select = [
select = [
"D", # flake8-docstrings
"I", # isort
"E", # pycodestyle
Expand All @@ -157,15 +137,16 @@ lint.select = [
"RET", # flake8-raise
"PGH", # pygrep-hooks
]
lint.unfixable = ["B", "UP", "C4", "BLE", "T20", "RET"]
target-version = "py310"
unfixable = ["B", "UP", "C4", "BLE", "T20", "RET"]

[tool.ruff.lint.per-file-ignores]
"tests/*" = ["D", "PT", "B024"]
"*/__init__.py" = ["F401", "D104", "D107", "E402"]
"docs/*" = ["D","B","E","A"]
# "src/spatialdata/transformations/transformations.py" = ["D101","D102", "D106", "B024", "T201", "RET504"]
"tests/conftest.py"= ["E402", "RET504"]
"src/spatialdata_plot/pl/utils.py"= ["PGH003"]

[tool.ruff.lint.pydocstyle]
convention = "numpy"

Expand All @@ -189,4 +170,3 @@ push = false
"{version}",
"{pep440_version}",
]

3 changes: 1 addition & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,7 @@ def empty_table() -> SpatialData:

@pytest.fixture(
# params=["labels"]
params=["full", "empty"]
+ ["images", "labels", "points", "table_single_annotation", "table_multiple_annotations"]
params=["full", "empty"] + ["images", "labels", "points", "table_single_annotation", "table_multiple_annotations"]
# + ["empty_" + x for x in ["table"]] # TODO: empty table not supported yet
)
def sdata(request) -> SpatialData:
Expand Down
4 changes: 0 additions & 4 deletions tests/pl/test_render_labels.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,7 @@ def test_plot_can_color_labels_by_categorical_variable(self, sdata_blobs: Spatia
],
)
def test_plot_can_color_labels_by_categorical_variable_in_other_table(self, sdata_blobs: SpatialData, label: str):

def _make_tablemodel_with_categorical_labels(sdata_blobs, label):

adata = sdata_blobs.tables["table"].copy()
max_col = adata.to_df().idxmax(axis=1)
max_col = max_col.str.replace("channel_", "ch").str.replace("_sum", "")
Expand Down Expand Up @@ -163,7 +161,6 @@ def test_plot_label_colorbar_uses_alpha_of_less_transparent_infill(
self,
sdata_blobs: SpatialData,
):

sdata_blobs.pl.render_labels(
"blobs_labels", color="channel_0_sum", fill_alpha=0.1, outline_alpha=0.7, contour_px=15
).pl.show()
Expand All @@ -172,7 +169,6 @@ def test_plot_label_colorbar_uses_alpha_of_less_transparent_outline(
self,
sdata_blobs: SpatialData,
):

sdata_blobs.pl.render_labels("blobs_labels", color="channel_0_sum", fill_alpha=0.7, outline_alpha=0.1).pl.show()

def test_can_plot_with_one_element_color_table(self, sdata_blobs: SpatialData):
Expand Down
3 changes: 0 additions & 3 deletions tests/pl/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ def test_plot_can_set_zero_in_cmap_to_transparent(self, sdata_blobs: SpatialData
],
)
def test_is_color_like(color_result: tuple[ColorLike, bool]):

color, result = color_result

assert spatialdata_plot.pl.utils._is_color_like(color) == result
Expand Down Expand Up @@ -121,7 +120,6 @@ def test_utils_sanitise_na_color(input_output):
],
)
def test_utils_sanitise_na_color_accepts_valid_inputs(input_output):

func_input, expected_output = input_output

assert _sanitise_na_color(func_input) == expected_output
Expand All @@ -141,7 +139,6 @@ def test_utils_sanitise_na_color_fails_when_input_isnt_a_color():
],
)
def test_utils_get_subplots_produces_correct_axs_layout(input_output):

num_images, ncols, len_axs, axs_visible = input_output

_, axs = _get_subplots(num_images=num_images, ncols=ncols)
Expand Down
Loading