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
116 changes: 52 additions & 64 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Test and Deploy bioimageio.core

on:
push:
branches: [ main ]
branches: [main]
pull_request:
branches: [ "**" ]
branches: ['**']

defaults:
run:
Expand Down Expand Up @@ -58,81 +58,69 @@ jobs:
matrix:
include:
- python-version: '3.9'
conda-env: dev
spec: conda
numpy-version: 1
- python-version: '3.9'
conda-env: dev
spec: main
numpy-version: 2
- python-version: '3.10'
conda-env: full
run-expensive-tests: true
report-coverage: true
save-cache: true
spec: conda
numpy-version: 1
- python-version: '3.11'
conda-env: dev
spec: main
numpy-version: 2
- python-version: '3.12'
conda-env: dev
spec: conda
numpy-version: 1
# - python-version: '3.13'
# conda-env: '313'
# spec: main
# numpy-version: 2

steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v6
with:
python-version: ${{matrix.python-version}}
cache: 'pip'
- name: Install dependencies
run: |
pip install --upgrade pip
pip install -e .[dev] numpy==${{matrix.numpy-version}}.*
- name: Pyright
if: matrix.run-expensive-tests
run: |
pyright --version
pyright -p pyproject.toml --pythonversion ${{ matrix.python-version }}
- name: Restore bioimageio cache ${{needs.populate-cache.outputs.cache-key}}
uses: actions/cache/restore@v4
with:
path: bioimageio_cache
key: ${{needs.populate-cache.outputs.cache-key}}
- name: pytest
run: pytest --cov bioimageio --cov-report xml --cov-append --capture no --disable-pytest-warnings
env:
BIOIMAGEIO_CACHE_PATH: bioimageio_cache
RUN_EXPENSIVE_TESTS: ${{ matrix.run-expensive-tests && 'true' || 'false' }}
- name: Save bioimageio cache ${{needs.populate-cache.outputs.cache-key}}
if: matrix.save-cache
uses: actions/cache/save@v4
with:
path: bioimageio_cache
key: ${{needs.populate-cache.outputs.cache-key}}
- uses: actions/checkout@v4
- uses: actions/setup-python@v6
with:
python-version: ${{matrix.python-version}}
cache: 'pip'
- name: Install dependencies
run: |
pip install --upgrade pip
pip install -e .[dev] numpy==${{matrix.numpy-version}}.*
- name: Pyright
if: matrix.run-expensive-tests # pyright is not expensive, but we only want to run it once due to otherwise inconsistent typing
run: |
pyright --version
pyright -p pyproject.toml --pythonversion ${{ matrix.python-version }}
- name: Restore bioimageio cache ${{needs.populate-cache.outputs.cache-key}}
uses: actions/cache/restore@v4
with:
path: bioimageio_cache
key: ${{needs.populate-cache.outputs.cache-key}}
- name: pytest
run: pytest --cov bioimageio --cov-report xml --cov-append --capture no --disable-pytest-warnings
env:
BIOIMAGEIO_CACHE_PATH: bioimageio_cache
RUN_EXPENSIVE_TESTS: ${{ matrix.run-expensive-tests && 'true' || 'false' }}
- name: Save bioimageio cache ${{needs.populate-cache.outputs.cache-key}}
if: matrix.save-cache
uses: actions/cache/save@v4
with:
path: bioimageio_cache
key: ${{needs.populate-cache.outputs.cache-key}}

- if: matrix.report-coverage && github.event_name == 'pull_request'
uses: orgoro/coverage@v3.2
with:
coverageFile: coverage.xml
token: ${{secrets.GITHUB_TOKEN}}
- if: matrix.report-coverage && github.ref == 'refs/heads/main'
run: |
pip install genbadge[coverage]
genbadge coverage --input-file coverage.xml --output-file ./dist/coverage/coverage-badge.svg
coverage html -d dist/coverage
- if: matrix.report-coverage && github.ref == 'refs/heads/main'
uses: actions/upload-artifact@v4
with:
name: coverage
retention-days: 1
path: dist
- if: matrix.report-coverage && github.event_name == 'pull_request'
uses: orgoro/coverage@v3.2
with:
coverageFile: coverage.xml
token: ${{secrets.GITHUB_TOKEN}}
- if: matrix.report-coverage && github.ref == 'refs/heads/main'
run: |
pip install genbadge[coverage]
genbadge coverage --input-file coverage.xml --output-file ./dist/coverage/coverage-badge.svg
coverage html -d dist/coverage
- if: matrix.report-coverage && github.ref == 'refs/heads/main'
uses: actions/upload-artifact@v4
with:
name: coverage
retention-days: 1
path: dist

conda-build:
needs: test
Expand All @@ -145,7 +133,7 @@ jobs:
with:
auto-update-conda: true
auto-activate-base: true
activate-environment: ""
activate-environment: ''
channel-priority: strict
miniforge-version: latest
conda-solver: libmamba
Expand Down Expand Up @@ -242,14 +230,14 @@ jobs:
uses: pypa/gh-action-pypi-publish@release/v1.12
with:
user: __token__
password: "${{ secrets.PYPI_TOKEN }}"
password: '${{ secrets.PYPI_TOKEN }}'
packages-dir: dist/
verbose: true
- name: Publish the release notes
if: github.ref == 'refs/heads/main'
uses: release-drafter/release-drafter@v6.0.0
with:
publish: "${{ steps.tag-version.outputs.new_tag != '' }}"
tag: "${{ steps.tag-version.outputs.new_tag }}"
tag: '${{ steps.tag-version.outputs.new_tag }}'
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
4 changes: 0 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
repos:
- repo: https://github.com/ambv/black
rev: 25.1.0
hooks:
- id: black-jupyter
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.12.8
hooks:
Expand Down
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -364,9 +364,16 @@ may be controlled with the `LOGURU_LEVEL` environment variable.

