Skip to content

Commit 27878f1

Browse files
authored
Modernize setup (#434)
Signed-off-by: Lukas Heumos <[email protected]>
1 parent b314b75 commit 27878f1

15 files changed

+33
-181
lines changed

.flake8

Lines changed: 0 additions & 60 deletions
This file was deleted.

.github/workflows/release.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
steps:
1212
- uses: actions/checkout@v3
1313
- name: Set up Python 3.12
14-
uses: actions/setup-python@v4
14+
uses: actions/setup-python@v5
1515
with:
1616
python-version: "3.12"
1717
cache: pip

.github/workflows/test.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ jobs:
2626
PYTHON: ${{ matrix.python }}
2727

2828
steps:
29-
- uses: actions/checkout@v3
29+
- uses: actions/checkout@v4
3030
- name: Set up Python ${{ matrix.python }}
31-
uses: actions/setup-python@v3
31+
uses: actions/setup-python@v5
3232
with:
3333
python-version: ${{ matrix.python }}
3434

.pre-commit-config.yaml

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,19 @@ minimum_pre_commit_version: 2.16.0
88
ci:
99
skip: []
1010
repos:
11-
- repo: https://github.com/psf/black
12-
rev: 25.1.0
13-
hooks:
14-
- id: black
15-
- repo: https://github.com/pre-commit/mirrors-prettier
16-
rev: v4.0.0-alpha.8
11+
- repo: https://github.com/rbubley/mirrors-prettier
12+
rev: v3.5.1
1713
hooks:
1814
- id: prettier
19-
- repo: https://github.com/asottile/blacken-docs
20-
rev: 1.19.1
15+
- repo: https://github.com/astral-sh/ruff-pre-commit
16+
rev: v0.11.2
2117
hooks:
22-
- id: blacken-docs
18+
- id: ruff
19+
args: [--fix, --exit-non-zero-on-fix]
20+
- id: ruff-format
2321
- repo: https://github.com/pre-commit/mirrors-mypy
2422
rev: v1.15.0
2523
hooks:
2624
- id: mypy
2725
additional_dependencies: [numpy, types-requests]
2826
exclude: tests/|docs/
29-
- repo: https://github.com/astral-sh/ruff-pre-commit
30-
rev: v0.11.0
31-
hooks:
32-
- id: ruff
33-
args: [--fix, --exit-non-zero-on-fix]

.readthedocs.yaml

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
1-
# https://docs.readthedocs.io/en/stable/config-file/v2.html
21
version: 2
32
build:
4-
os: ubuntu-20.04
3+
os: ubuntu-24.04
54
tools:
6-
python: "3.10"
5+
python: "3.12"
6+
commands:
7+
- asdf plugin add uv
8+
- asdf install uv latest
9+
- asdf global uv latest
10+
- uv venv
11+
- uv pip install .[docs,pre]
12+
- .venv/bin/python -m sphinx -T -b html -d docs/_build/doctrees -D language=en docs $READTHEDOCS_OUTPUT/html
713
sphinx:
814
configuration: docs/conf.py
915
fail_on_warning: false
10-
python:
11-
install:
12-
- method: pip
13-
path: .
14-
extra_requirements:
15-
- docs
16-
- pre

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@
1818

1919
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`).
2020

21-
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.
21+
SpatialData’s plotting capabilities allow to quickly visualise all contained modalities.
22+
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.
23+
When the plot is then eventually displayed, all transformations, alignments and coordinate systems are internally processed to form the final visualisation.
24+
In concordance with the general SpatialData philosophy, all modalities of the major spatial technologies are supported out of the box.
2225

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

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

3740
There are several alternative options to install spatialdata-plot:
3841

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

4244
```bash
4345
pip install spatialdata-plot
4446
```
45-
-->
4647

47-
1. Install the latest development version:
48+
2. Install the latest development version:
4849

4950
```bash
5051
pip install git+https://github.com/scverse/spatialdata-plot.git@main

docs/_static/.gitkeep

Whitespace-only changes.

docs/_templates/.gitkeep

Whitespace-only changes.

docs/api.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
:maxdepth: 1
55
:caption: API
66
7-
preprocessing.rst
87
plotting.rst
98
109
```

docs/conf.py.rej

Lines changed: 0 additions & 44 deletions
This file was deleted.

docs/preprocessing.rst

Lines changed: 0 additions & 8 deletions
This file was deleted.

pyproject.toml

Lines changed: 7 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -73,27 +73,6 @@ filterwarnings = [
7373
# "ignore:.*U.*mode is deprecated:DeprecationWarning",
7474
]
7575

76-
[tool.black]
77-
line-length = 120
78-
target-version = ['py310']
79-
include = '\.pyi?$'
80-
exclude = '''
81-
(
82-
/(
83-
\.eggs
84-
| \.git
85-
| \.hg
86-
| \.mypy_cache
87-
| \.tox
88-
| \.venv
89-
| _build
90-
| buck-out
91-
| build
92-
| dist
93-
)/
94-
)
95-
'''
96-
9776
[tool.jupytext]
9877
formats = "ipynb,md"
9978

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

11291
[tool.ruff]
92+
line-length = 120
11393
exclude = [
11494
".git",
11595
".tox",
@@ -119,7 +99,8 @@ exclude = [
11999
"dist",
120100
"setup.py",
121101
]
122-
lint.ignore = [
102+
[tool.ruff.lint]
103+
ignore = [
123104
# Do not assign a lambda expression, use a def -> lambda expression assignments are convenient
124105
"E731",
125106
# allow I, O, l as variable names -> I is the identity matrix, i, j, k, l is reasonable indexing notation
@@ -137,8 +118,7 @@ lint.ignore = [
137118
# Missing docstring in magic method
138119
"D105",
139120
]
140-
line-length = 120
141-
lint.select = [
121+
select = [
142122
"D", # flake8-docstrings
143123
"I", # isort
144124
"E", # pycodestyle
@@ -157,15 +137,16 @@ lint.select = [
157137
"RET", # flake8-raise
158138
"PGH", # pygrep-hooks
159139
]
160-
lint.unfixable = ["B", "UP", "C4", "BLE", "T20", "RET"]
161-
target-version = "py310"
140+
unfixable = ["B", "UP", "C4", "BLE", "T20", "RET"]
141+
162142
[tool.ruff.lint.per-file-ignores]
163143
"tests/*" = ["D", "PT", "B024"]
164144
"*/__init__.py" = ["F401", "D104", "D107", "E402"]
165145
"docs/*" = ["D","B","E","A"]
166146
# "src/spatialdata/transformations/transformations.py" = ["D101","D102", "D106", "B024", "T201", "RET504"]
167147
"tests/conftest.py"= ["E402", "RET504"]
168148
"src/spatialdata_plot/pl/utils.py"= ["PGH003"]
149+
169150
[tool.ruff.lint.pydocstyle]
170151
convention = "numpy"
171152

@@ -189,4 +170,3 @@ push = false
189170
"{version}",
190171
"{pep440_version}",
191172
]
192-

tests/conftest.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,7 @@ def empty_table() -> SpatialData:
214214

215215
@pytest.fixture(
216216
# params=["labels"]
217-
params=["full", "empty"]
218-
+ ["images", "labels", "points", "table_single_annotation", "table_multiple_annotations"]
217+
params=["full", "empty"] + ["images", "labels", "points", "table_single_annotation", "table_multiple_annotations"]
219218
# + ["empty_" + x for x in ["table"]] # TODO: empty table not supported yet
220219
)
221220
def sdata(request) -> SpatialData:

tests/pl/test_render_labels.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,7 @@ def test_plot_can_color_labels_by_categorical_variable(self, sdata_blobs: Spatia
9898
],
9999
)
100100
def test_plot_can_color_labels_by_categorical_variable_in_other_table(self, sdata_blobs: SpatialData, label: str):
101-
102101
def _make_tablemodel_with_categorical_labels(sdata_blobs, label):
103-
104102
adata = sdata_blobs.tables["table"].copy()
105103
max_col = adata.to_df().idxmax(axis=1)
106104
max_col = max_col.str.replace("channel_", "ch").str.replace("_sum", "")
@@ -163,7 +161,6 @@ def test_plot_label_colorbar_uses_alpha_of_less_transparent_infill(
163161
self,
164162
sdata_blobs: SpatialData,
165163
):
166-
167164
sdata_blobs.pl.render_labels(
168165
"blobs_labels", color="channel_0_sum", fill_alpha=0.1, outline_alpha=0.7, contour_px=15
169166
).pl.show()
@@ -172,7 +169,6 @@ def test_plot_label_colorbar_uses_alpha_of_less_transparent_outline(
172169
self,
173170
sdata_blobs: SpatialData,
174171
):
175-
176172
sdata_blobs.pl.render_labels("blobs_labels", color="channel_0_sum", fill_alpha=0.7, outline_alpha=0.1).pl.show()
177173

178174
def test_can_plot_with_one_element_color_table(self, sdata_blobs: SpatialData):

tests/pl/test_utils.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ def test_plot_can_set_zero_in_cmap_to_transparent(self, sdata_blobs: SpatialData
8686
],
8787
)
8888
def test_is_color_like(color_result: tuple[ColorLike, bool]):
89-
9089
color, result = color_result
9190

9291
assert spatialdata_plot.pl.utils._is_color_like(color) == result
@@ -121,7 +120,6 @@ def test_utils_sanitise_na_color(input_output):
121120
],
122121
)
123122
def test_utils_sanitise_na_color_accepts_valid_inputs(input_output):
124-
125123
func_input, expected_output = input_output
126124

127125
assert _sanitise_na_color(func_input) == expected_output
@@ -141,7 +139,6 @@ def test_utils_sanitise_na_color_fails_when_input_isnt_a_color():
141139
],
142140
)
143141
def test_utils_get_subplots_produces_correct_axs_layout(input_output):
144-
145142
num_images, ncols, len_axs, axs_visible = input_output
146143

147144
_, axs = _get_subplots(num_images=num_images, ncols=ncols)

0 commit comments

Comments
 (0)