Skip to content

Commit c13dd03

Browse files
authored
Carrara group add members - Carrara URI support fixes (#158)
* TileDB Carrara URIs and add memberships * Cloud URI check * Pin tifffile version for Zarr 2 support * Get data protocol from TileDB-Py * Remove custom DataProtocol type * Change CI jobs name to reflect python version * Add weekly nightly CI runs to catch dependency conflicts earlier * Remove notebooks tests for Windows * PR fixes
1 parent d505bf9 commit c13dd03

4 files changed

Lines changed: 29 additions & 11 deletions

File tree

.github/workflows/ci.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
name: TileDB-BioImaging CI
22

3-
on: [push]
3+
on:
4+
push:
5+
schedule:
6+
- cron: '0 6 * * 1'
47

58
jobs:
69
build:
7-
name: ${{ matrix.sys.os }}
10+
name: ${{ matrix.sys.os }} ${{ matrix.python-version }}
811
runs-on: ${{ matrix.sys.os }}
912
timeout-minutes: 25
1013
strategy:
@@ -80,8 +83,10 @@ jobs:
8083

8184
- name: Run notebook examples
8285
run: |
83-
micromamba run -n test pip install opencv-python-headless matplotlib nbmake
86+
micromamba run -n test pip install opencv-python-headless matplotlib nbmake
8487
micromamba run -n test pytest --nbmake examples
88+
if: ${{ matrix.sys.os != 'windows-latest' }}
89+
8590

8691
- name: Create Test Coverage Badge
8792
if: ${{ env.run_coverage == 'true' && matrix.sys.os == 'ubuntu-24.04' }}

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import setuptools
22

3-
zarr = ["ome-zarr>=0.9.0"]
3+
zarr = ["ome-zarr>=0.9.0,<=0.10.3"]
44
openslide = ["openslide-python"]
5-
tiff = ["tifffile", "imagecodecs"]
5+
tiff = ["tifffile==v2025.5.10", "imagecodecs"]
66
cloud = ["tiledb-cloud"]
77

88
full = sorted({*zarr, *openslide, *tiff})

tiledb/bioimg/helpers.py

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,24 @@ def __exit__(self, exc_type: Any, exc_val: Any, exc_tb: Any) -> None:
7171
self.w_group.close()
7272
self.m_group.close()
7373

74+
def _is_tiledbv2_uri(self, uri: str, ctx: tiledb.Ctx) -> bool:
75+
"""Return True if the URI will use `tiledbv2` semantics."""
76+
protocol_name: str = ctx.data_protocol(uri).name
77+
return protocol_name == "DATA_PROTOCOL_V2"
78+
79+
def _is_tiledbv3_uri(self, uri: str, ctx: tiledb.Ctx) -> bool:
80+
"""Return True if the URI will use `tiledbv3` semantics."""
81+
protocol_name: str = ctx.data_protocol(uri).name
82+
return protocol_name == "DATA_PROTOCOL_V3"
83+
7484
def get_or_create(self, name: str, schema: tiledb.ArraySchema) -> Tuple[str, bool]:
7585
create = False
7686
if name in self.r_group:
7787
uri = self.r_group[name].uri
7888
else:
7989
uri = os.path.join(self._uri, name).replace("\\", "/")
8090

81-
with tiledb.scope_ctx(self._ctx):
91+
with tiledb.scope_ctx(self._ctx) as local_ctx:
8292
if not tiledb.array_exists(uri):
8393
tiledb.Array.create(uri, schema, ctx=self._ctx)
8494
create = True
@@ -100,10 +110,14 @@ def get_or_create(self, name: str, schema: tiledb.ArraySchema) -> Tuple[str, boo
100110
# (to allow the add operation)
101111
self.w_group.close()
102112
self.w_group.open("w")
103-
# register the uri with the given name
104-
if self._is_cloud:
105-
self.w_group.add(uri, name, relative=False)
106-
else:
113+
114+
# In tiledbv3 mode, the array is created with the uri==name and relative=True and registered to the group as a member with the given name from the uri.
115+
# so we don't need to add it to the group manually
116+
117+
if self._is_cloud and self._is_tiledbv2_uri(uri, local_ctx):
118+
# register the uri with the given name
119+
self.w_group.add(uri, name, relative=False)
120+
if not self._is_cloud:
107121
self.w_group.add(name, name, relative=True)
108122
return uri, create
109123

tiledb/bioimg/wrappers.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ def from_bioimg(
107107
else:
108108
raise _osd_exc
109109
else:
110-
111110
logger.info("Converting PNG")
112111
return converters["png_converter"].to_tiledb(
113112
source=src,

0 commit comments

Comments
 (0)