make sure warnings are always displayed

This commit is contained in:
Aleix Conchillo Flaqué
2025-08-28 15:30:23 -07:00
parent a5c5e069ba
commit 79be0695dd
13 changed files with 130 additions and 91 deletions

View File

@@ -41,6 +41,8 @@ def create_default_resampler(**kwargs) -> BaseAudioResampler:
""" """
import warnings import warnings
with warnings.catch_warnings():
warnings.simplefilter("always")
warnings.warn( warnings.warn(
"`create_default_resampler` is deprecated. " "`create_default_resampler` is deprecated. "
"Use `create_stream_resampler` for real-time processing scenarios or " "Use `create_stream_resampler` for real-time processing scenarios or "

View File

@@ -12,7 +12,6 @@ LLM processing, and text-to-speech components in conversational AI pipelines.
""" """
import asyncio import asyncio
import warnings
from abc import abstractmethod from abc import abstractmethod
from dataclasses import dataclass from dataclasses import dataclass
from typing import Dict, List, Literal, Optional, Set from typing import Dict, List, Literal, Optional, Set
@@ -326,6 +325,10 @@ class LLMContextResponseAggregator(BaseLLMResponseAggregator):
Returns: Returns:
LLMContextFrame containing the current context. LLMContextFrame containing the current context.
""" """
import warnings
with warnings.catch_warnings():
warnings.simplefilter("always")
warnings.warn( warnings.warn(
"get_context_frame() is deprecated and will be removed in a future version. To trigger an LLM response, use LLMRunFrame instead.", "get_context_frame() is deprecated and will be removed in a future version. To trigger an LLM response, use LLMRunFrame instead.",
DeprecationWarning, DeprecationWarning,
@@ -1035,6 +1038,10 @@ class LLMUserResponseAggregator(LLMUserContextAggregator):
params: Configuration parameters for aggregation behavior. params: Configuration parameters for aggregation behavior.
**kwargs: Additional arguments passed to parent class. **kwargs: Additional arguments passed to parent class.
""" """
import warnings
with warnings.catch_warnings():
warnings.simplefilter("always")
warnings.warn( warnings.warn(
"LLMUserResponseAggregator is deprecated and will be removed in a future version. " "LLMUserResponseAggregator is deprecated and will be removed in a future version. "
"Use LLMUserContextAggregator or another LLM-specific subclass instead.", "Use LLMUserContextAggregator or another LLM-specific subclass instead.",
@@ -1078,6 +1085,10 @@ class LLMAssistantResponseAggregator(LLMAssistantContextAggregator):
params: Configuration parameters for aggregation behavior. params: Configuration parameters for aggregation behavior.
**kwargs: Additional arguments passed to parent class. **kwargs: Additional arguments passed to parent class.
""" """
import warnings
with warnings.catch_warnings():
warnings.simplefilter("always")
warnings.warn( warnings.warn(
"LLMAssistantResponseAggregator is deprecated and will be removed in a future version. " "LLMAssistantResponseAggregator is deprecated and will be removed in a future version. "
"Use LLMAssistantContextAggregator or another LLM-specific subclass instead.", "Use LLMAssistantContextAggregator or another LLM-specific subclass instead.",

View File

@@ -452,6 +452,8 @@ class FrameProcessor(BaseObject):
""" """
import warnings import warnings
with warnings.catch_warnings():
warnings.simplefilter("always")
warnings.warn( warnings.warn(
"`FrameProcessor.wait_for_task()` is deprecated. " "`FrameProcessor.wait_for_task()` is deprecated. "
"Use `await task` or `await asyncio.wait_for(task, timeout)` instead.", "Use `await task` or `await asyncio.wait_for(task, timeout)` instead.",

View File

@@ -122,6 +122,8 @@ async def configure_with_args(aiohttp_session: aiohttp.ClientSession, parser=Non
""" """
import warnings import warnings
with warnings.catch_warnings():
warnings.simplefilter("always")
warnings.warn( warnings.warn(
"configure_with_args is deprecated. Use configure() instead.", "configure_with_args is deprecated. Use configure() instead.",
DeprecationWarning, DeprecationWarning,

View File

@@ -11,11 +11,11 @@ _warned_modules = set()
def _warn_deprecated_access(globals: Dict[str, Any], attr, old: str, new: str): def _warn_deprecated_access(globals: Dict[str, Any], attr, old: str, new: str):
import warnings
# Only warn once per old->new module pair # Only warn once per old->new module pair
module_key = (old, new) module_key = (old, new)
if module_key not in _warned_modules: if module_key not in _warned_modules:
import warnings
with warnings.catch_warnings(): with warnings.catch_warnings():
warnings.simplefilter("always") warnings.simplefilter("always")
warnings.warn( warnings.warn(

View File

@@ -271,6 +271,8 @@ class CartesiaTTSService(AudioContextWordTTSService):
voice_config["id"] = self._voice_id voice_config["id"] = self._voice_id
if self._settings["emotion"]: if self._settings["emotion"]:
with warnings.catch_warnings():
warnings.simplefilter("always")
warnings.warn( warnings.warn(
"The 'emotion' parameter in __experimental_controls is deprecated and will be removed in a future version.", "The 'emotion' parameter in __experimental_controls is deprecated and will be removed in a future version.",
DeprecationWarning, DeprecationWarning,
@@ -606,6 +608,8 @@ class CartesiaHttpTTSService(TTSService):
voice_config = {"mode": "id", "id": self._voice_id} voice_config = {"mode": "id", "id": self._voice_id}
if self._settings["emotion"]: if self._settings["emotion"]:
with warnings.catch_warnings():
warnings.simplefilter("always")
warnings.warn( warnings.warn(
"The 'emotion' parameter in voice.__experimental_controls is deprecated and will be removed in a future version.", "The 'emotion' parameter in voice.__experimental_controls is deprecated and will be removed in a future version.",
DeprecationWarning, DeprecationWarning,

View File

@@ -120,6 +120,8 @@ class FishAudioTTSService(InterruptibleTTSService):
if model: if model:
import warnings import warnings
with warnings.catch_warnings():
warnings.simplefilter("always")
warnings.warn( warnings.warn(
"Parameter 'model' is deprecated and will be removed in a future version. " "Parameter 'model' is deprecated and will be removed in a future version. "
"Use 'reference_id' instead.", "Use 'reference_id' instead.",

View File

@@ -13,7 +13,6 @@ supporting multiple languages, custom vocabulary, and various audio processing o
import asyncio import asyncio
import base64 import base64
import json import json
import warnings
from typing import Any, AsyncGenerator, Dict, Literal, Optional from typing import Any, AsyncGenerator, Dict, Literal, Optional
import aiohttp import aiohttp
@@ -173,6 +172,10 @@ class _InputParamsDescriptor:
"""Descriptor for backward compatibility with deprecation warning.""" """Descriptor for backward compatibility with deprecation warning."""
def __get__(self, obj, objtype=None): def __get__(self, obj, objtype=None):
import warnings
with warnings.catch_warnings():
warnings.simplefilter("always")
warnings.warn( warnings.warn(
"GladiaSTTService.InputParams is deprecated and will be removed in a future version. " "GladiaSTTService.InputParams is deprecated and will be removed in a future version. "
"Import and use GladiaInputParams directly instead.", "Import and use GladiaInputParams directly instead.",
@@ -234,6 +237,8 @@ class GladiaSTTService(STTService):
# Warn about deprecated language parameter if it's used # Warn about deprecated language parameter if it's used
if params.language is not None: if params.language is not None:
with warnings.catch_warnings():
warnings.simplefilter("always")
warnings.warn( warnings.warn(
"The 'language' parameter is deprecated and will be removed in a future version. " "The 'language' parameter is deprecated and will be removed in a future version. "
"Use 'language_config' instead.", "Use 'language_config' instead.",

View File

@@ -65,6 +65,8 @@ class GoogleLLMOpenAIBetaService(OpenAILLMService):
""" """
import warnings import warnings
with warnings.catch_warnings():
warnings.simplefilter("always")
warnings.warn( warnings.warn(
"GoogleLLMOpenAIBetaService is deprecated and will be removed in a future version. " "GoogleLLMOpenAIBetaService is deprecated and will be removed in a future version. "
"Use GoogleLLMService instead for better integration with Google's native API.", "Use GoogleLLMService instead for better integration with Google's native API.",

View File

@@ -14,7 +14,6 @@ import io
import json import json
import struct import struct
import uuid import uuid
import warnings
from typing import AsyncGenerator, Optional from typing import AsyncGenerator, Optional
import aiohttp import aiohttp
@@ -455,6 +454,10 @@ class PlayHTHttpTTSService(TTSService):
# Warn about deprecated protocol parameter if explicitly provided # Warn about deprecated protocol parameter if explicitly provided
if protocol: if protocol:
import warnings
with warnings.catch_warnings():
warnings.simplefilter("always")
warnings.warn( warnings.warn(
"The 'protocol' parameter is deprecated and will be removed in a future version.", "The 'protocol' parameter is deprecated and will be removed in a future version.",
DeprecationWarning, DeprecationWarning,

View File

@@ -9,7 +9,6 @@
import asyncio import asyncio
import base64 import base64
import json import json
import warnings
from typing import Any, AsyncGenerator, Mapping, Optional from typing import Any, AsyncGenerator, Mapping, Optional
import aiohttp import aiohttp
@@ -356,6 +355,10 @@ class SarvamTTSService(InterruptibleTTSService):
) )
params = params or SarvamTTSService.InputParams() params = params or SarvamTTSService.InputParams()
if aiohttp_session is not None: if aiohttp_session is not None:
import warnings
with warnings.catch_warnings():
warnings.simplefilter("always")
warnings.warn( warnings.warn(
"The 'aiohttp_session' parameter is deprecated and will be removed in a future version. ", "The 'aiohttp_session' parameter is deprecated and will be removed in a future version. ",
DeprecationWarning, DeprecationWarning,

View File

@@ -10,7 +10,6 @@ import asyncio
import datetime import datetime
import os import os
import re import re
import warnings
from dataclasses import dataclass, field from dataclasses import dataclass, field
from enum import Enum from enum import Enum
from typing import Any, AsyncGenerator from typing import Any, AsyncGenerator
@@ -1107,6 +1106,8 @@ def _check_deprecated_args(kwargs: dict, params: SpeechmaticsSTTService.InputPar
# Show deprecation warnings # Show deprecation warnings
def _deprecation_warning(old: str, new: str | None = None): def _deprecation_warning(old: str, new: str | None = None):
import warnings
with warnings.catch_warnings(): with warnings.catch_warnings():
warnings.simplefilter("always") warnings.simplefilter("always")
if new: if new:

View File

@@ -276,6 +276,8 @@ class TTSService(AIService):
""" """
import warnings import warnings
with warnings.catch_warnings():
warnings.simplefilter("always")
warnings.warn( warnings.warn(
"`TTSService.say()` is deprecated. Push a `TTSSpeakFrame` instead.", "`TTSService.say()` is deprecated. Push a `TTSSpeakFrame` instead.",
DeprecationWarning, DeprecationWarning,