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
6 changes: 3 additions & 3 deletions .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ name: Benchmarks
on:
pull_request:
types: [labeled]
schedule:
- cron: "6 6 * * 0" # every sunday
# schedule:
# - cron: "6 6 * * 0" # every sunday
workflow_dispatch:
inputs:
base_ref:
Expand Down Expand Up @@ -140,7 +140,7 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PLATFORM: ${{ matrix.runs-on }}
PYTHON: "3.9"
PYTHON: "3.11"
BACKEND: ${{ matrix.benchmark-name }}
RUN_ID: ${{ github.run_id }}
TITLE: "[test-bot] Benchmark tests failing"
Expand Down
77 changes: 1 addition & 76 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
fail-fast: false
matrix:
platform: [ubuntu-latest, macos-latest] # [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.10", "3.12"]
python-version: ["3.11", "3.13"]

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -70,78 +70,3 @@ jobs:
with:
name: plotting-results-${{ matrix.python-version }}-${{ matrix.platform }}
path: /Users/runner/work/napari-spatialdata/napari-spatialdata/tests/plots/generated/*

test_benchmarks:
name: test benchmarks
runs-on: ubuntu-latest
timeout-minutes: 60
env:
GIT_LFS_SKIP_SMUDGE: 1
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.ref }}

- uses: actions/setup-python@v5
with:
python-version: 3.11
cache-dependency-path: pyproject.toml

- name: Install dependencies with 'pre' extras (since the above doesn't check pre-releases)
run: |
python -m pip install --upgrade pip
pip install .[pre]

- uses: tlambert03/setup-qt-libs@v1

- uses: octokit/[email protected]
# here we get hash of the latest release commit to compare with PR
id: latest_release
with:
route: GET /repos/{owner}/{repo}/releases/latest
owner: scverse
repo: napari-spatialdata
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: install dependencies
run: |
pip install --upgrade pip
pip install "asv[virtualenv]"
env:
PIP_CONSTRAINT: benchmarks/benchmark.txt

- name: asv machine
run: asv machine --yes

- name: Run benchmarks PR
uses: aganders3/headless-gui@v2
with:
run: |
asv run --show-stderr --quick --attribute timeout=300 HEAD^!
env:
PR: 1 # prevents asv from running very compute-intensive benchmarks
PIP_CONSTRAINT: ${{ github.workspace }}/benchmarks/benchmark.txt

- name: Fetch latest main
run: git fetch origin main

- name: Fetch latest release commit
run: git fetch origin ${{ fromJSON(steps.latest_release.outputs.data).target_commitish }}

- name: Ensure local main exists
run: |
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
if [ "$CURRENT_BRANCH" != "main" ]; then
git branch main origin/main
fi

- name: Run benchmarks latest release
uses: aganders3/headless-gui@v2
with:
run: |
asv run --show-stderr --quick --attribute timeout=300 ${{ fromJSON(steps.latest_release.outputs.data).target_commitish }}^!
env:
PR: 1 # prevents asv from running very compute-intensive benchmarks
PIP_CONSTRAINT: ${{ github.workspace }}/benchmarks/benchmark.txt
2 changes: 1 addition & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: 2
build:
os: ubuntu-22.04
tools:
python: "3.10"
python: "3.11"
sphinx:
configuration: docs/conf.py
fail_on_warning: false
Expand Down
2 changes: 1 addition & 1 deletion asv.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
// Install using default qt install
"build_command": ["python -V"], // skip build stage
"install_command": [
"in-dir={env_dir} python -m pip install {build_dir}[all,test]"
"in-dir={env_dir} python -m pip install --pre {build_dir}[all,test,pre]"
],
"uninstall_command": [
"in-dir={env_dir} python -m pip uninstall -y {project}"
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/benchmark.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ json5==0.9.25
# via asv
mamba==0.11.3
# via -r benchmark.in
packaging==24.1
packaging>=24.2
# via
# asv
# build
Expand Down
20 changes: 10 additions & 10 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,29 @@ classifiers =
Topic :: Software Development :: Testing
Programming Language :: Python
Programming Language :: Python :: 3
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Programming Language :: Python :: 3.12
Programming Language :: Python :: 3.13
Operating System :: OS Independent
License :: OSI Approved :: BSD License


[options]
packages = find:
include_package_data = True
python_requires = >=3.10
python_requires = >=3.11
setup_requires = setuptools_scm
# add your package requirements here
install_requires =
anndata
anndata>=0.12.0
click
cycler
dask>=2024.4.1,<=2024.11.2
dask>=2025.2.0
geopandas
loguru
matplotlib
napari>=0.6.2
napari-matplotlib
napari-matplotlib>=3.0.2
numba
numpy
packaging
Expand All @@ -54,7 +54,7 @@ install_requires =
scipy
shapely
scikit-learn
spatialdata>=0.2.6
spatialdata>=0.7.0dev0
superqt
typing_extensions>=4.8.0
vispy
Expand All @@ -80,8 +80,8 @@ test =
doc =
sphinx>=4.5
sphinx-book-theme>=1.0.0
myst-parser
sphinxcontrib-bibtex>=1.0.0
myst-parser>=2.0.0
sphinxcontrib-bibtex>=2.5.0
sphinx-autodoc-typehints>=1.11.0
sphinx-autobuild
scanpydoc
Expand All @@ -90,7 +90,7 @@ doc =
ipython
sphinx-copybutton
sphinx-qt-documentation
myst-nb
myst-nb>=1.0.0
# used in the notebooks
squidpy

Expand All @@ -99,7 +99,7 @@ readthedocs =

# this is just to trigger pip to check for pre-releases as well
pre =
spatialdata>=0.1.0-pre0
spatialdata>=0.7.0dev0

all =
napari[pyqt5]
Expand Down
13 changes: 7 additions & 6 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
TOL = 70
DPI = 40

RNG = np.random.default_rng(seed=0)
DATA_LEN = 100


Expand Down Expand Up @@ -148,9 +147,10 @@ def labels():

@pytest.fixture
def prepare_continuous_test_data():
x_vec = RNG.random(DATA_LEN)
y_vec = RNG.random(DATA_LEN)
color_vec = RNG.random(DATA_LEN)
rng = np.random.default_rng(SEED)
x_vec = rng.random(DATA_LEN)
y_vec = rng.random(DATA_LEN)
color_vec = rng.random(DATA_LEN)

x_data = {"vec": x_vec}
y_data = {"vec": y_vec}
Expand All @@ -164,8 +164,9 @@ def prepare_continuous_test_data():

@pytest.fixture
def prepare_discrete_test_data():
x_vec = RNG.random(DATA_LEN)
y_vec = RNG.random(DATA_LEN)
rng = np.random.default_rng(SEED)
x_vec = rng.random(DATA_LEN)
y_vec = rng.random(DATA_LEN)
color_vec = np.zeros(DATA_LEN).astype(int)

x_data = {"vec": x_vec}
Expand Down
5 changes: 3 additions & 2 deletions tests/test_scatterwidgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,9 @@ def test_hover_highlight_cont(plot_widget, prepare_continuous_test_data):
assert plot_widget.hovered_point.data[0][1] == y_data["vec"][0]

plot_widget.update_hover_highlight(-1, -1)
assert plot_widget.data_point_label.text() == "Value: N/A"
assert plot_widget.hovered_point.data.size == 0
# plot_widget.grab().save('hover.png')
assert plot_widget.data_point_label.text() == "Value: 0.4258820863735099"
assert plot_widget.hovered_point.data.size == 1


def test_clear_hover_highlight(plot_widget, prepare_discrete_test_data):
Expand Down
Loading