Skip to content
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
22 changes: 18 additions & 4 deletions .cruft.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"template": "https://github.com/scverse/cookiecutter-scverse",
"commit": "87a407a65408d75a949c0b54b19fd287475a56f8",
"checkout": "v0.4.0",
"commit": "6ff5b92b5d44ea6d8a88e47538475718d467db95",
"checkout": "v0.7.0",
"context": {
"cookiecutter": {
"project_name": "spatialdata-plot",
Expand All @@ -10,19 +10,33 @@
"author_full_name": "scverse",
"author_email": "scverse",
"github_user": "scverse",
"project_repo": "https://github.com/scverse/spatialdata-plot",
"github_repo": "spatialdata-plot",
"license": "BSD 3-Clause License",
"ide_integration": false,
"_copy_without_render": [
".github/workflows/build.yaml",
".github/workflows/test.yaml",
"docs/_templates/autosummary/**.rst"
],
"_exclude_on_template_update": [
"CHANGELOG.md",
"LICENSE",
"README.md",
"docs/api.md",
"docs/index.md",
"docs/notebooks/example.ipynb",
"docs/references.bib",
"docs/references.md",
"src/**",
"tests/**"
],
"_render_devdocs": false,
"_jinja2_env_vars": {
"lstrip_blocks": true,
"trim_blocks": true
},
"_template": "https://github.com/scverse/cookiecutter-scverse"
"_template": "https://github.com/scverse/cookiecutter-scverse",
"_commit": "6ff5b92b5d44ea6d8a88e47538475718d467db95"
}
},
"directory": null
Expand Down
5 changes: 1 addition & 4 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.{yml,yaml}]
indent_size = 2

[.cruft.json]
[{*.{yml,yaml,toml},.cruft.json}]
indent_size = 2

