Skip to content

Commit

Permalink
Merge pull request #7 from AstraZeneca/zarr-3
Browse files Browse the repository at this point in the history
Upgrade to zarr-python 3
  • Loading branch information
pmplewa authored Feb 5, 2025
2 parents 3c4e50e + 13ed2b1 commit 5588b60
Show file tree
Hide file tree
Showing 38 changed files with 3,787 additions and 4,882 deletions.
16 changes: 0 additions & 16 deletions .github/release.yml

This file was deleted.

80 changes: 25 additions & 55 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,97 +4,67 @@ on:
push:
branches:
- main
tags:
- 'v*'
pull_request:
branches:
- main
workflow_dispatch:

env:
POETRY_VERSION: 1.6.1
UV_VERSION: '0.5.26'

jobs:
check:
name: Check
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Install poetry
run: pipx install poetry==$POETRY_VERSION

- name: Set up python
uses: actions/setup-python@v4
- uses: actions/checkout@v4

# Note: We need to manually install uv because this action is not whitelisted.
# - name: Install uv
# uses: astral-sh/setup-uv@v5
# with:
# version: ${{ env.UV_VERSION }}
# enable-cache: true
# cache-dependency-glob: 'uv.lock'
- name: Install uv
run: pipx install uv==$UV_VERSION

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: 'poetry'
python-version-file: '.python-version'

- name: Install dependencies
run: poetry install
run: uv sync --all-extras --dev

- name: Run checks
run: poetry run invoke check
run: uv run invoke check

test:
needs: [check]
name: Test py${{ matrix.python-version }}
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10', '3.11']
python-version: ['3.11', '3.12']

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Install poetry
run: pipx install poetry==$POETRY_VERSION
- name: Install uv
run: pipx install uv==$UV_VERSION

- name: Set up python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'poetry'

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install qtbase5-dev xvfb
poetry install
poetry run pip install pyqt5
uv sync --all-extras --dev
- name: Run tests
run: poetry run xvfb-run invoke test

release:
needs: [test]
name: Release
runs-on: ubuntu-latest
if: contains(github.ref, 'tags')

steps:
- uses: actions/checkout@v3

- name: Install poetry
run: pipx install poetry==$POETRY_VERSION

- name: Set up python
uses: actions/setup-python@v4
with:
python-version: '3.10'

- name: Build distribution
run: poetry build

- name: Create release
run: |
VERSION="${GITHUB_REF/refs\/tags\/}"
if [[ "$VERSION" != *"rc"* ]]; then
gh release create $VERSION --verify-tag --generate-notes
else
gh release create $VERSION --verify-tag --generate-notes --prerelease
fi
gh release upload $VERSION dist/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: xvfb-run uv run invoke test
81 changes: 10 additions & 71 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,84 +1,23 @@
# Byte-compiled / optimized / DLL files
# Python
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
develop-eggs/
# Distribution / Packaging
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Caches
.mypy_cache/
.pytest_cache/
.ruff_cache/

# Unit test / coverage reports
htmlcov/
.tox/
# Testing
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover
.hypothesis/
.napari_cache

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py

# Flask instance folder
instance/

# Sphinx documentation
docs/_build/

# MkDocs documentation
/site/

# PyBuilder
target/

# Pycharm and VSCode
# IDEs
.conda/
.idea/
.venv/
venv/
.vscode/

# IPython Notebook
.ipynb_checkpoints

# pyenv
.python-version

# OS
.DS_Store

# written by setuptools_scm
**/_version.py
37 changes: 9 additions & 28 deletions .napari-hub/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,17 @@
# Description

This [napari] plugin provides a reader for various whole slide image formats.

By default, any of the following formats is read using the [tifffile] library.
If the image file contains a tag `GDAL_METADATA`, the [rasterio] library is used
instead.

- .bif
- .ndpi
- .qptiff
- .scn
- .svs
- .tif
- .tiff
This [napari] plugin provides a widget for reading various whole-slide image
formats using a common [zarr] store inteface, based on the libraries
[openslide], [rasterio], and [wsidicom].

# Quickstart

From the terminal:

```bash
napari CMU-1.svs
```

From python:

```python
import napari

viewer = napari.Viewer()
viewer.open("CMU-1.svs")
```
After installation, open the `Plugins` menu in the viewer and select
`WSI Reader` to open the widget. Then select a `Backend` to use, select a `Path`
to open, and click `Load`.

[napari]: https://github.com/napari/napari
[openslide]: https://github.com/openslide/openslide-python
[rasterio]: https://github.com/rasterio/rasterio
[tifffile]: https://github.com/cgohlke/tifffile
[wsidicom]: https://github.com/imi-bigpicture/wsidicom
[zarr]: https://github.com/zarr-developers/zarr-python
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.11
7 changes: 7 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"python.testing.pytestArgs": [
"tests"
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true
}
21 changes: 8 additions & 13 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,19 @@ example.

## Setting up a development environment

This project uses [poetry] packaging and dependency management.
This project uses [uv] for packaging and dependency management. To install the
full set of dependencies needed for developement, run:

```bash
poetry install
poetry run pip install pyqt5
poetry run napari
uv sync --all-extras --dev
```

Note: `pyqt5` is not a direct dependency of this plugin, but is necessary to run
napari (see the [napari installation guide]).

## Running checks and tests
To run a code formatter, a linter and all unit tests, run:

```bash
poetry run invoke check
poetry run invoke test
uv run invoke fix
uv run invoke check
uv run invoke test
```

[napari installation guide]:
https://napari.org/stable/tutorials/fundamentals/installation.html#choosing-a-different-qt-backend
[poetry]: https://python-poetry.org/
[uv]: https://github.com/astral-sh/uv
Loading

0 comments on commit 5588b60

Please sign in to comment.