From 7ac69adcb527f7f3df5b7721bf11962368f636e7 Mon Sep 17 00:00:00 2001 From: Ryan Williams Date: Mon, 2 Dec 2024 14:52:37 -0500 Subject: [PATCH] support `somacore>=1.0.24` / `tiledbsoma>=1.15.0rc4` --- .github/workflows/python-tilledbsoma-ml-compat.yml | 1 + src/tiledbsoma_ml/pytorch.py | 8 +++++++- tests/test_pytorch.py | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/python-tilledbsoma-ml-compat.yml b/.github/workflows/python-tilledbsoma-ml-compat.yml index 6cbde0b..d4ae9b7 100644 --- a/.github/workflows/python-tilledbsoma-ml-compat.yml +++ b/.github/workflows/python-tilledbsoma-ml-compat.yml @@ -31,6 +31,7 @@ jobs: - "tiledbsoma~=1.12.0" - "tiledbsoma~=1.13.0" - "tiledbsoma~=1.14.0" + - "tiledbsoma~=1.15.0rc4" runs-on: ${{ matrix.os }} diff --git a/src/tiledbsoma_ml/pytorch.py b/src/tiledbsoma_ml/pytorch.py index a5561fb..2e70c0c 100644 --- a/src/tiledbsoma_ml/pytorch.py +++ b/src/tiledbsoma_ml/pytorch.py @@ -41,7 +41,13 @@ import tiledbsoma as soma import torch import torchdata -from somacore.query._eager_iter import EagerIterator as _EagerIterator + +try: + # somacore<1.0.24 / tiledbsoma<1.15 + from somacore.query._eager_iter import EagerIterator as _EagerIterator +except ImportError: + # somacore>=1.0.24 / tiledbsoma>=1.15 + from tiledbsoma._eager_iter import EagerIterator as _EagerIterator from typing_extensions import Self logger = logging.getLogger("tiledbsoma_ml.pytorch") diff --git a/tests/test_pytorch.py b/tests/test_pytorch.py index 05bf6ca..e113a41 100644 --- a/tests/test_pytorch.py +++ b/tests/test_pytorch.py @@ -100,6 +100,7 @@ def add_dataframe(coll: CollectionBase, key: str, value_range: range) -> None: ] ), index_column_names=["soma_joinid"], + domain=((value_range.start, value_range.stop),), ) df.write( pa.Table.from_pydict(