Skip to content

Commit dd9e106

Browse files
committed
Merge branch 'main' into giovp/get_element_instances
2 parents 42a4ee6 + d43d3e7 commit dd9e106

124 files changed

Lines changed: 2191 additions & 1871 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.cruft.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"template": "https://github.com/scverse/cookiecutter-scverse",
3-
"commit": "8e96abb5c3e2d5078c44713958da672711cf2a48",
4-
"checkout": "v0.3.0",
3+
"commit": "87a407a65408d75a949c0b54b19fd287475a56f8",
4+
"checkout": "v0.4.0",
55
"context": {
66
"cookiecutter": {
77
"project_name": "spatialdata-plot",
@@ -13,7 +13,8 @@
1313
"project_repo": "https://github.com/scverse/spatialdata-plot",
1414
"license": "BSD 3-Clause License",
1515
"_copy_without_render": [
16-
".github/workflows/**.yaml",
16+
".github/workflows/build.yaml",
17+
".github/workflows/test.yaml",
1718
"docs/_templates/autosummary/**.rst"
1819
],
1920
"_render_devdocs": false,

.github/workflows/test.yaml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
strategy:
1919
fail-fast: false
2020
matrix:
21-
python: ["3.9", "3.10"]
21+
python: ["3.10", "3.12"]
2222
os: [ubuntu-latest]
2323

2424
env:
@@ -49,25 +49,19 @@ jobs:
4949
pip install pytest-cov
5050
- name: Install dependencies
5151
run: |
52-
pip install --pre -e ".[dev,test]"
52+
pip install --pre -e ".[dev,test,pre]"
5353
- name: Test
5454
env:
5555
MPLBACKEND: agg
5656
PLATFORM: ${{ matrix.os }}
5757
DISPLAY: :42
5858
run: |
5959
pytest -v --cov --color=yes --cov-report=xml
60-
# - name: Generate GH action "groundtruth" figures as artifacts, uncomment if needed
61-
# if: always()
62-
# uses: actions/upload-artifact@v3
63-
# with:
64-
# name: groundtruth-figures
65-
# path: /home/runner/work/spatialdata-plot/spatialdata-plot/tests/_images/*
6660
- name: Archive figures generated during testing
6761
if: always()
6862
uses: actions/upload-artifact@v3
6963
with:
70-
name: plotting-results
64+
name: visual_test_results_${{ matrix.os }}-python${{ matrix.python }}
7165
path: /home/runner/work/spatialdata-plot/spatialdata-plot/tests/figures/*
7266
- name: Upload coverage to Codecov
7367
uses: codecov/codecov-action@v4

.mypy.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[mypy]
2-
python_version = 3.9
2+
python_version = 3.10
33
plugins = numpy.typing.mypy_plugin
44

55
ignore_errors = False
@@ -25,4 +25,4 @@ no_warn_no_return = True
2525

2626
show_error_codes = True
2727
show_column_numbers = True
28-
error_summary = True
28+
error_summary = True

.pre-commit-config.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,32 @@ fail_fast: false
22
default_language_version:
33
python: python3
44
default_stages:
5-
- commit
6-
- push
5+
- pre-commit
6+
- pre-push
77
minimum_pre_commit_version: 2.16.0
88
ci:
99
skip: []
1010
repos:
1111
- repo: https://github.com/psf/black
12-
rev: 24.4.2
12+
rev: 24.10.0
1313
hooks:
1414
- id: black
1515
- repo: https://github.com/pre-commit/mirrors-prettier
1616
rev: v4.0.0-alpha.8
1717
hooks:
1818
- id: prettier
1919
- repo: https://github.com/asottile/blacken-docs
20-
rev: 1.18.0
20+
rev: 1.19.1
2121
hooks:
2222
- id: blacken-docs
2323
- repo: https://github.com/pre-commit/mirrors-mypy
24-
rev: v1.10.1
24+
rev: v1.14.0
2525
hooks:
2626
- id: mypy
2727
additional_dependencies: [numpy, types-requests]
2828
exclude: tests/|docs/
2929
- repo: https://github.com/astral-sh/ruff-pre-commit
30-
rev: v0.5.0
30+
rev: v0.8.4
3131
hooks:
3232
- id: ruff
3333
args: [--fix, --exit-non-zero-on-fix]

CHANGELOG.md

Lines changed: 79 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,99 @@ and this project adheres to [Semantic Versioning][].
88
[keep a changelog]: https://keepachangelog.com/en/1.0.0/
99
[semantic versioning]: https://semver.org/spec/v2.0.0.html
1010

11-
## [0.2.4] - tbd
11+
## [0.2.9] - tbd
12+
13+
### Fixed
14+
15+
- Transformations of Points and Shapes are now applied before rendering with datashader (#378)
16+
- Fix bug due to `sc.get.obs_df()` returning a different type (#393)
17+
- Allowing instance mismatch between shapes and tables (#396)
18+
- Fix bug when plotting categorical points with datashader (#395)
19+
20+
## [0.2.8] - 2024-11-26
21+
22+
### Changed
23+
24+
- Support for `xarray.DataTree` (which moved from `datatree.DataTree`) (#380)
25+
26+
## [0.2.7] - 2024-10-24
27+
28+
### Added
29+
30+
- The user can now specify `datashader_reduction` to control the rendering behavior (#309)
31+
- Rendering outlines of shapes with datashader works now (#309)
32+
33+
### Fixed
34+
35+
- datashader now uses canvas size = image size which speeds up the rendering (#309)
36+
- datashader now uses the `linear` as interpolation method for colormaps instead of the default `eq_hist` to make it equivalent to matplotlib (#309)
37+
- point sizes of datashader now agree with matplotlib also when dpi != 100 (#309)
38+
- Giving a custom colormap when rendering a multiscale image now works (#586)
39+
40+
## [0.2.6] - 2024-09-04
41+
42+
### Changed
43+
44+
- Lowered RMSE-threshold for plot-based tests from 45 to 15 (#344)
45+
- When subsetting to `groups`, `NA` isn't automatically added to legend (#344)
46+
- When rendering a single image channel, a colorbar is now shown (#346)
47+
- Removed `percentiles_for_norm` parameter (#346)
48+
- Changed `norm` to no longer accept bools, only `mpl.colors.Normalise` or `None` (#346)
49+
50+
### Fixed
51+
52+
- Filtering with `groups` now preserves original cmap (#344)
53+
- Non-selected `groups` are now not shown in `na_color` (#344)
54+
- Several issues associated with `norm` and `colorbar` (#346)
55+
56+
## [0.2.5] - 2024-08-23
57+
58+
### Changed
59+
60+
- Replaced `outline` parameter in `render_labels` with alpha-based logic (#323)
61+
- Lowered RMSE-threshold for plot-based tests from 60 to 45 (#323)
62+
- Removed `preprocessing` (.pp) accessor (#329)
63+
64+
### Fixed
65+
66+
- Minor fixes for several tests as a result of the threshold change (#323)
67+
68+
## [0.2.4] - 2024-08-07
69+
70+
### Added
71+
72+
- Added utils function for 0-transparent cmaps (#302)
73+
74+
### Fixed
75+
76+
- Took RNG out of categorical label test (#306)
77+
- Performance bug when plotting shapes (#298)
78+
- scale parameter was ignored for single-scale images (#301)
79+
- Changes to support for dask-expr (#283)
80+
- Added error handling for non-existent elements (#305)
81+
- Specifying vmin and vmax properly clips image data (#307)
82+
- import bug `get_cmap()` (8fd969c)
1283

1384
## [0.2.3] - 2024-07-03
1485

86+
### Added
87+
88+
- Datashader support for points and shapes (#244)
89+
1590
### Changed
1691

17-
- All parameters are now provided for a single element. If element in pl.render is None then this value will be broadcasted
92+
- All parameters are now provided for a single element (#272)
1893

1994
### Fixed
2095

2196
- Fix color assignment for NaN values (#257)
22-
- Fix channel str support #221
97+
- Zorder of rendering now strictly follows the order of the render_x calls (#244)
2398

2499
## [0.2.2] - 2024-05-02
25100

26101
### Fixed
27102

28-
- Fixed `fill_alpha` ignoring `alpha` channel from custom cmap
103+
- Fixed `fill_alpha` ignoring `alpha` channel from custom cmap (#236)
29104
- Fix channel str support (#221)
30105

31106
## [0.2.1] - 2024-03-26

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ For more information on the `spatialdata-plot` library, please refer to the [doc
3131

3232
## Installation
3333

34-
You need to have Python 3.9 or newer installed on your system. If you don't have
34+
You need to have Python 3.10 or newer installed on your system. If you don't have
3535
Python installed, we recommend installing [Mambaforge](https://github.com/conda-forge/miniforge#mambaforge).
3636

3737
There are several alternative options to install spatialdata-plot:

docs/conf.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Configuration file for the Sphinx documentation builder.
2-
#
2+
33
# This file only contains a selection of the most common options. For a full
44
# list see the documentation:
55
# https://www.sphinx-doc.org/en/master/usage/configuration.html
@@ -37,10 +37,10 @@
3737

3838
html_context = {
3939
"display_github": True, # Integrate GitHub
40-
"github_user": "scverse", # Username
41-
"github_repo": project_name, # Repo name
42-
"github_version": "main", # Version
43-
"conf_py_path": "/docs/", # Path in the checkout to the docs root
40+
"github_user": "scverse",
41+
"github_repo": "https://github.com/scverse/spatialdata-plot",
42+
"github_version": "main",
43+
"conf_py_path": "/docs/",
4444
}
4545

4646
# -- General configuration ---------------------------------------------------

docs/contributing.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ and [prettier][prettier-editors].
5151
## Writing tests
5252

5353
```{note}
54-
Remember to first install the package with `pip install '-e[dev,test]'`
54+
Remember to first install the package with `pip install -e '.[dev,test]'`
5555
```
5656

5757
This package uses the [pytest][] for automated testing. Please [write tests][scanpy-test-docs] for every function added
@@ -78,6 +78,16 @@ out to the developers of the dependency before the package is released to a wide
7878

7979
[scanpy-test-docs]: https://scanpy.readthedocs.io/en/latest/dev/testing.html#writing-tests
8080

81+
### Testing the correctness of the plots
82+
83+
Many tests will produce plots and check that they are correct by comparing them with a previously saved and serialized version of the same plots. The ground truth images are located in `tests/_images`. Different OS/versions may produce similar but not identical plots (for instance the ticks/padding could vary). To take into account for this please consider the following:
84+
85+
- you should not use locally generated plots as ground truth images, but you should commit images that have been generated by a GitHub Action. The recommended workflow is to go to the ["actions" page for the repo](https://github.com/scverse/spatialdata-plot/actions/workflows/test.yaml), download the artifacts, and upload them as ground truth (after having reviewed them).
86+
- the ground truth images need to be updated when a new test is passing, or when a test starts producing a slightly different (but consistent) plot.
87+
- please never replace the ground truth images without having manually reviewed them.
88+
- if you run the tests locally in macOS or Windows they will likely fail because the ground truth images are generated using Ubuntu. To overcome this you can use `act`, which will generate a Docker reproducing the environment used in the GitHub Action. After the Docker container is generated you can use it within IDEs to run tests and debug code.
89+
- in the case of PyCharm, it is easier to create a container from a `Dockerfile` instead of using `act`. Please in such case use the `Dockerfile` made availabel in the repository. If you encountering problems with `act` or `docker`, please [get in touch with the developers via Zulip](https://scverse.zulipchat.com/#narrow/channel/443514-spatialdata-dev) and we will help troubleshoot the issue. See also additional details [here](https://github.com/scverse/spatialdata-plot/pull/397).
90+
8191
## Publishing a release
8292

8393
### Updating the version number
@@ -93,7 +103,7 @@ Before making a release, you need to update the version number in the `pyproject
93103
> Additional labels for pre-release and build metadata are available as extensions to the MAJOR.MINOR.PATCH format.
94104
95105
Once you are done, commit and push your changes and navigate to the "Releases" page of this project on GitHub.
96-
Specify `vX.X.X` as a tag name and create a release. For more information, see [managing Github releases][]. This will automatically create a git tag and trigger a Github workflow that creates a release on PyPI.
106+
Specify `vX.X.X` as a tag name and create a release. For more information, see [managing GitHub releases][]. This will automatically create a git tag and trigger a Github workflow that creates a release on PyPI.
97107

98108
## Writing documentation
99109

@@ -157,3 +167,4 @@ open _build/html/index.html
157167
[numpydoc]: https://numpydoc.readthedocs.io/en/latest/format.html
158168
[sphinx autodoc typehints]: https://github.com/tox-dev/sphinx-autodoc-typehints
159169
[pypi]: https://pypi.org/
170+
[managing GitHub releases]: https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository

docs/index.md.rej

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

0 commit comments

Comments
 (0)