## Changelog

### 0.9.3

- bump bioimageio.spec library version to 0.5.5.5
- more robust test model reporting
- improved user input axis intepretation
- fixed conda subprocess calls

### 0.9.2

fix model inference tolerance reporting
- fix model inference tolerance reporting

### 0.9.1

Expand Down
14 changes: 8 additions & 6 deletions example/dataset_statistics_demo.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -329,12 +329,14 @@
"source": [
"# compute dataset statistics on all samples\n",
"# (in this case we should really use the non-overlapping tiles as samples in dataset_for_initial_statistics)\n",
"with create_prediction_pipeline(\n",
" bioimageio_model=model_resource,\n",
" dataset_for_initial_statistics=dataset,\n",
" update_dataset_stats_for_n_samples=0, # if you call the prediciton pipeline more then len(dataset)\n",
" # times you might want to set this to zero to avoid further updates to the dataset statistics\n",
") as pp:\n",
"with (\n",
" create_prediction_pipeline(\n",
" bioimageio_model=model_resource,\n",
" dataset_for_initial_statistics=dataset,\n",
" update_dataset_stats_for_n_samples=0, # if you call the prediciton pipeline more then len(dataset)\n",
" # times you might want to set this to zero to avoid further updates to the dataset statistics\n",
" ) as pp\n",
"):\n",
" only_init_dataset_stats = process_dataset(pp, dataset)"
]
},
Expand Down
1 change: 0 additions & 1 deletion example/model_usage.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@
" Mapping[str, NDArray[Any]], Mapping[TensorId, Union[Tensor, NDArray[Any]]]\n",
" ],\n",
") -> None:\n",
"\n",
" for title, image in images.items():\n",
" if isinstance(image, Tensor):\n",
" input_array = image.data.data\n",
Expand Down
11 changes: 2 additions & 9 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ requires-python = ">=3.9"
readme = "README.md"
dynamic = ["version"]
dependencies = [
"bioimageio.spec ==0.5.5.4",
"bioimageio.spec ==0.5.5.5",
"h5py",
"imagecodecs",
"imageio>=2.10",
Expand Down Expand Up @@ -44,15 +44,14 @@ onnx = ["onnxruntime"]
pytorch = ["torch>=1.6,<3", "torchvision>=0.21", "keras>=3.0,<4"]
tensorflow = ["tensorflow", "keras>=2.15,<4"]
dev = [
"black",
"cellpose", # for model testing
"crick",
"httpx",
"jupyter-black",
"jupyter",
"keras>=3.0,<4",
"matplotlib",
"monai", # for model testing
"numpy",
"onnx",
"onnxruntime",
"packaging>=17.0",
Expand All @@ -79,12 +78,6 @@ where = ["src/"]
[tool.setuptools.dynamic]
version = { attr = "bioimageio.core.__version__" }

[tool.black]
line-length = 88
extend-exclude = "/presentations/"
target-version = ["py39", "py310", "py311", "py312"]
preview = true

[tool.pyright]
exclude = [
"**/__pycache__",
Expand Down
2 changes: 1 addition & 1 deletion src/bioimageio/core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""
# ruff: noqa: E402

__version__ = "0.9.2"
__version__ = "0.9.3"
from loguru import logger

logger.disable("bioimageio.core")
Expand Down
22 changes: 16 additions & 6 deletions src/bioimageio/core/_magic_tensor_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,14 @@ def __ge__(self, other: _Compatible) -> Self:

def __eq__(self, other: _Compatible) -> Self: # type: ignore[override]
return self._binary_op(
other, nputils.array_eq # pyright: ignore[reportUnknownArgumentType]
other,
nputils.array_eq, # pyright: ignore[reportUnknownArgumentType]
)

def __ne__(self, other: _Compatible) -> Self: # type: ignore[override]
return self._binary_op(
other, nputils.array_ne # pyright: ignore[reportUnknownArgumentType]
other,
nputils.array_ne, # pyright: ignore[reportUnknownArgumentType]
)

# When __eq__ is defined but __hash__ is not, then an object is unhashable,
Expand Down Expand Up @@ -171,22 +173,30 @@ def __invert__(self) -> Self:

def round(self, *args: Any, **kwargs: Any) -> Self:
return self._unary_op(
ops.round_, *args, **kwargs # pyright: ignore[reportUnknownArgumentType]
ops.round_, # pyright: ignore[reportUnknownArgumentType]
*args,
**kwargs,
)

def argsort(self, *args: Any, **kwargs: Any) -> Self:
return self._unary_op(
ops.argsort, *args, **kwargs # pyright: ignore[reportUnknownArgumentType]
ops.argsort, # pyright: ignore[reportUnknownArgumentType]
*args,
**kwargs,
)

def conj(self, *args: Any, **kwargs: Any) -> Self:
return self._unary_op(
ops.conj, *args, **kwargs # pyright: ignore[reportUnknownArgumentType]
ops.conj, # pyright: ignore[reportUnknownArgumentType]
*args,
**kwargs,
)

def conjugate(self, *args: Any, **kwargs: Any) -> Self:
return self._unary_op(
ops.conjugate, *args, **kwargs # pyright: ignore[reportUnknownArgumentType]
ops.conjugate, # pyright: ignore[reportUnknownArgumentType]
*args,
**kwargs,
)

__add__.__doc__ = operator.add.__doc__
Expand Down
Loading
Loading