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

View File

@@ -452,6 +452,8 @@ class FrameProcessor(BaseObject):
"""
import warnings
with warnings.catch_warnings():
warnings.simplefilter("always")
warnings.warn(
"`FrameProcessor.wait_for_task()` is deprecated. "
"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
with warnings.catch_warnings():
warnings.simplefilter("always")
warnings.warn(
"configure_with_args is deprecated. Use configure() instead.",
DeprecationWarning,

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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