From f37a53cc25f77f22ed8b467ffe58e176d9a6e22f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aleix=20Conchillo=20Flaqu=C3=A9?= Date: Wed, 3 Dec 2025 18:20:12 -0800 Subject: [PATCH 1/2] utils(sync): move sync to utils.sync --- src/pipecat/utils/sync/__init__.py | 0 src/pipecat/utils/sync/base_notifier.py | 36 +++++++++++++++++++ src/pipecat/utils/sync/event_notifier.py | 45 ++++++++++++++++++++++++ 3 files changed, 81 insertions(+) create mode 100644 src/pipecat/utils/sync/__init__.py create mode 100644 src/pipecat/utils/sync/base_notifier.py create mode 100644 src/pipecat/utils/sync/event_notifier.py diff --git a/src/pipecat/utils/sync/__init__.py b/src/pipecat/utils/sync/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/src/pipecat/utils/sync/base_notifier.py b/src/pipecat/utils/sync/base_notifier.py new file mode 100644 index 000000000..60321e282 --- /dev/null +++ b/src/pipecat/utils/sync/base_notifier.py @@ -0,0 +1,36 @@ +# +# Copyright (c) 2024–2025, Daily +# +# SPDX-License-Identifier: BSD 2-Clause License +# + +"""Base notifier interface for Pipecat.""" + +from abc import ABC, abstractmethod + + +class BaseNotifier(ABC): + """Abstract base class for notification mechanisms. + + Provides a standard interface for implementing notification and waiting + patterns used for event coordination and signaling between components + in the Pipecat framework. + """ + + @abstractmethod + async def notify(self): + """Send a notification signal. + + Implementations should trigger any waiting coroutines or processes + that are blocked on this notifier. + """ + pass + + @abstractmethod + async def wait(self): + """Wait for a notification signal. + + Implementations should block until a notification is received + from the corresponding notify() call. + """ + pass diff --git a/src/pipecat/utils/sync/event_notifier.py b/src/pipecat/utils/sync/event_notifier.py new file mode 100644 index 000000000..0a553fb1e --- /dev/null +++ b/src/pipecat/utils/sync/event_notifier.py @@ -0,0 +1,45 @@ +# +# Copyright (c) 2024–2025, Daily +# +# SPDX-License-Identifier: BSD 2-Clause License +# + +"""Event-based notifier implementation using asyncio Event primitives.""" + +import asyncio + +from pipecat.utils.sync.base_notifier import BaseNotifier + + +class EventNotifier(BaseNotifier): + """Event-based notifier using asyncio.Event for task synchronization. + + Provides a simple notification mechanism where one task can signal + an event and other tasks can wait for that event to occur. The event + is automatically cleared after each wait operation. + """ + + def __init__(self): + """Initialize the event notifier. + + Creates an internal asyncio.Event for managing notifications. + """ + self._event = asyncio.Event() + + async def notify(self): + """Signal the event to notify waiting tasks. + + Sets the internal event, causing any tasks waiting on this + notifier to be awakened. + """ + self._event.set() + + async def wait(self): + """Wait for the event to be signaled. + + Blocks until another task calls notify(). Automatically clears + the event after being awakened so subsequent calls will wait + for the next notification. + """ + await self._event.wait() + self._event.clear() From 8dc9872ed5c5c40123387bc4167d8b7d70a85123 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aleix=20Conchillo=20Flaqu=C3=A9?= Date: Wed, 3 Dec 2025 18:44:41 -0800 Subject: [PATCH 2/2] deprecate pipecat.sync package --- CHANGELOG.md | 2 + docs/api/conf.py | 1 - docs/api/index.rst | 3 +- .../foundational/22-natural-conversation.py | 2 +- .../22b-natural-conversation-proposal.py | 4 +- .../22c-natural-conversation-mixed-llms.py | 4 +- .../22d-natural-conversation-gemini-audio.py | 4 +- .../voicemail/voicemail_detector.py | 4 +- .../aggregators/gated_llm_context.py | 2 +- .../filters/wake_notifier_filter.py | 2 +- src/pipecat/sync/base_notifier.py | 35 ++++----------- src/pipecat/sync/event_notifier.py | 44 ++++--------------- uv.lock | 6 +-- 13 files changed, 35 insertions(+), 78 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2891a53e5..38bb46d35 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Deprecated +- Package `pipecat.sync` is deprecated, use `pipecat.utils.sync` instead. + - The `noise_gate_enable` parameter in `AICFilter` is deprecated and no longer has any effect. Noise gating is now handled automatically by the AIC VAD system. Use `AICFilter.create_vad_analyzer()` for VAD functionality instead. diff --git a/docs/api/conf.py b/docs/api/conf.py index 8946a34d3..c92eaa97d 100644 --- a/docs/api/conf.py +++ b/docs/api/conf.py @@ -119,7 +119,6 @@ def import_core_modules(): "pipecat.observers", "pipecat.runner", "pipecat.serializers", - "pipecat.sync", "pipecat.transcriptions", "pipecat.utils", ] diff --git a/docs/api/index.rst b/docs/api/index.rst index df84d9580..85f373db7 100644 --- a/docs/api/index.rst +++ b/docs/api/index.rst @@ -30,7 +30,6 @@ Quick Links Runner Serializers Services - Sync Transcriptions Transports - Utils \ No newline at end of file + Utils diff --git a/examples/foundational/22-natural-conversation.py b/examples/foundational/22-natural-conversation.py index f95a473df..c4326ac4d 100644 --- a/examples/foundational/22-natural-conversation.py +++ b/examples/foundational/22-natural-conversation.py @@ -28,10 +28,10 @@ from pipecat.services.cartesia.tts import CartesiaTTSService from pipecat.services.deepgram.stt import DeepgramSTTService from pipecat.services.llm_service import LLMService from pipecat.services.openai.llm import OpenAIContextAggregatorPair, OpenAILLMService -from pipecat.sync.event_notifier import EventNotifier from pipecat.transports.base_transport import BaseTransport, TransportParams from pipecat.transports.daily.transport import DailyParams from pipecat.transports.websocket.fastapi import FastAPIWebsocketParams +from pipecat.utils.sync.event_notifier import EventNotifier load_dotenv(override=True) diff --git a/examples/foundational/22b-natural-conversation-proposal.py b/examples/foundational/22b-natural-conversation-proposal.py index 935676f9b..ca3737ebd 100644 --- a/examples/foundational/22b-natural-conversation-proposal.py +++ b/examples/foundational/22b-natural-conversation-proposal.py @@ -45,11 +45,11 @@ from pipecat.services.cartesia.tts import CartesiaTTSService from pipecat.services.deepgram.stt import DeepgramSTTService from pipecat.services.llm_service import FunctionCallParams, LLMService from pipecat.services.openai.llm import OpenAILLMService -from pipecat.sync.base_notifier import BaseNotifier -from pipecat.sync.event_notifier import EventNotifier from pipecat.transports.base_transport import BaseTransport, TransportParams from pipecat.transports.daily.transport import DailyParams from pipecat.transports.websocket.fastapi import FastAPIWebsocketParams +from pipecat.utils.sync.base_notifier import BaseNotifier +from pipecat.utils.sync.event_notifier import EventNotifier from pipecat.utils.time import time_now_iso8601 load_dotenv(override=True) diff --git a/examples/foundational/22c-natural-conversation-mixed-llms.py b/examples/foundational/22c-natural-conversation-mixed-llms.py index cdcd21289..48fa7dfe0 100644 --- a/examples/foundational/22c-natural-conversation-mixed-llms.py +++ b/examples/foundational/22c-natural-conversation-mixed-llms.py @@ -46,11 +46,11 @@ from pipecat.services.cartesia.tts import CartesiaTTSService from pipecat.services.deepgram.stt import DeepgramSTTService from pipecat.services.llm_service import FunctionCallParams, LLMService from pipecat.services.openai.llm import OpenAILLMService -from pipecat.sync.base_notifier import BaseNotifier -from pipecat.sync.event_notifier import EventNotifier from pipecat.transports.base_transport import BaseTransport, TransportParams from pipecat.transports.daily.transport import DailyParams from pipecat.transports.websocket.fastapi import FastAPIWebsocketParams +from pipecat.utils.sync.base_notifier import BaseNotifier +from pipecat.utils.sync.event_notifier import EventNotifier from pipecat.utils.time import time_now_iso8601 load_dotenv(override=True) diff --git a/examples/foundational/22d-natural-conversation-gemini-audio.py b/examples/foundational/22d-natural-conversation-gemini-audio.py index a7837ce60..9654dd154 100644 --- a/examples/foundational/22d-natural-conversation-gemini-audio.py +++ b/examples/foundational/22d-natural-conversation-gemini-audio.py @@ -47,11 +47,11 @@ from pipecat.runner.utils import create_transport from pipecat.services.cartesia.tts import CartesiaTTSService from pipecat.services.google.llm import GoogleLLMService from pipecat.services.llm_service import LLMService -from pipecat.sync.base_notifier import BaseNotifier -from pipecat.sync.event_notifier import EventNotifier from pipecat.transports.base_transport import BaseTransport, TransportParams from pipecat.transports.daily.transport import DailyParams from pipecat.transports.websocket.fastapi import FastAPIWebsocketParams +from pipecat.utils.sync.base_notifier import BaseNotifier +from pipecat.utils.sync.event_notifier import EventNotifier from pipecat.utils.time import time_now_iso8601 load_dotenv(override=True) diff --git a/src/pipecat/extensions/voicemail/voicemail_detector.py b/src/pipecat/extensions/voicemail/voicemail_detector.py index 149103319..e79520cb5 100644 --- a/src/pipecat/extensions/voicemail/voicemail_detector.py +++ b/src/pipecat/extensions/voicemail/voicemail_detector.py @@ -40,8 +40,8 @@ from pipecat.processors.aggregators.llm_context import LLMContext from pipecat.processors.aggregators.llm_response_universal import LLMContextAggregatorPair from pipecat.processors.frame_processor import FrameDirection, FrameProcessor, FrameProcessorSetup from pipecat.services.llm_service import LLMService -from pipecat.sync.base_notifier import BaseNotifier -from pipecat.sync.event_notifier import EventNotifier +from pipecat.utils.sync.base_notifier import BaseNotifier +from pipecat.utils.sync.event_notifier import EventNotifier class NotifierGate(FrameProcessor): diff --git a/src/pipecat/processors/aggregators/gated_llm_context.py b/src/pipecat/processors/aggregators/gated_llm_context.py index 6535bffbb..9c3d90948 100644 --- a/src/pipecat/processors/aggregators/gated_llm_context.py +++ b/src/pipecat/processors/aggregators/gated_llm_context.py @@ -9,7 +9,7 @@ from pipecat.frames.frames import CancelFrame, EndFrame, Frame, LLMContextFrame, StartFrame from pipecat.processors.aggregators.openai_llm_context import OpenAILLMContextFrame from pipecat.processors.frame_processor import FrameDirection, FrameProcessor -from pipecat.sync.base_notifier import BaseNotifier +from pipecat.utils.sync.base_notifier import BaseNotifier class GatedLLMContextAggregator(FrameProcessor): diff --git a/src/pipecat/processors/filters/wake_notifier_filter.py b/src/pipecat/processors/filters/wake_notifier_filter.py index c30f3b5d3..8ed3bc8c4 100644 --- a/src/pipecat/processors/filters/wake_notifier_filter.py +++ b/src/pipecat/processors/filters/wake_notifier_filter.py @@ -10,7 +10,7 @@ from typing import Awaitable, Callable, Tuple, Type from pipecat.frames.frames import Frame from pipecat.processors.frame_processor import FrameDirection, FrameProcessor -from pipecat.sync.base_notifier import BaseNotifier +from pipecat.utils.sync.base_notifier import BaseNotifier class WakeNotifierFilter(FrameProcessor): diff --git a/src/pipecat/sync/base_notifier.py b/src/pipecat/sync/base_notifier.py index 60321e282..1e3b16969 100644 --- a/src/pipecat/sync/base_notifier.py +++ b/src/pipecat/sync/base_notifier.py @@ -6,31 +6,14 @@ """Base notifier interface for Pipecat.""" -from abc import ABC, abstractmethod +import warnings +from pipecat.utils.sync.base_notifier import BaseNotifier -class BaseNotifier(ABC): - """Abstract base class for notification mechanisms. - - Provides a standard interface for implementing notification and waiting - patterns used for event coordination and signaling between components - in the Pipecat framework. - """ - - @abstractmethod - async def notify(self): - """Send a notification signal. - - Implementations should trigger any waiting coroutines or processes - that are blocked on this notifier. - """ - pass - - @abstractmethod - async def wait(self): - """Wait for a notification signal. - - Implementations should block until a notification is received - from the corresponding notify() call. - """ - pass +with warnings.catch_warnings(): + warnings.simplefilter("always") + warnings.warn( + "Package pipecat.sync is deprecated, use pipecat.utils.sync instead.", + DeprecationWarning, + stacklevel=2, + ) diff --git a/src/pipecat/sync/event_notifier.py b/src/pipecat/sync/event_notifier.py index 6708c2404..35fee6cb3 100644 --- a/src/pipecat/sync/event_notifier.py +++ b/src/pipecat/sync/event_notifier.py @@ -6,40 +6,14 @@ """Event-based notifier implementation using asyncio Event primitives.""" -import asyncio +import warnings -from pipecat.sync.base_notifier import BaseNotifier +from pipecat.utils.sync.event_notifier import EventNotifier - -class EventNotifier(BaseNotifier): - """Event-based notifier using asyncio.Event for task synchronization. - - Provides a simple notification mechanism where one task can signal - an event and other tasks can wait for that event to occur. The event - is automatically cleared after each wait operation. - """ - - def __init__(self): - """Initialize the event notifier. - - Creates an internal asyncio.Event for managing notifications. - """ - self._event = asyncio.Event() - - async def notify(self): - """Signal the event to notify waiting tasks. - - Sets the internal event, causing any tasks waiting on this - notifier to be awakened. - """ - self._event.set() - - async def wait(self): - """Wait for the event to be signaled. - - Blocks until another task calls notify(). Automatically clears - the event after being awakened so subsequent calls will wait - for the next notification. - """ - await self._event.wait() - self._event.clear() +with warnings.catch_warnings(): + warnings.simplefilter("always") + warnings.warn( + "Package pipecat.sync is deprecated, use pipecat.utils.sync instead.", + DeprecationWarning, + stacklevel=2, + ) diff --git a/uv.lock b/uv.lock index 17bdef385..da1b785a1 100644 --- a/uv.lock +++ b/uv.lock @@ -1,5 +1,5 @@ version = 1 -revision = 2 +revision = 3 requires-python = ">=3.10" resolution-markers = [ "python_full_version >= '3.13'", @@ -4710,7 +4710,6 @@ requires-dist = [ { name = "numba", specifier = "==0.61.2" }, { name = "numpy", specifier = ">=1.26.4,<3" }, { name = "nvidia-riva-client", marker = "extra == 'nvidia'", specifier = "~=2.21.1" }, - { name = "nvidia-riva-client", marker = "extra == 'riva'", specifier = "~=2.21.1" }, { name = "onnxruntime", marker = "extra == 'local-smart-turn-v3'", specifier = ">=1.20.1,<2" }, { name = "onnxruntime", marker = "extra == 'silero'", specifier = ">=1.20.1,<2" }, { name = "openai", specifier = ">=1.74.0,<3" }, @@ -4721,6 +4720,7 @@ requires-dist = [ { name = "opentelemetry-sdk", marker = "extra == 'tracing'", specifier = ">=1.33.0" }, { name = "ormsgpack", marker = "extra == 'fish'", specifier = "~=1.7.0" }, { name = "pillow", specifier = ">=11.1.0,<12" }, + { name = "pipecat-ai", extras = ["nvidia"], marker = "extra == 'riva'" }, { name = "pipecat-ai", extras = ["websockets-base"], marker = "extra == 'assemblyai'" }, { name = "pipecat-ai", extras = ["websockets-base"], marker = "extra == 'asyncai'" }, { name = "pipecat-ai", extras = ["websockets-base"], marker = "extra == 'aws'" }, @@ -4771,7 +4771,7 @@ requires-dist = [ { name = "wait-for2", marker = "python_full_version < '3.12'", specifier = ">=0.4.1" }, { name = "websockets", marker = "extra == 'websockets-base'", specifier = ">=13.1,<16.0" }, ] -provides-extras = ["aic", "anthropic", "assemblyai", "asyncai", "aws", "aws-nova-sonic", "azure", "cartesia", "cerebras", "daily", "deepgram", "deepseek", "elevenlabs", "fal", "fireworks", "fish", "gladia", "google", "grok", "groq", "gstreamer", "heygen", "hume", "inworld", "koala", "krisp", "langchain", "livekit", "lmnt", "local", "local-smart-turn", "local-smart-turn-v3", "mcp", "mem0", "mistral", "mlx-whisper", "moondream", "neuphonic", "nim", "noisereduce", "openai", "openpipe", "openrouter", "perplexity", "playht", "qwen", "remote-smart-turn", "rime", "riva", "nvidia", "runner", "sagemaker", "sambanova", "sarvam", "sentry", "silero", "simli", "soniox", "soundfile", "speechmatics", "strands", "tavus", "together", "tracing", "ultravox", "webrtc", "websocket", "websockets-base", "whisper"] +provides-extras = ["aic", "anthropic", "assemblyai", "asyncai", "aws", "aws-nova-sonic", "azure", "cartesia", "cerebras", "daily", "deepgram", "deepseek", "elevenlabs", "fal", "fireworks", "fish", "gladia", "google", "grok", "groq", "gstreamer", "heygen", "hume", "inworld", "koala", "krisp", "langchain", "livekit", "lmnt", "local", "local-smart-turn", "local-smart-turn-v3", "mcp", "mem0", "mistral", "mlx-whisper", "moondream", "neuphonic", "noisereduce", "nvidia", "openai", "openpipe", "openrouter", "perplexity", "playht", "qwen", "remote-smart-turn", "rime", "riva", "runner", "sagemaker", "sambanova", "sarvam", "sentry", "silero", "simli", "soniox", "soundfile", "speechmatics", "strands", "tavus", "together", "tracing", "ultravox", "webrtc", "websocket", "websockets-base", "whisper"] [package.metadata.requires-dev] dev = [