[Makefile]
Expand Down
41 changes: 41 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Bug report
description: Report something that is broken or incorrect
type: Bug
body:
- type: markdown
attributes:
value: |
**Note**: Please read [this guide](https://matthewrocklin.com/blog/work/2018/02/28/minimal-bug-reports)
detailing how to provide the necessary information for us to reproduce your bug. In brief:
* Please provide exact steps how to reproduce the bug in a clean Python environment.
* In case it's not clear what's causing this bug, please provide the data or the data generation procedure.
* Replicate problems on public datasets or share data subsets when full sharing isn't possible.

- type: textarea
id: report
attributes:
label: Report
description: A clear and concise description of what the bug is.
validations:
required: true

- type: textarea
id: versions
attributes:
label: Versions
description: |
Which version of packages.

Please install `session-info2`, run the following command in a notebook,
click the "Copy as Markdown" button, then paste the results into the text box below.

```python
In[1]: import session_info2; session_info2.session_info(dependencies=True)
```

Alternatively, run this in a console:

```python
>>> import session_info2; print(session_info2.session_info(dependencies=True)._repr_mimebundle_()["text/markdown"])
```
render: python
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Scverse Community Forum
url: https://discourse.scverse.org/
about: If you have questions about "How to do X", please ask them here.
11 changes: 11 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Feature request
description: Propose a new feature for spatialdata-plot
type: Enhancement
body:
- type: textarea
id: description
attributes:
label: Description of feature
description: Please describe your suggestion for a new feature. It might help to describe a problem or use case, plus any alternatives that you have considered.
validations:
required: true
26 changes: 26 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Check Build

on:
push:
branches: [main]
pull_request:
branches: [main]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
package:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
filter: blob:none
fetch-depth: 0
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Build package
run: uv build
- name: Check package
run: uvx twine check --strict dist/*.whl
51 changes: 33 additions & 18 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,43 @@ on:
release:
types: [published]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
package_and_release:
build:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.12
uses: actions/setup-python@v5
- uses: actions/checkout@v5
with:
python-version: "3.12"
cache: pip
- name: Install build dependencies
run: python -m pip install --upgrade pip wheel twine build
filter: blob:none
fetch-depth: 0
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Build package
run: python -m build
run: uv build
- name: Check package
run: twine check --strict dist/*.whl
- name: Install hatch
run: pip install hatch
- name: Build project for distribution
run: hatch build
- name: Publish a Python distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
run: uvx twine check --strict dist/*
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
password: ${{ secrets.PYPI_API_TOKEN }}
name: dist
path: dist/

publish:
needs: build
runs-on: ubuntu-latest
permissions:
id-token: write # for PyPI trusted publishing
environment:
name: pypi
url: https://pypi.org/p/spatialdata-plot
steps:
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: dist
path: dist/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
137 changes: 88 additions & 49 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,73 +3,112 @@ name: Test
on:
push:
branches: [main]
tags: ["v*"] # Push events to matching v*, i.e. v1.0, v20.15.10
tags: ["v*"]
pull_request:
branches: ["*"]
branches: [main]
schedule:
- cron: "0 5 1,15 * *"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
MPLBACKEND: agg

jobs:
test:
# Dynamically extract the test matrix from hatch so pyproject.toml is the single source of truth.
# See [[tool.hatch.envs.hatch-test.matrix]] in pyproject.toml.
get-environments:
runs-on: ubuntu-latest
outputs:
envs: ${{ steps.get-envs.outputs.envs }}
steps:
- uses: actions/checkout@v5
with:
filter: blob:none
fetch-depth: 0
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Get test environments
id: get-envs
run: |
ENVS_JSON=$(uvx hatch env show --json | jq -c 'to_entries
| map(
select(.key | startswith("hatch-test"))
| {
name: .key,
label: (if (.key | contains("pre")) then .key + " (PRE-RELEASE DEPENDENCIES)" else .key end),
python: .value.python
}
)')
echo "envs=${ENVS_JSON}" | tee $GITHUB_OUTPUT

test:
needs: get-environments
permissions:
id-token: write # for codecov OIDC

strategy:
fail-fast: false
matrix:
env: ["dev-py311", "dev-py313"]
os: [ubuntu-latest]
env: ${{ fromJSON(needs.get-environments.outputs.envs) }}

# Configure pytest-xdist
env:
OMP_NUM_THREADS: "1"
OPENBLAS_NUM_THREADS: "1"
MKL_NUM_THREADS: "1"
NUMEXPR_MAX_THREADS: "1"
MPLBACKEND: "agg"
DISPLAY: ":42"
PYTEST_ADDOPTS: "-n auto --dist=load --durations=10"
name: ${{ matrix.env.label }}
runs-on: ${{ matrix.os }}
continue-on-error: ${{ contains(matrix.env.name, 'pre') }}

steps:
- uses: actions/checkout@v4

# Cache rattler's shared package cache (speeds up downloads)
- name: Restore rattler cache
uses: actions/cache@v4
- uses: actions/checkout@v5
with:
path: ~/.cache/rattler
key: rattler-${{ runner.os }}-${{ matrix.env }}-${{ hashFiles('pyproject.toml') }}
restore-keys: |
rattler-${{ runner.os }}-${{ matrix.env }}-
rattler-${{ runner.os }}-

# Install pixi and the requested environment
- uses: prefix-dev/setup-pixi@v0.9.0
filter: blob:none
fetch-depth: 0
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
environments: ${{ matrix.env }}
# We're not comitting the pixi-lock file
locked: false
cache: false
activate-environment: ${{ matrix.env }}

- name: Show versions
run: |
python --version
pixi --version

python-version: ${{ matrix.env.python }}
- name: Ensure figure directory exists
run: mkdir -p tests/figures
- name: Create hatch environment
run: uvx hatch env create ${{ matrix.env.name }}
- name: Run tests
env:
MPLBACKEND: agg
DISPLAY: ":42"
run: >-
uvx hatch run ${{ matrix.env.name }}:${{
matrix.env.name == 'hatch-test.py3.14-stable' && 'run-cov' || 'run'
}} -v --color=yes ${{
matrix.env.name == 'hatch-test.py3.14-stable' && ' ' || '-n auto'
}}
- name: Generate coverage report
if: matrix.env.name == 'hatch-test.py3.14-stable'
run: |
pytest -v --cov --color=yes --cov-report=xml

- name: Archive figures generated during testing
test -f .coverage || uvx hatch run ${{ matrix.env.name }}:cov-combine
uvx hatch run ${{ matrix.env.name }}:cov-report
- name: Archive visual test figures
if: always()
uses: actions/upload-artifact@v4
with:
name: visual_test_results_${{ matrix.env }}
path: /home/runner/work/spatialdata-plot/spatialdata-plot/tests/figures/*
name: visual_test_results_${{ matrix.env.name }}
path: tests/figures/*
- name: Upload coverage
if: matrix.env.name == 'hatch-test.py3.14-stable'
uses: codecov/codecov-action@v5
with:
fail_ci_if_error: true
use_oidc: true

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
# Single required check for branch protection.
# See https://github.com/re-actors/alls-green#why
check:
name: Tests pass in all hatch environments
if: always()
needs:
- get-environments
- test
runs-on: ubuntu-latest
steps:
- uses: re-actors/alls-green@release/v1
with:
name: coverage
verbose: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
jobs: ${{ toJSON(needs) }}
5 changes: 1 addition & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ buck-out/
# Compiled files
.venv/
__pycache__/
.mypy_cache/
.ruff_cache/
.*cache/
/node_modules

# Distribution / packaging
Expand All @@ -16,7 +15,6 @@ __pycache__/
/*.egg-info/

# Tests and coverage
/.pytest_cache/
/.cache/
/data/
*failed-diff.png
Expand All @@ -31,7 +29,6 @@ __pycache__/

format.sh


# test
tests/figures/

Expand Down
Loading
Loading