Skip to content

Commit

Permalink
Make tensorstore optional (#44)
Browse files Browse the repository at this point in the history
* Make tensorstore optional, rename to open_zarr
* Make tensorstore an optional dependency
* Remove unused imports
* Remove outdated unused class
* Update test workflow
* Fix tox.ini
* Use mode='a' when opening zarr array
  • Loading branch information
jni authored Oct 13, 2023
1 parent 0734529 commit bcda478
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 288 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
strategy:
matrix:
platform: [ubuntu-latest, windows-latest, macos-latest]
python-version: [3.8, 3.9, '3.10']
python-version: ['3.9', '3.10', '3.11']

steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -51,7 +51,7 @@ jobs:
# this runs the platform-specific tests declared in tox.ini
- name: Test with tox
uses: GabrielBB/xvfb-action@v1
uses: aganders3/headless-gui@v1
with:
run: python -m tox
env:
Expand Down
4 changes: 3 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ install_requires =
qtpy
scipy
scikit-image
tensorstore
toolz
zarr

Expand All @@ -56,5 +55,8 @@ testing =
pytest-qt
napari[pyqt5]

all =
tensorstore

[options.package_data]
zarpaint = napari.yaml
4 changes: 2 additions & 2 deletions src/zarpaint/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
except ImportError:
__version__ = "unknown"

from ._zarpaint import create_labels, open_tensorstore
from ._zarpaint import create_labels, open_zarr
from ._dims_chooser import DimsSorter, set_axis_labels
from ._watershed import watershed_split
from ._add_3d_points import add_points_3d_with_alt_click
Expand All @@ -12,7 +12,7 @@

__all__ = [
'create_labels',
'open_tensorstore',
'open_zarr',
'DimsSorter',
'set_axis_labels',
'watershed_split',
Expand Down
6 changes: 2 additions & 4 deletions src/zarpaint/_tests/test_copy_data.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
from napari.layers import Labels
from zarpaint import copy_data
import numpy as np
import tensorstore as ts
from zarpaint import open_tensorstore
from zarpaint import open_zarr
import zarr

def test_copy_data(make_napari_viewer):
Expand All @@ -19,7 +17,7 @@ def test_copy_data(make_napari_viewer):
def test_copy_data_tensorstore(make_napari_viewer, tmp_path):
viewer = make_napari_viewer()
labels_layer1 = viewer.add_labels(np.random.randint(0, 2**23, size=(10, 20, 30)))
array2 = open_tensorstore(tmp_path/"example.zarr", shape=(2, 10, 20, 30), chunks=(1, 1, 20, 30))
array2 = open_zarr(tmp_path / "example.zarr", shape=(2, 10, 20, 30), chunks=(1, 1, 20, 30))
labels_layer2 = viewer.add_labels(array2)
viewer.dims.set_point(axis=0, value=1)
widget = copy_data()
Expand Down
Loading

0 comments on commit bcda478

Please sign in to comment.