From 80d0a880993d6ed2ac8523dd5c8037c36014a89e Mon Sep 17 00:00:00 2001 From: Daniil Gusev Date: Thu, 23 Apr 2026 13:56:38 +0200 Subject: [PATCH] Remove redundant handling for missing imports --- src/pipecat_getstream/transport.py | 42 ++++++++++++------------------ src/pipecat_getstream/utils.py | 13 ++------- 2 files changed, 18 insertions(+), 37 deletions(-) diff --git a/src/pipecat_getstream/transport.py b/src/pipecat_getstream/transport.py index 70fb953..f274f2c 100644 --- a/src/pipecat_getstream/transport.py +++ b/src/pipecat_getstream/transport.py @@ -7,11 +7,22 @@ import asyncio import time +import warnings from dataclasses import dataclass from fractions import Fraction from typing import Any, Callable, Coroutine, Dict, List, Optional +import av import numpy as np +from aiortc import MediaStreamTrack +from getstream import AsyncStream +from getstream.models import UserRequest +from getstream.video import rtc +from getstream.video.async_call import Call +from getstream.video.rtc import AudioStreamTrack, PcmData +from getstream.video.rtc.connection_manager import ConnectionManager +from getstream.video.rtc.pb.stream.video.sfu.models.models_pb2 import TrackType +from getstream.video.rtc.tracks import SubscriptionConfig, TrackSubscriptionConfig from loguru import logger from pipecat.audio.utils import create_stream_resampler from pipecat.frames.frames import ( @@ -41,32 +52,11 @@ "BGR": "bgr24", "L": "gray", } - -try: - import warnings - - import av - from aiortc import MediaStreamTrack - from getstream import AsyncStream - from getstream.models import UserRequest - from getstream.video import rtc - from getstream.video.async_call import Call - from getstream.video.rtc import AudioStreamTrack, PcmData - from getstream.video.rtc.connection_manager import ConnectionManager - from getstream.video.rtc.pb.stream.video.sfu.models.models_pb2 import TrackType - from getstream.video.rtc.tracks import SubscriptionConfig, TrackSubscriptionConfig - - # Suppress dataclasses_json missing value RuntimeWarnings. - # They pollute the output and cannot be fixed by the users. - warnings.filterwarnings( - "ignore", category=RuntimeWarning, module="dataclasses_json.core" - ) -except ModuleNotFoundError as _e: - logger.error(f"Exception: {_e}") - logger.error( - "In order to use Stream Video, you need to `pip install pipecat-ai[getstream]`." - ) - raise Exception(f"Missing module: {_e}") +# Suppress dataclasses_json missing value RuntimeWarnings. +# They pollute the output and cannot be fixed by the users. +warnings.filterwarnings( + "ignore", category=RuntimeWarning, module="dataclasses_json.core" +) @dataclass diff --git a/src/pipecat_getstream/utils.py b/src/pipecat_getstream/utils.py index 83d359f..0143a3a 100644 --- a/src/pipecat_getstream/utils.py +++ b/src/pipecat_getstream/utils.py @@ -1,14 +1,5 @@ -from loguru import logger - -try: - from getstream import AsyncStream - from getstream.models import UserRequest -except ModuleNotFoundError as e: - logger.error(f"Exception: {e}") - logger.error( - "In order to use Stream Video, you need to `pip install pipecat-ai[getstream]`." - ) - raise Exception(f"Missing module: {e}") +from getstream import AsyncStream +from getstream.models import UserRequest class GetstreamRESTHelper: