From 0549f1f9d996b6d389f16c7df6f617ddcf30e247 Mon Sep 17 00:00:00 2001 From: Gal Topper Date: Sun, 28 Jun 2026 18:09:39 +0700 Subject: [PATCH 1/2] Make `v3io_frames` an optional dependency ML-12819 --- dev-requirements.txt | 3 ++- requirements.txt | 1 - setup.py | 1 + storey/targets.py | 12 ++++++++++-- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/dev-requirements.txt b/dev-requirements.txt index a04964be..85e25492 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -16,4 +16,5 @@ sqlalchemy~=1.4 s3fs~=2023.9.2 adlfs~=2023.9.0 # If installing on MAC, you need to install PostgreSQL first using 'brew install postgresql' -psycopg[binary,pool]~=3.2 \ No newline at end of file +psycopg[binary,pool]~=3.2 +v3io-frames>=0.10.14, !=0.11.*, !=0.12.* diff --git a/requirements.txt b/requirements.txt index 4dda041e..3843a118 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,7 +8,6 @@ pandas>=1, !=1.5.*, <2.2 numpy>=1.16.5,<1.27 # <24 is just a safeguard - no tests performed with pyarrow higher than 23 pyarrow>=1,<24 -v3io-frames>=0.10.14, !=0.11.*, !=0.12.* fsspec>=0.6.2 v3iofs~=0.1.17 xxhash>=1 diff --git a/setup.py b/setup.py index 076e5cac..7c2c4199 100644 --- a/setup.py +++ b/setup.py @@ -47,6 +47,7 @@ def load_deps(file_name): "opentelemetry-sdk>=1.25.0,<2.0.0", "opentelemetry-exporter-otlp-proto-grpc>=1.25.0,<2.0.0", ], + "v3io-frames": ["v3io-frames>=0.10.14, !=0.11.*, !=0.12.*"], } diff --git a/storey/targets.py b/storey/targets.py index f9a33579..3e0365f6 100644 --- a/storey/targets.py +++ b/storey/targets.py @@ -28,9 +28,13 @@ import pandas as pd import pyarrow -import v3io_frames as frames import xxhash +try: + import v3io_frames as frames +except ImportError: + frames = None + from . import Driver from .dtypes import Event, V3ioError from .flow import Flow, _Batching, _split_path, _termination_obj @@ -758,7 +762,11 @@ def __init__( self._aggr = aggr self.aggr_granularity = aggr_granularity self._created = False - self._frames_client = frames_client or frames.Client(address=v3io_frames, token=access_key, container=container) + if frames_client is None: + if frames is None: + raise ImportError("Install with: pip install storey[v3io-frames]") + frames_client = frames.Client(address=v3io_frames, token=access_key, container=container) + self._frames_client = frames_client def _init(self): _Batching._init(self) From b30999f950edc2af1986664bef4fc826bae1e2e7 Mon Sep 17 00:00:00 2001 From: Gal Topper Date: Sun, 28 Jun 2026 18:52:03 +0700 Subject: [PATCH 2/2] Avoid breakage in case of a mock frames client --- storey/targets.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/storey/targets.py b/storey/targets.py index 3e0365f6..9f304553 100644 --- a/storey/targets.py +++ b/storey/targets.py @@ -762,6 +762,7 @@ def __init__( self._aggr = aggr self.aggr_granularity = aggr_granularity self._created = False + self._if_exists = frames.frames_pb2.IGNORE if frames is not None else 1 # frames_pb2.IGNORE if frames_client is None: if frames is None: raise ImportError("Install with: pip install storey[v3io-frames]") @@ -788,7 +789,7 @@ async def _emit(self, batch, batch_key, batch_time, batch_events, last_event_tim self._frames_client.create( "tsdb", table=self._path, - if_exists=frames.frames_pb2.IGNORE, + if_exists=self._if_exists, rate=self._rate, aggregates=self._aggr, aggregation_granularity=self.aggr_granularity or "",