diff --git a/README.md b/README.md index 22677d9..4f42656 100644 --- a/README.md +++ b/README.md @@ -75,12 +75,14 @@ import asyncio from fishaudio import AsyncFishAudio from fishaudio.utils import play, save + async def main(): client = AsyncFishAudio() audio = await client.tts.convert(text="Hello, world!") play(audio) save(audio, "output.mp3") + asyncio.run(main()) ``` @@ -115,8 +117,7 @@ drama_audio = client.tts.convert( ```python # Use a specific voice by ID audio = client.tts.convert( - text="Custom voice", - reference_id="802e3bc2b27e49c2995d23ef70e6ac89" + text="Custom voice", reference_id="802e3bc2b27e49c2995d23ef70e6ac89" ) ``` @@ -125,7 +126,7 @@ audio = client.tts.convert( ```python audio = client.tts.convert( text="Speaking faster!", - speed=1.5 # 1.5x speed + speed=1.5, # 1.5x speed ) ``` @@ -138,7 +139,7 @@ config = TTSConfig( prosody=Prosody(speed=1.2, volume=-5), reference_id="933563129e564b19a115bedd57b7406a", format="wav", - latency="balanced" + latency="balanced", ) # Reuse across generations @@ -210,11 +211,13 @@ print(result.language_code) # e.g. "en" ```python import wave + def audio_chunks(): with wave.open("speech.wav", "rb") as wav: # 16-bit mono PCM, 16 kHz while chunk := wav.readframes(640): # 40 ms yield chunk + # diarize=False gives plain text; by default it starts with a speaker tag: "<|speaker:0|> Hello." for event in client.asr.stream_websocket( audio_chunks(), sample_rate=16000, drafts=True, diarize=False @@ -241,6 +244,7 @@ def text_chunks(): yield "this is " yield "streaming!" + audio_stream = client.tts.stream_websocket(text_chunks(), latency="balanced") play(audio_stream) ``` @@ -251,11 +255,13 @@ play(audio_stream) import asyncio from fishaudio import AsyncFishAudio + async def text_chunks(): yield "Hello, " yield "this is " yield "streaming!" + async def main(): client = AsyncFishAudio() # stream_websocket is an async generator: iterate it, don't await the call @@ -264,6 +270,7 @@ async def main(): async for chunk in audio_stream: f.write(chunk) + asyncio.run(main()) ``` @@ -280,10 +287,7 @@ from fishaudio.types import ReferenceAudio with open("reference.wav", "rb") as f: audio = client.tts.convert( text="Cloned voice speaking", - references=[ReferenceAudio( - audio=f.read(), - text="Text spoken in reference" - )] + references=[ReferenceAudio(audio=f.read(), text="Text spoken in reference")], ) ``` @@ -293,16 +297,11 @@ with open("reference.wav", "rb") as f: # Create voice model for reuse with open("voice_sample.wav", "rb") as f: voice = client.voices.create( - title="My Voice", - voices=[f.read()], - description="Custom voice clone" + title="My Voice", voices=[f.read()], description="Custom voice clone" ) # Use the created model -audio = client.tts.convert( - text="Using my saved voice", - reference_id=voice.id -) +audio = client.tts.convert(text="Using my saved voice", reference_id=voice.id) ``` [Learn more](https://docs.fish.audio/developer-guide/sdk-guide/python/voice-cloning) @@ -334,8 +333,12 @@ HTTPXClientInstrumentor().instrument() from fishaudio.core import RequestOptions, WebSocketOptions headers = {"traceparent": traceparent} -audio = client.tts.convert(text="Hello!", request_options=RequestOptions(additional_headers=headers)) -stream = client.tts.stream_websocket(text_chunks(), ws_options=WebSocketOptions(additional_headers=headers)) +audio = client.tts.convert( + text="Hello!", request_options=RequestOptions(additional_headers=headers) +) +stream = client.tts.stream_websocket( + text_chunks(), ws_options=WebSocketOptions(additional_headers=headers) +) ``` Or give the client an `httpx_client` with a request event hook, which runs for HTTP calls and WebSocket handshakes alike (with `AsyncFishAudio`, use an `httpx.AsyncClient` and an async hook). A client you pass in keeps its own settings, so set its `timeout`: httpx's default is 5 seconds. @@ -343,9 +346,11 @@ Or give the client an `httpx_client` with a request event hook, which runs for H ```python import httpx + def add_traceparent(request): request.headers["traceparent"] = current_traceparent() + http_client = httpx.Client( base_url="https://api.fish.audio", timeout=240.0, @@ -361,7 +366,7 @@ from fishaudio.exceptions import ( AuthenticationError, RateLimitError, ValidationError, - FishAudioError + FishAudioError, ) try: diff --git a/examples/getting-started/01_simple_tts.py b/examples/getting-started/01_simple_tts.py index bb83c64..0eedc01 100644 --- a/examples/getting-started/01_simple_tts.py +++ b/examples/getting-started/01_simple_tts.py @@ -50,7 +50,7 @@ def main(): if __name__ == "__main__": try: main() - except Exception as e: + except Exception as e: # noqa: BLE001 print(f"Error: {e}") print("\nMake sure you have set your API key:") print(" export FISH_API_KEY='your_api_key'") diff --git a/examples/getting-started/02_play_audio.py b/examples/getting-started/02_play_audio.py index 8b8bc36..a0a118e 100644 --- a/examples/getting-started/02_play_audio.py +++ b/examples/getting-started/02_play_audio.py @@ -95,7 +95,7 @@ def demo_playback_methods(): # print("="*50 + "\n") # demo_playback_methods() - except Exception as e: + except Exception as e: # noqa: BLE001 print(f"Error: {e}") print("\nTroubleshooting:") print("1. Make sure your API key is set: export FISH_API_KEY='your_key'") diff --git a/examples/getting-started/03_check_credits.py b/examples/getting-started/03_check_credits.py index 3aaf90e..c294df9 100644 --- a/examples/getting-started/03_check_credits.py +++ b/examples/getting-started/03_check_credits.py @@ -41,7 +41,7 @@ def main(): # Note: Credits are consumed based on usage # Check the Fish Audio pricing page for current rates - except Exception as e: + except Exception as e: # noqa: BLE001 print(f" Error fetching credits: {e}") # Check prepaid package information @@ -56,7 +56,7 @@ def main(): else: print(" No active prepaid package") - except Exception as e: + except Exception as e: # noqa: BLE001 print(f" Error fetching package: {e}") print("\n" + "=" * 60) @@ -79,7 +79,7 @@ def check_api_setup(): print(f" Your current balance: {float(credits.credit):,.2f} credits") return True - except Exception as e: + except Exception as e: # noqa: BLE001 print("API setup failed!") print(f" Error: {e}") print("\nPlease check:") @@ -97,7 +97,7 @@ def check_api_setup(): # print("\n\nRunning quick API setup check...") # check_api_setup() - except Exception as e: + except Exception as e: # noqa: BLE001 print(f"\nError: {e}") print("\nMake sure you have set your API key:") print(" export FISH_API_KEY='your_api_key'") diff --git a/pyproject.toml b/pyproject.toml index 9bd62e0..482ca23 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -66,8 +66,8 @@ dev = [ "pytest-cov>=5.0.0", "pytest-rerunfailures>=16.0.1", "python-dotenv>=1.0.1", - "ruff>=0.14.3", - "ty>=0.0.2", + "ruff>=0.17.6", + "ty>=0.0.109", ] [[tool.pydoc-markdown.loaders]] diff --git a/scripts/copy_docs.py b/scripts/copy_docs.py old mode 100644 new mode 100755 diff --git a/src/fish_audio_sdk/__init__.py b/src/fish_audio_sdk/__init__.py index d38614b..8696e87 100644 --- a/src/fish_audio_sdk/__init__.py +++ b/src/fish_audio_sdk/__init__.py @@ -15,19 +15,19 @@ from .websocket import AsyncWebSocketSession, WebSocketSession __all__ = [ - "Session", - "HttpCodeErr", - "WebSocketErr", - "ReferenceAudio", - "TTSRequest", + "APICreditEntity", "ASRRequest", - "WebSocketSession", "AsyncWebSocketSession", - "Prosody", - "PaginatedResponse", + "CloseEvent", + "HttpCodeErr", "ModelEntity", - "APICreditEntity", + "PaginatedResponse", + "Prosody", + "ReferenceAudio", + "Session", "StartEvent", + "TTSRequest", "TextEvent", - "CloseEvent", + "WebSocketErr", + "WebSocketSession", ] diff --git a/src/fish_audio_sdk/schemas.py b/src/fish_audio_sdk/schemas.py index a9dcba3..f4bc971 100644 --- a/src/fish_audio_sdk/schemas.py +++ b/src/fish_audio_sdk/schemas.py @@ -1,6 +1,6 @@ from __future__ import annotations -import datetime +import datetime as dt import decimal from typing import Annotated, Generic, Literal, TypeVar @@ -84,8 +84,8 @@ class ModelEntity(BaseModel): state: Literal["created", "training", "trained", "failed"] tags: list[str] samples: list[SampleEntity] - created_at: datetime.datetime - updated_at: datetime.datetime + created_at: dt.datetime + updated_at: dt.datetime languages: list[str] visibility: Literal["public", "unlist", "private"] lock_visibility: bool diff --git a/src/fishaudio/__init__.py b/src/fishaudio/__init__.py index c771486..957aa6a 100644 --- a/src/fishaudio/__init__.py +++ b/src/fishaudio/__init__.py @@ -68,7 +68,7 @@ from .utils import play, save, stream # Main exports -__all__ = [ +__all__ = [ # noqa: RUF022 - grouped by topic # Main clients "FishAudio", "AsyncFishAudio", diff --git a/src/fishaudio/core/__init__.py b/src/fishaudio/core/__init__.py index 2b0cc45..8b18b43 100644 --- a/src/fishaudio/core/__init__.py +++ b/src/fishaudio/core/__init__.py @@ -6,9 +6,9 @@ from .websocket_options import WebSocketOptions __all__ = [ + "OMIT", "AsyncClientWrapper", "ClientWrapper", - "OMIT", "RequestOptions", "WebSocketOptions", ] diff --git a/src/fishaudio/core/_sse.py b/src/fishaudio/core/_sse.py index 6fa1f70..1f7d8b3 100644 --- a/src/fishaudio/core/_sse.py +++ b/src/fishaudio/core/_sse.py @@ -54,8 +54,7 @@ def feed(self, chunk: bytes) -> list[ServerSentEvent]: continue # comment, used by servers as a keep-alive name, _, value = line.decode("utf-8", errors="replace").partition(":") - if value.startswith(" "): - value = value[1:] + value = value.removeprefix(" ") if name == "data": self._data.append(value) elif name == "event": diff --git a/src/fishaudio/core/client_wrapper.py b/src/fishaudio/core/client_wrapper.py index f4663ca..e18c1df 100644 --- a/src/fishaudio/core/client_wrapper.py +++ b/src/fishaudio/core/client_wrapper.py @@ -53,14 +53,14 @@ def _read_error_body(response: httpx.Response) -> tuple[Any, str]: """ try: text = response.text - except Exception: + except Exception: # noqa: BLE001 - an unreadable body becomes an empty text try: text = response.content.decode("utf-8", errors="replace") - except Exception: + except Exception: # noqa: BLE001 - an unreadable body becomes an empty text text = "" try: data = response.json() - except Exception: + except Exception: # noqa: BLE001 - a body that is not JSON becomes None data = None return data, text diff --git a/src/fishaudio/core/iterators.py b/src/fishaudio/core/iterators.py index 46c1c83..83b7f32 100644 --- a/src/fishaudio/core/iterators.py +++ b/src/fishaudio/core/iterators.py @@ -4,6 +4,7 @@ from typing import Optional import httpx +from typing_extensions import Self from fishaudio.types.shared import _set_response_headers from fishaudio.types.tts import ( @@ -84,7 +85,7 @@ def close(self) -> None: if self._on_close is not None: self._on_close() - def __enter__(self) -> "AudioStream": + def __enter__(self) -> Self: return self def __exit__(self, exc_type, exc_val, exc_tb) -> None: @@ -107,10 +108,7 @@ def collect(self) -> bytes: ``` """ try: - chunks = [] - for chunk in self._iter: - chunks.append(chunk) - return b"".join(chunks) + return b"".join(self._iter) finally: self.close() @@ -186,7 +184,7 @@ async def aclose(self) -> None: if self._on_close is not None: await self._on_close() - async def __aenter__(self) -> "AsyncAudioStream": + async def __aenter__(self) -> Self: return self async def __aexit__(self, exc_type, exc_val, exc_tb) -> None: @@ -348,7 +346,7 @@ def close(self) -> None: if self._on_close is not None: self._on_close() - def __enter__(self) -> "TTSTimestampStream": + def __enter__(self) -> Self: return self def __exit__(self, exc_type, exc_val, exc_tb) -> None: @@ -478,7 +476,7 @@ async def aclose(self) -> None: if self._on_close is not None: await self._on_close() - async def __aenter__(self) -> "AsyncTTSTimestampStream": + async def __aenter__(self) -> Self: return self async def __aexit__(self, exc_type, exc_val, exc_tb) -> None: diff --git a/src/fishaudio/exceptions.py b/src/fishaudio/exceptions.py index ae8521b..00a9c01 100644 --- a/src/fishaudio/exceptions.py +++ b/src/fishaudio/exceptions.py @@ -9,8 +9,6 @@ class FishAudioError(Exception): """Base exception for all Fish Audio SDK errors.""" - pass - class APIError(FishAudioError): """Raised when the API returns an error response. @@ -44,38 +42,26 @@ def __init__( class AuthenticationError(APIError): """Raised when authentication fails (401).""" - pass - class PermissionError(APIError): """Raised when permission is denied (403).""" - pass - class NotFoundError(APIError): """Raised when a resource is not found (404).""" - pass - class RateLimitError(APIError): """Raised when rate limit is exceeded (429).""" - pass - class ServerError(APIError): """Raised when the server encounters an error (5xx).""" - pass - class WebSocketError(FishAudioError): """Raised when WebSocket connection or streaming fails.""" - pass - class ASRRealtimeError(WebSocketError): """Raised when a realtime speech-to-text session ends with an error. @@ -120,8 +106,6 @@ def __init__( class ValidationError(FishAudioError): """Raised when request validation fails.""" - pass - class DependencyError(FishAudioError): """Raised when a required dependency is missing.""" diff --git a/src/fishaudio/resources/__init__.py b/src/fishaudio/resources/__init__.py index f809b3b..93d0011 100644 --- a/src/fishaudio/resources/__init__.py +++ b/src/fishaudio/resources/__init__.py @@ -5,7 +5,7 @@ from .tts import AsyncTTSClient, TTSClient from .voices import AsyncVoicesClient, VoicesClient -__all__ = [ +__all__ = [ # noqa: RUF022 - grouped by topic # Sync clients "AccountClient", "ASRClient", diff --git a/src/fishaudio/resources/asr.py b/src/fishaudio/resources/asr.py index 5d388b7..a6b4b01 100644 --- a/src/fishaudio/resources/asr.py +++ b/src/fishaudio/resources/asr.py @@ -169,7 +169,7 @@ def stream_websocket( drafts: Optional[bool] = None, diarize: Optional[bool] = None, terms: Optional[list[str]] = None, - config: ASRRealtimeConfig = ASRRealtimeConfig(), + config: ASRRealtimeConfig = ASRRealtimeConfig(), # noqa: B008 - copied before use model: str = "transcribe-stream-1", ws_options: Optional[WebSocketOptions] = None, ) -> ASRRealtimeStream: @@ -366,7 +366,7 @@ def stream_websocket( drafts: Optional[bool] = None, diarize: Optional[bool] = None, terms: Optional[list[str]] = None, - config: ASRRealtimeConfig = ASRRealtimeConfig(), + config: ASRRealtimeConfig = ASRRealtimeConfig(), # noqa: B008 - copied before use model: str = "transcribe-stream-1", ws_options: Optional[WebSocketOptions] = None, ) -> AsyncASRRealtimeStream: diff --git a/src/fishaudio/resources/asr_realtime.py b/src/fishaudio/resources/asr_realtime.py index eea64ef..3518360 100644 --- a/src/fishaudio/resources/asr_realtime.py +++ b/src/fishaudio/resources/asr_realtime.py @@ -9,9 +9,14 @@ import queue import threading import time +from collections.abc import ( # noqa: TC003 - runtime, for typing.get_type_hints + AsyncIterable, + Generator, + Iterable, + Iterator, +) +from contextlib import AbstractAsyncContextManager, AbstractContextManager from typing import ( - TYPE_CHECKING, - Any, Callable, Optional, Union, @@ -19,7 +24,14 @@ import httpx import ormsgpack -from httpx_ws import HTTPXWSException, WebSocketDisconnect, WebSocketUpgradeError +from httpx_ws import ( + AsyncWebSocketSession, + HTTPXWSException, + WebSocketDisconnect, + WebSocketSession, + WebSocketUpgradeError, +) +from typing_extensions import Self # noqa: TC002 - runtime, for typing.get_type_hints from fishaudio.core._ws_utils import drain_reader, interrupt_writes from fishaudio.core.client_wrapper import _api_error @@ -53,12 +65,6 @@ ASRVadEvent, ) -if TYPE_CHECKING: - from collections.abc import AsyncIterable, Generator, Iterable, Iterator - from contextlib import AbstractAsyncContextManager, AbstractContextManager - - from httpx_ws import AsyncWebSocketSession, WebSocketSession - logger = logging.getLogger(__name__) REALTIME_PATH = "/v1/asr/realtime" @@ -251,7 +257,7 @@ def _send_audio( if item: link.send(encode_message(item)) link.send(_AUDIO_DONE) - except BaseException as e: + except BaseException as e: # noqa: BLE001 - re-raised to the consumer if not link.closed: # otherwise the consumer left: nobody to tell failure.append(e) finally: @@ -391,10 +397,10 @@ def __iter__(self) -> Iterator[ASRRealtimeEvent]: def __next__(self) -> ASRRealtimeEvent: return next(self._events) - def __enter__(self) -> ASRRealtimeStream: + def __enter__(self) -> Self: return self - def __exit__(self, *exc_info: Any) -> None: + def __exit__(self, *exc_info: object) -> None: self.close() def close(self) -> None: @@ -571,7 +577,7 @@ async def _run_session( await events.put(event) # waits while the consumer is behind if isinstance(event, ASRSessionDoneEvent): break - except Exception as e: + except Exception as e: # noqa: BLE001 - re-raised to the consumer # Leave the connection block without an exception: newer httpx-ws # wraps one that crosses it in an ExceptionGroup. error = e @@ -594,7 +600,7 @@ async def _run_session( except WebSocketUpgradeError as e: error = _upgrade_error(e.response) error.__cause__ = e - except Exception as e: + except Exception as e: # noqa: BLE001 - re-raised to the consumer error = error or e # keep the session's own error over one from closing # The connection is closed by now. If the queue is full this waits for the # consumer; one that has left cancels the task (aclose, or garbage collection). @@ -663,7 +669,9 @@ async def __anext__(self) -> ASRRealtimeEvent: if self._events is None: # The session task must not reference this object: it is cancelled, # and the connection closed, when the stream is garbage collected. - self._events = asyncio.Queue(_EVENT_QUEUE_SIZE) + self._events = asyncio.Queue[Union[ASRRealtimeEvent, _End]]( + _EVENT_QUEUE_SIZE + ) self._task = asyncio.create_task( _run_session( self._link, @@ -731,10 +739,10 @@ def _drop_getter(self) -> None: with contextlib.suppress(RuntimeError): getter.cancel() - async def __aenter__(self) -> AsyncASRRealtimeStream: + async def __aenter__(self) -> Self: return self - async def __aexit__(self, *exc_info: Any) -> None: + async def __aexit__(self, *exc_info: object) -> None: await self.aclose() async def aclose(self) -> None: diff --git a/src/fishaudio/resources/tts.py b/src/fishaudio/resources/tts.py index d8a8cfa..ffe9793 100644 --- a/src/fishaudio/resources/tts.py +++ b/src/fishaudio/resources/tts.py @@ -167,7 +167,7 @@ def stream( format: Optional[AudioFormat] = None, latency: Optional[LatencyMode] = None, speed: Optional[float] = None, - config: TTSConfig = TTSConfig(), + config: TTSConfig = TTSConfig(), # noqa: B008 - never mutated model: Union[Model, str] = "s2.1-pro", request_options: Optional[RequestOptions] = None, ) -> AudioStream: @@ -258,7 +258,7 @@ def convert( format: Optional[AudioFormat] = None, latency: Optional[LatencyMode] = None, speed: Optional[float] = None, - config: TTSConfig = TTSConfig(), + config: TTSConfig = TTSConfig(), # noqa: B008 - never mutated model: Union[Model, str] = "s2.1-pro", request_options: Optional[RequestOptions] = None, ) -> bytes: @@ -322,7 +322,7 @@ def stream_with_timestamps( format: Optional[AudioFormat] = None, latency: Optional[LatencyMode] = None, speed: Optional[float] = None, - config: TTSConfig = TTSConfig(), + config: TTSConfig = TTSConfig(), # noqa: B008 - never mutated model: Union[Model, str] = "s2.1-pro", request_options: Optional[RequestOptions] = None, ) -> TTSTimestampStream: @@ -411,7 +411,7 @@ def convert_with_timestamps( format: Optional[AudioFormat] = None, latency: Optional[LatencyMode] = None, speed: Optional[float] = None, - config: TTSConfig = TTSConfig(), + config: TTSConfig = TTSConfig(), # noqa: B008 - never mutated model: Union[Model, str] = "s2.1-pro", request_options: Optional[RequestOptions] = None, ) -> TTSTimestampResult: @@ -478,7 +478,7 @@ def stream_websocket( format: Optional[AudioFormat] = None, latency: Optional[LatencyMode] = None, speed: Optional[float] = None, - config: TTSConfig = TTSConfig(), + config: TTSConfig = TTSConfig(), # noqa: B008 - never mutated model: Union[Model, str] = "s2.1-pro", max_workers: int = 10, ws_options: Optional[WebSocketOptions] = None, @@ -642,7 +642,7 @@ async def stream( format: Optional[AudioFormat] = None, latency: Optional[LatencyMode] = None, speed: Optional[float] = None, - config: TTSConfig = TTSConfig(), + config: TTSConfig = TTSConfig(), # noqa: B008 - never mutated model: Union[Model, str] = "s2.1-pro", request_options: Optional[RequestOptions] = None, ) -> AsyncAudioStream: @@ -736,7 +736,7 @@ async def convert( format: Optional[AudioFormat] = None, latency: Optional[LatencyMode] = None, speed: Optional[float] = None, - config: TTSConfig = TTSConfig(), + config: TTSConfig = TTSConfig(), # noqa: B008 - never mutated model: Union[Model, str] = "s2.1-pro", request_options: Optional[RequestOptions] = None, ) -> bytes: @@ -801,7 +801,7 @@ async def stream_with_timestamps( format: Optional[AudioFormat] = None, latency: Optional[LatencyMode] = None, speed: Optional[float] = None, - config: TTSConfig = TTSConfig(), + config: TTSConfig = TTSConfig(), # noqa: B008 - never mutated model: Union[Model, str] = "s2.1-pro", request_options: Optional[RequestOptions] = None, ) -> AsyncTTSTimestampStream: @@ -891,7 +891,7 @@ async def convert_with_timestamps( format: Optional[AudioFormat] = None, latency: Optional[LatencyMode] = None, speed: Optional[float] = None, - config: TTSConfig = TTSConfig(), + config: TTSConfig = TTSConfig(), # noqa: B008 - never mutated model: Union[Model, str] = "s2.1-pro", request_options: Optional[RequestOptions] = None, ) -> TTSTimestampResult: @@ -959,7 +959,7 @@ async def stream_websocket( format: Optional[AudioFormat] = None, latency: Optional[LatencyMode] = None, speed: Optional[float] = None, - config: TTSConfig = TTSConfig(), + config: TTSConfig = TTSConfig(), # noqa: B008 - never mutated model: Union[Model, str] = "s2.1-pro", ws_options: Optional[WebSocketOptions] = None, ): diff --git a/src/fishaudio/types/__init__.py b/src/fishaudio/types/__init__.py index e7d6e2f..34cfaaf 100644 --- a/src/fishaudio/types/__init__.py +++ b/src/fishaudio/types/__init__.py @@ -59,7 +59,7 @@ ) from .voices import Author, Sample, Voice -__all__ = [ +__all__ = [ # noqa: RUF022 - grouped by topic # Account types "Credits", "Package", diff --git a/src/fishaudio/types/voices.py b/src/fishaudio/types/voices.py index 9ae8c3a..32a3cf1 100644 --- a/src/fishaudio/types/voices.py +++ b/src/fishaudio/types/voices.py @@ -1,6 +1,6 @@ """Voice and model management types.""" -import datetime +import datetime as dt from typing import Literal from pydantic import BaseModel, Field @@ -77,8 +77,8 @@ class Voice(BaseModel): state: ModelState tags: list[str] samples: list[Sample] - created_at: datetime.datetime - updated_at: datetime.datetime + created_at: dt.datetime + updated_at: dt.datetime languages: list[str] visibility: Visibility lock_visibility: bool diff --git a/src/fishaudio/utils/play.py b/src/fishaudio/utils/play.py index 6e592a8..4ff25b3 100644 --- a/src/fishaudio/utils/play.py +++ b/src/fishaudio/utils/play.py @@ -55,7 +55,7 @@ def play( # Notebook mode if notebook: try: - from IPython.display import Audio, display # ty: ignore[unresolved-import] + from IPython.display import Audio, display # ty: ignore[import-not-found] display(Audio(audio, rate=44100, autoplay=True)) return diff --git a/tests/integration/test_account_integration.py b/tests/integration/test_account_integration.py index 1bc0a00..8aa16af 100644 --- a/tests/integration/test_account_integration.py +++ b/tests/integration/test_account_integration.py @@ -2,8 +2,10 @@ from decimal import Decimal +import pydantic import pytest +from fishaudio.exceptions import APIError from fishaudio.types import Credits, Package @@ -23,15 +25,15 @@ def test_get_package(self, client): """Test getting package information.""" try: package = client.account.get_package() - - assert isinstance(package, Package) - assert package.total >= 0 - assert package.balance >= 0 - assert package.user_id - except Exception: + except (APIError, pydantic.ValidationError): # User might not have a package pytest.skip("No package available for this account") + assert isinstance(package, Package) + assert package.total >= 0 + assert package.balance >= 0 + assert package.user_id + class TestAsyncAccountIntegration: """Test async Account with real API.""" @@ -50,9 +52,9 @@ async def test_async_get_package(self, async_client): """Test getting package async.""" try: package = await async_client.account.get_package() - - assert isinstance(package, Package) - assert package.total >= 0 - assert package.balance >= 0 - except Exception: + except (APIError, pydantic.ValidationError): pytest.skip("No package available for this account") + + assert isinstance(package, Package) + assert package.total >= 0 + assert package.balance >= 0 diff --git a/tests/integration/test_tts_integration.py b/tests/integration/test_tts_integration.py index 157b1e6..437049b 100644 --- a/tests/integration/test_tts_integration.py +++ b/tests/integration/test_tts_integration.py @@ -4,6 +4,7 @@ import pytest +from fishaudio.exceptions import APIError from fishaudio.types import Prosody, TTSConfig from fishaudio.types.shared import AudioFormat, Model @@ -75,11 +76,12 @@ def test_tts_empty_text_should_fail(self, client): # This might succeed with silence or fail - test behavior try: audio = client.tts.convert(text="") + except APIError: + # If the API refuses it, that's also acceptable + pass + else: # If it succeeds, verify we get something assert isinstance(audio, bytes) - except Exception: - # If it fails, that's also acceptable - pass class TestAsyncTTSIntegration: diff --git a/tests/integration/test_tts_websocket_integration.py b/tests/integration/test_tts_websocket_integration.py index 4e3336e..a0a8a33 100644 --- a/tests/integration/test_tts_websocket_integration.py +++ b/tests/integration/test_tts_websocket_integration.py @@ -354,8 +354,8 @@ async def test_async_websocket_streaming_multiple_calls( for i in range(3): - async def text_stream(): - yield f"This is call number {i + 1}." + async def text_stream(number=i + 1): + yield f"This is call number {number}." audio_chunks = [] async for chunk in async_client.tts.stream_websocket(text_stream()): diff --git a/tests/unit/realtime_server.py b/tests/unit/realtime_server.py index 1ffcb8e..80c72c4 100644 --- a/tests/unit/realtime_server.py +++ b/tests/unit/realtime_server.py @@ -210,7 +210,7 @@ def _serve(self) -> None: self.connection.wait_gone() except ClientGone: pass - except BaseException as e: + except BaseException as e: # noqa: BLE001 - re-raised by the test self.error = e finally: with contextlib.suppress(OSError): diff --git a/tests/unit/test_asr_realtime.py b/tests/unit/test_asr_realtime.py index 065b68e..66d85e7 100644 --- a/tests/unit/test_asr_realtime.py +++ b/tests/unit/test_asr_realtime.py @@ -550,7 +550,7 @@ def script(conn): pytest.raises(ASRRealtimeError) as exc_info, ): for event in client.asr.stream_websocket(endless_audio()): - events.append(event) + events.append(event) # noqa: PERF402 - keeps events yielded before the error server.stop() assert [event.type for event in events] == ["session_started", "error"] @@ -695,7 +695,7 @@ def connect(): ) def test_refused_upgrade_raises_api_error(self, status, error_class): with ( - serving(lambda conn: None, reject_status=status) as (server, client), + serving(lambda conn: None, reject_status=status) as (_server, client), pytest.raises(error_class) as exc_info, ): list(client.asr.stream_websocket(iter([CHUNK]))) diff --git a/tests/unit/test_deprecated_models.py b/tests/unit/test_deprecated_models.py index 2b55dd5..a725f0f 100644 --- a/tests/unit/test_deprecated_models.py +++ b/tests/unit/test_deprecated_models.py @@ -534,7 +534,7 @@ def test_caller_without_a_str_module_name_does_not_raise(module_name, shown): a frame whose __name__ is None, as for any warnings.warn call.""" with warnings.catch_warnings(record=True) as record: warnings.simplefilter("always") - exec( + exec( # noqa: S102 - the case needs a caller whose __name__ is not a str "warn_if_deprecated_model('s1')", { "__name__": module_name, diff --git a/tests/unit/test_tts.py b/tests/unit/test_tts.py index ef2fd4b..d1fea19 100644 --- a/tests/unit/test_tts.py +++ b/tests/unit/test_tts.py @@ -339,10 +339,8 @@ def test_stream_behavior(self, tts_client, mock_client_wrapper): # Get iterator audio_stream = tts_client.stream(text="Hello") - # Consume one chunk at a time - result = [] - for chunk in audio_stream: - result.append(chunk) + # Consume through iteration + result = list(audio_stream) # Empty chunk should be filtered out assert result == [b"chunk1", b"chunk2", b"chunk3"] diff --git a/tests/unit/test_type_hints.py b/tests/unit/test_type_hints.py new file mode 100644 index 0000000..1fa5315 --- /dev/null +++ b/tests/unit/test_type_hints.py @@ -0,0 +1,59 @@ +"""Annotations on the public stream classes resolve at runtime.""" + +import typing + +import pytest +from typing_extensions import Self + +from fishaudio.core.iterators import ( + AsyncAudioStream, + AsyncTTSTimestampStream, + AudioStream, + TTSTimestampStream, +) +from fishaudio.resources.asr_realtime import ASRRealtimeStream, AsyncASRRealtimeStream + +STREAM_CLASSES = [ + AudioStream, + AsyncAudioStream, + TTSTimestampStream, + AsyncTTSTimestampStream, + ASRRealtimeStream, + AsyncASRRealtimeStream, +] + + +def _methods(cls): + for name, member in vars(cls).items(): + if isinstance(member, property): + yield f"{cls.__name__}.{name}", member.fget + elif callable(member): + yield f"{cls.__name__}.{name}", member + + +STREAM_METHODS = [m for cls in STREAM_CLASSES for m in _methods(cls)] + + +@pytest.mark.parametrize( + "method", + [method for _, method in STREAM_METHODS], + ids=[name for name, _ in STREAM_METHODS], +) +def test_stream_method_annotations_resolve(method): + typing.get_type_hints(method) + + +@pytest.mark.parametrize( + "method", + [ + AudioStream.__enter__, + AsyncAudioStream.__aenter__, + ASRRealtimeStream.__enter__, + AsyncASRRealtimeStream.__aenter__, + TTSTimestampStream.__enter__, + AsyncTTSTimestampStream.__aenter__, + ], + ids=lambda method: method.__qualname__, +) +def test_enter_methods_resolve_to_self(method): + assert typing.get_type_hints(method) == {"return": Self} diff --git a/tests/unit/test_user_agent.py b/tests/unit/test_user_agent.py index ffd65d5..2d167c0 100644 --- a/tests/unit/test_user_agent.py +++ b/tests/unit/test_user_agent.py @@ -15,6 +15,7 @@ import httpx import pytest +from httpx_ws import WebSocketUpgradeError from fishaudio import AsyncFishAudio, FishAudio, __version__ from fishaudio.core import AsyncClientWrapper, ClientWrapper, RequestOptions @@ -26,7 +27,7 @@ build_user_agent, user_agent, ) -from fishaudio.exceptions import APIError +from fishaudio.exceptions import APIError, AuthenticationError from .realtime_server import RealtimeServer @@ -203,8 +204,10 @@ def _answer(self) -> None: ) else: body, content_type = ( - b'{"_id": "c", "user_id": "u", "credit": "1",' - b' "created_at": "2026-01-01", "updated_at": "2026-01-01"}', + ( + b'{"_id": "c", "user_id": "u", "credit": "1",' + b' "created_at": "2026-01-01", "updated_at": "2026-01-01"}' + ), "application/json", ) if self.status != 200: @@ -317,7 +320,7 @@ class TestWebSockets: def test_tts_websocket_handshake(self): with refusing_ws_server() as server: client = FishAudio(api_key="test-key", base_url=server.url) - with pytest.raises(Exception): + with pytest.raises(WebSocketUpgradeError): for _ in client.tts.stream_websocket(iter(["hi"])): pass client.close() @@ -332,7 +335,7 @@ async def test_async_tts_websocket_handshake(self): async def text(): yield "hi" - with pytest.raises(Exception): + with pytest.raises(WebSocketUpgradeError): async for _ in client.tts.stream_websocket(text()): pass await client.close() @@ -343,7 +346,7 @@ def test_asr_realtime_handshake_with_a_client_user_agent(self): with refusing_ws_server() as server: own = httpx.Client(base_url=server.url, headers={"User-Agent": "app/2"}) client = FishAudio(api_key="test-key", httpx_client=own) - with pytest.raises(Exception): + with pytest.raises(AuthenticationError): for _ in client.asr.stream_websocket(iter([b"\x00\x00"])): pass own.close() @@ -358,7 +361,7 @@ async def test_async_asr_realtime_handshake(self): async def audio(): yield b"\x00\x00" - with pytest.raises(Exception): + with pytest.raises(AuthenticationError): async for _ in client.asr.stream_websocket(audio()): pass await client.close() diff --git a/uv.lock b/uv.lock index 35f0852..a54badc 100644 --- a/uv.lock +++ b/uv.lock @@ -652,7 +652,7 @@ wheels = [ [[package]] name = "fish-audio-sdk" -version = "1.6.0" +version = "1.7.0" source = { editable = "." } dependencies = [ { name = "httpx" }, @@ -714,8 +714,8 @@ dev = [ { name = "pytest-cov", specifier = ">=5.0.0" }, { name = "pytest-rerunfailures", specifier = ">=16.0.1" }, { name = "python-dotenv", specifier = ">=1.0.1" }, - { name = "ruff", specifier = ">=0.14.3" }, - { name = "ty", specifier = ">=0.0.2" }, + { name = "ruff", specifier = ">=0.17.6" }, + { name = "ty", specifier = ">=0.0.109" }, ] [[package]] @@ -1981,27 +1981,27 @@ wheels = [ [[package]] name = "ruff" -version = "0.15.13" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/24/21/a7d5c126d5b557715ef81098f3db2fe20f622a039ff2e626af28d674ab80/ruff-0.15.13.tar.gz", hash = "sha256:f9d89f17f7ba7fb2ed42921f0df75da797a9a5d71bc39049e2c687cf2baf44b7", size = 4678180, upload-time = "2026-05-14T13:44:37.869Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/c6/61/11d458dc6ac22504fd8e237b29dfd40504c7fbbcc8930402cfe51a8e63ed/ruff-0.15.13-py3-none-linux_armv6l.whl", hash = "sha256:444b580fc72fd6887e650acd3e575e18cdc79dbcf42fb4030b491057921f61f8", size = 10738279, upload-time = "2026-05-14T13:44:18.7Z" }, - { url = "https://files.pythonhosted.org/packages/86/ca/caa871ee7be718c45256fada4e16a218ee3e33f0c4a46b729a60a24912e6/ruff-0.15.13-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:6590d009e7cb7ebf36f83dbdd44a3fa48a0994ff6f1cdc1b08006abe58f98dc7", size = 11124798, upload-time = "2026-05-14T13:44:06.427Z" }, - { url = "https://files.pythonhosted.org/packages/d3/19/43f5f2e568dddde567fc41f8471f9432c09563e19d3e617a48cfa52f8f0a/ruff-0.15.13-py3-none-macosx_11_0_arm64.whl", hash = "sha256:1c26d2f66163deeb6e08d8b39fbbe983ce3c71cea06a6d7591cfd1421793c629", size = 10460761, upload-time = "2026-05-14T13:44:04.375Z" }, - { url = "https://files.pythonhosted.org/packages/99/df/cf938cd6de3003178f03ad7c1ea2a6c099468c03a35037985070b37e76be/ruff-0.15.13-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:9dbd6f94b434f896308e4d57fb7bfde0d02b99f7a64b3bdab0fdfa6a864203a5", size = 10804451, upload-time = "2026-05-14T13:44:25.221Z" }, - { url = "https://files.pythonhosted.org/packages/c7/7d/5d0973129b154ded2225729169d7068f26b467760b146493fde138415f23/ruff-0.15.13-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:bf3259f3be4d181bda591da5db2571aed6853c6a048157756448020bc6c5cd22", size = 10534285, upload-time = "2026-05-14T13:44:08.888Z" }, - { url = "https://files.pythonhosted.org/packages/1f/e3/6b999bbc66cd51e5f073842bc2a3995e99c5e0e72e16b15e7261f7abf57a/ruff-0.15.13-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ae9c17e5eb4430c154e76abc25d79a318190f5a997f38fb6b114416c5319ffc9", size = 11312063, upload-time = "2026-05-14T13:44:11.274Z" }, - { url = "https://files.pythonhosted.org/packages/af/5a/642639e9f5db04f1e97fbd6e091c6fd20725bdf072fb114d00eefb9e6eb8/ruff-0.15.13-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:2e2e39bff6c341f4b577a21b801326fab0b11847f48fcaa83f00a113c9b3cb55", size = 12183079, upload-time = "2026-05-14T13:44:01.634Z" }, - { url = "https://files.pythonhosted.org/packages/19/4c/7585735f6b53b0f12de13618b2f7d250a844f018822efc899df2e7b8295f/ruff-0.15.13-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:e8d9a8e08013542e94d3220bc5b62cc3e5ef87c5f74bff367d3fac14fab013e6", size = 11440833, upload-time = "2026-05-14T13:43:59.043Z" }, - { url = "https://files.pythonhosted.org/packages/e8/31/bf1a0803d077e679cfeee5f2f67290a0fa79c7385b5d9a8c17b9db2c48f0/ruff-0.15.13-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:cc411dfebe5eebe55ce041c6ae080eb7668955e866daa2fbb16692a784f1c4ca", size = 11434486, upload-time = "2026-05-14T13:44:27.761Z" }, - { url = "https://files.pythonhosted.org/packages/e1/4e/62c9b999875d4f14db80f277c030578f5e249c9852d65b7ac7ad0b43c041/ruff-0.15.13-py3-none-manylinux_2_31_riscv64.whl", hash = "sha256:768494eb08b9cee54e2fd27969966f74db5a57f6eaa7a90fcb3306af34dfc4bd", size = 11385189, upload-time = "2026-05-14T13:44:13.704Z" }, - { url = "https://files.pythonhosted.org/packages/fc/89/7e959047a104df3eb12863447c110140191fc5b6c4f379ea2e803fcdb0e4/ruff-0.15.13-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:fb75f9a3a7e42ffe117d734494e6c5e5cb3565d66e12612cb63d0e572a41a5b6", size = 10781380, upload-time = "2026-05-14T13:43:56.734Z" }, - { url = "https://files.pythonhosted.org/packages/ff/52/5fd18f3b88cab63e88aa11516b3b4e1e5f720e5c330f8dbe5c26210f41f8/ruff-0.15.13-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:8cb74dd33bb2f6613faf7fc03b660053b5ac4f80e706d5788c6335e2a8048d51", size = 10540605, upload-time = "2026-05-14T13:44:20.748Z" }, - { url = "https://files.pythonhosted.org/packages/e8/e0/9e35f338990d3e41a82875ff7053ffe97541dae81c9d02143177f381d572/ruff-0.15.13-py3-none-musllinux_1_2_i686.whl", hash = "sha256:7ef823f817fcd191dc934e984be9cf4094f808effa16f2542ad8e821ba02bbf2", size = 11036554, upload-time = "2026-05-14T13:44:16.256Z" }, - { url = "https://files.pythonhosted.org/packages/c2/13/070fb048c24080fba188f66371e2a92785be257ad02242066dc7255ac6e9/ruff-0.15.13-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:f345a13937bd7f09f6f5d19fa0721b0c103e00e7f62bc67089a8e5e037719e0b", size = 11528133, upload-time = "2026-05-14T13:44:22.808Z" }, - { url = "https://files.pythonhosted.org/packages/6b/8c/b1e1666aef7fc6555094d73ae6cd981701781ae85b97ceefc0eebd0b4668/ruff-0.15.13-py3-none-win32.whl", hash = "sha256:4044f94208b3b05ba0fc4a4abd0558cf4d6459bd18325eead7fd8cc66f909b41", size = 10721455, upload-time = "2026-05-14T13:44:35.697Z" }, - { url = "https://files.pythonhosted.org/packages/ab/a6/870a3e8a50590bb92be184ad928c2922f088b00d9dc5c5ec7b924ee08c22/ruff-0.15.13-py3-none-win_amd64.whl", hash = "sha256:7064884d442b7d477b4e7473d12da7f08851d2b1982763c5d3f388a19468a1a4", size = 11900409, upload-time = "2026-05-14T13:44:30.389Z" }, - { url = "https://files.pythonhosted.org/packages/9b/36/9c015cd052fca743dae8cb2aeb16b551444787467db42ceab0fc968865af/ruff-0.15.13-py3-none-win_arm64.whl", hash = "sha256:2471da9bd1068c8c064b5fd9c0c4b6dddffd6369cb1cd68b29993b1709ff1b21", size = 11179336, upload-time = "2026-05-14T13:44:33.026Z" }, +version = "0.17.6" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/df/8e/6929d337aa5380aafc7355f3149f3ccfe55cba5fdd34a045697ebaceb5a0/ruff-0.17.6.tar.gz", hash = "sha256:2b04276561331300325040bdca21460770029ec574d4c479099e39e8ad1ed43c", size = 5374388, upload-time = "2026-11-19T15:56:27.106Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/12/5d/38ef6310c22cacb094e9ae0ff7964062e04ffeecb45ee296894c2b1acc54/ruff-0.17.6-py3-none-linux_armv6l.whl", hash = "sha256:084d9c8f5ec718e7eba007dba339e7cb4f7571d2f267558ae080bf428fb6a69b", size = 10174693, upload-time = "2026-11-19T15:55:52.414Z" }, + { url = "https://files.pythonhosted.org/packages/a2/ed/fd35261049920a4888ef7c787a5c27089502077a4910f6ca8f1213157d6d/ruff-0.17.6-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:9d44ef2140402043fd6f689ef541858b80883a8b0a02e38539ef0614ebe57d0c", size = 10221650, upload-time = "2026-11-19T15:55:54.962Z" }, + { url = "https://files.pythonhosted.org/packages/ba/d4/c31391b36c729cd9fafa65b7a52a58850b99afb2b65da6be4263a53302f2/ruff-0.17.6-py3-none-macosx_11_0_arm64.whl", hash = "sha256:9fbddc08577592e283c265d865e0182de6e33db185494db7b06290d989d888e5", size = 9580986, upload-time = "2026-11-19T15:55:57.391Z" }, + { url = "https://files.pythonhosted.org/packages/eb/11/f3032684dcb3a676d7924545153d76fb56f76753e038f2ea650b99c71bdf/ruff-0.17.6-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:435241c61af5909a022f76219d3d1bf24730dc1bf0acabb5ddf4b569ab3cbb30", size = 10271368, upload-time = "2026-11-19T15:55:59.654Z" }, + { url = "https://files.pythonhosted.org/packages/08/30/c1e024eeb5bae99ae78c6b896ed108f64c9c845a03b56eaeff098e99b6e6/ruff-0.17.6-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:d006bbb2945edb17b0ce6a0c1b5f5a8d81ba11dbac294a0a925effa22ce34feb", size = 9981564, upload-time = "2026-11-19T15:56:01.807Z" }, + { url = "https://files.pythonhosted.org/packages/7d/a5/da3e0c2d4bf02b3ca6c1d7fa4bb04d0081e340b1dd03c4f83b1bec3e15c1/ruff-0.17.6-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:fd661702202a89c00a4c9d0339008805fa5876bfa1c57e165495c2e62230dfbf", size = 10641991, upload-time = "2026-11-19T15:56:03.981Z" }, + { url = "https://files.pythonhosted.org/packages/4d/c1/6d7f981e86201c9db457cca99fd2c09b77574ebab37dff3e9239b218603c/ruff-0.17.6-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:6a12c50a33936dc00db2be21ba25fb168a8b95c55eda2a3ac85005af69885e4b", size = 11403484, upload-time = "2026-11-19T15:56:05.778Z" }, + { url = "https://files.pythonhosted.org/packages/c3/92/8182f07b94998541d5f8f38f53da465aa28062afce24ecc398f45bfc62f1/ruff-0.17.6-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:b5aba93b3db4b70c5697e4fee6e0d5b9c8452a9a3a03679611cadc25915a2173", size = 10892316, upload-time = "2026-11-19T15:56:08.016Z" }, + { url = "https://files.pythonhosted.org/packages/be/48/3df7d81249fd69ee6a49519b149fb5d11e13118fd7d0e8d65329a237087b/ruff-0.17.6-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:aa3b08254a732acba246891089a152c47c5733dc36b8ecb76ce8602f8326e5e4", size = 10645279, upload-time = "2026-11-19T15:56:09.785Z" }, + { url = "https://files.pythonhosted.org/packages/71/80/4d232281544345d7beb98d1d32c24dae804ed360780a6f7753738b81225e/ruff-0.17.6-py3-none-manylinux_2_31_riscv64.whl", hash = "sha256:0692088e6b33455572fb18465e891b443f196e98dc1986825685c77ff6f4c5ac", size = 10534501, upload-time = "2026-11-19T15:56:11.718Z" }, + { url = "https://files.pythonhosted.org/packages/98/0a/b477f075a4a94eb541bf1c759a3e72b2a3d6390af7a13a5be0887229f67c/ruff-0.17.6-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:fb589e032806bb942e4fb526f30b80a1a64112147ed9f1d38cc3de2e255b6f45", size = 10136036, upload-time = "2026-11-19T15:56:13.779Z" }, + { url = "https://files.pythonhosted.org/packages/f1/d8/cf32fbfeb1fcda1470fb5c3bee50c69ee6bca257d487ec1eb17a0387edb4/ruff-0.17.6-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:1939b3d701c7b6981b7cf93473de5bf88b129b9ba84efaed5154cc517c44634d", size = 9969640, upload-time = "2026-11-19T15:56:15.738Z" }, + { url = "https://files.pythonhosted.org/packages/a7/22/bb9f9752f7fcdfdc8b9c51576cc142bb377ade745290e35085173963c7be/ruff-0.17.6-py3-none-musllinux_1_2_i686.whl", hash = "sha256:1a0bea6aa1216e0ec4cd35d3dbccec0d772a7c2aad28ec9c6e82571dff2c20b0", size = 10389427, upload-time = "2026-11-19T15:56:17.617Z" }, + { url = "https://files.pythonhosted.org/packages/81/c7/e09d220818ab146b736d62e0676dad215215d7de0884bbdad9fa075dc7d2/ruff-0.17.6-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:3db61f5015600543a581b07fa7f6f64afa0eeedefe16034cadd88c4074087582", size = 10760296, upload-time = "2026-11-19T15:56:19.463Z" }, + { url = "https://files.pythonhosted.org/packages/2e/09/28329441dfa2c463e2d377a69d4ebbe4d51665e9dbd49fb421f3bc80d775/ruff-0.17.6-py3-none-win32.whl", hash = "sha256:c2f4af6670b7a0501904e881bb3f1f24bd0d964dec1eedbd85f0eb73786e1128", size = 9966266, upload-time = "2026-11-19T15:56:21.581Z" }, + { url = "https://files.pythonhosted.org/packages/4b/9d/18ba9730addfc7554c70d6f171fb8dc2c08e774d9fb2b98e7946ef845c59/ruff-0.17.6-py3-none-win_amd64.whl", hash = "sha256:9cd2fd9923e9806b8b6b67a3469e2258e84bd4d21e45d5a1a690afdfb9c8e57d", size = 10365847, upload-time = "2026-11-19T15:56:23.582Z" }, + { url = "https://files.pythonhosted.org/packages/70/8a/59c33e2a64a4f9672f7f842a0dc522915cfbbaffd13d37d0cec57d1c5c5d/ruff-0.17.6-py3-none-win_arm64.whl", hash = "sha256:d8b14e1473dc86ab9069cf7a2ba5041dc012f59110201844ed04cfddf07055a0", size = 9926224, upload-time = "2026-11-19T15:56:25.269Z" }, ] [[package]] @@ -2119,27 +2119,27 @@ wheels = [ [[package]] name = "ty" -version = "0.0.37" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/c7/c3/60bc4829e0c1a8ff80b592067e1185a7b5ea64608acb0c676c44d5137d52/ty-0.0.37.tar.gz", hash = "sha256:f873f69627bd7f4ef8d57f716c63e5c63d7d1b7327ab3de185c7287a75223011", size = 5655422, upload-time = "2026-05-16T05:57:21.315Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/b8/fe/180dd6914f9db33ad0200fbeaa429dd1fb0a4e6d98320dc1775f100a91af/ty-0.0.37-py3-none-linux_armv6l.whl", hash = "sha256:66cf7310189856e15f690559ddf37735476d2644db917d92f7cef13e5c834adf", size = 11246028, upload-time = "2026-05-16T05:57:41.744Z" }, - { url = "https://files.pythonhosted.org/packages/ef/a2/fa0cfd31467ad99b2db8c81ee9e2b4574589974a3eb9723be825e15b300c/ty-0.0.37-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:2048f3c44ee6c7dde6e0ca064f99c6cada8f6de8ccdcfad2d856a429f8a4ac82", size = 11001460, upload-time = "2026-05-16T05:57:35.27Z" }, - { url = "https://files.pythonhosted.org/packages/10/3f/db60ba9be8b95a464ece0ba103e534047c34b49fee12f5e101f83f8d66db/ty-0.0.37-py3-none-macosx_11_0_arm64.whl", hash = "sha256:32c7b9b5b626aacdec334b44a2698e5f7b80df55bf7338267084d00d4b9546b3", size = 10446549, upload-time = "2026-05-16T05:57:37.252Z" }, - { url = "https://files.pythonhosted.org/packages/56/6f/11dd7174b20ebcb37a3d3b68f60b3940e37e4356e0accd03e2d7f9f70690/ty-0.0.37-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e9fba1bebccf1e656bc5e3787acc5a191c491041ee4d12fe8fe2eff64e7b190d", size = 10961016, upload-time = "2026-05-16T05:57:16.394Z" }, - { url = "https://files.pythonhosted.org/packages/65/dd/3c17ce2860c525817c42c82d7075391b1f5615d36c03aa2d26647a224e8a/ty-0.0.37-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:f987c5fb59aa5017ee8e8c5b57a07390f584e58e572255acd0fa44b3e0b238df", size = 11022093, upload-time = "2026-05-16T05:57:32.741Z" }, - { url = "https://files.pythonhosted.org/packages/d0/a8/e7a40b0b57660921dd3482d219add963973b52ae8507abd88f48439704b5/ty-0.0.37-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:f4168f53146e7a3f52560ff433f238352591c9b1a9ed09397fbb776ddef4f89c", size = 11486333, upload-time = "2026-05-16T05:57:18.839Z" }, - { url = "https://files.pythonhosted.org/packages/da/5f/2c406b98244bc1ad42afdd35f466bcef88664210957dcbb5172254ff2462/ty-0.0.37-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:11e487eafdb80a48223ce68a01f9287528216ffe0126d1629ff11e4f7c1dd3cf", size = 12093526, upload-time = "2026-05-16T05:57:04.456Z" }, - { url = "https://files.pythonhosted.org/packages/d3/3c/5c492a38e1b21a26370727dd4b77a53f05262e53e3be232047f22e7fa1b3/ty-0.0.37-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:9b49f388d063668676daaa7eef57385089d1b844279c0185bd84d4dbc3bcede6", size = 11725957, upload-time = "2026-05-16T05:57:23.356Z" }, - { url = "https://files.pythonhosted.org/packages/b2/00/8a3d9ba265cd0582342c14e4980cc0351aaaa45c6305712d398c9e2446c7/ty-0.0.37-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1b96bfc1cc725d9d859abef4e3aa32a6da0f7472eaaafae2d9a6cffd729c7c61", size = 11610336, upload-time = "2026-05-16T05:57:27.888Z" }, - { url = "https://files.pythonhosted.org/packages/91/4b/6ee172935cb842f5c1553b0d37215b45e9dde05a4c74fdb47fd271907122/ty-0.0.37-py3-none-manylinux_2_31_riscv64.whl", hash = "sha256:c55f39b519107cf234b794718793e11793c055e89028a282a309f690def48117", size = 11797856, upload-time = "2026-05-16T05:57:11.109Z" }, - { url = "https://files.pythonhosted.org/packages/34/ef/75a7425bf9fe74483404ff11a8cbe3aa307354e0801697d6063384157776/ty-0.0.37-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:c79204350de060a077bff7f027a1d53e216cad147d826ec9862be0af2f9c3c1e", size = 10941848, upload-time = "2026-05-16T05:57:30.653Z" }, - { url = "https://files.pythonhosted.org/packages/e0/2c/7ea9dccd55961375067f99ed00fb8eabb491f6a06d0e5f09c797d2b900a6/ty-0.0.37-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:49a21b4dcb2cd94cd0298c96dfb71a2dd25f08bf7e6eefd0c33c519d058908c6", size = 11058248, upload-time = "2026-05-16T05:57:01.785Z" }, - { url = "https://files.pythonhosted.org/packages/98/d7/848fde96c6610b2b1fd75823d44d8977a4525c4397f27332f054ccd6cf9c/ty-0.0.37-py3-none-musllinux_1_2_i686.whl", hash = "sha256:119332095c5974fe1dabfe4fd00c6759eeec5b99f7d7a80b2833feee5a58abdb", size = 11168423, upload-time = "2026-05-16T05:57:39.297Z" }, - { url = "https://files.pythonhosted.org/packages/29/11/c1613ac4b64357b9067df68bac97bcb458cc426cd468a2782847238c539b/ty-0.0.37-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:ac5dc593675414f68862c2f71cc04912b0e5ec5520a9c49fc71ed79205b95c33", size = 11698565, upload-time = "2026-05-16T05:57:14.206Z" }, - { url = "https://files.pythonhosted.org/packages/5f/ac/961205863903881996adb5a6f9cfe570c132882922ac226540346f15df20/ty-0.0.37-py3-none-win32.whl", hash = "sha256:33b57e4095179f06c2ae01c334833645cad94bf7d7467e073cdc3aaabea565d3", size = 10518308, upload-time = "2026-05-16T05:57:25.824Z" }, - { url = "https://files.pythonhosted.org/packages/39/cd/f308edd0cd86e402fe3a1b5c54e0a0dfa0177d80c1557c4849510bb2a147/ty-0.0.37-py3-none-win_amd64.whl", hash = "sha256:3b159351e99cf6eed7aacfb69ae8437725d15599ac4f21c8b2e909b300498b6c", size = 11607159, upload-time = "2026-05-16T05:57:06.76Z" }, - { url = "https://files.pythonhosted.org/packages/1a/ed/5ec4b501479bc5dad55467e2fe72e797cb9c178468c0d1a514536872ebc5/ty-0.0.37-py3-none-win_arm64.whl", hash = "sha256:6c3c2b997f68c71e14242b96d48cba3c086439556af02bb4613aa458950d5c23", size = 10958817, upload-time = "2026-05-16T05:57:08.907Z" }, +version = "0.0.109" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/b5/c0/6c5be0cf55104032c67166b6cb6f32b8226123ccb86377f93933cf9e65f7/ty-0.0.109.tar.gz", hash = "sha256:8de0ee28bca7b7e25164a52e2b3e914d0f4380cb440c24a0cf5a9fc9c4d0085b", size = 8412632, upload-time = "2026-11-23T21:56:40.058Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/f3/18/c4e5297f1a45227dd5de77fc878e82cc0aa9401f1eecb0109fc82ea12b03/ty-0.0.109-py3-none-linux_armv6l.whl", hash = "sha256:cee52815e6114aa5981483ff2eddc17f756275e19a61de45c8d0031ec6b52cd6", size = 15377034, upload-time = "2026-11-23T21:55:52.139Z" }, + { url = "https://files.pythonhosted.org/packages/98/19/913f70d5b492f84802273fc01fd8a9f286b372ec0c64898ecb40a23209c1/ty-0.0.109-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:c95ccb6fd99830e314165ed909f0160a54cd6365265ec7a89ad971a4ef83e123", size = 14913834, upload-time = "2026-11-23T21:55:55.365Z" }, + { url = "https://files.pythonhosted.org/packages/29/36/dee57785bc74354774d2c6285f0fe2b1256e5289a99147678ad0d1c56f4f/ty-0.0.109-py3-none-macosx_11_0_arm64.whl", hash = "sha256:e8cfb207bba2335aecc42ece4ec17eecb644935475e80e4d3907e0b57aa9dee1", size = 14183650, upload-time = "2026-11-23T21:55:57.84Z" }, + { url = "https://files.pythonhosted.org/packages/f3/e2/492d6e22fc1e88577c34befc32157281d6412dc2fe5bf080890218e200c9/ty-0.0.109-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:9268e9c21dc056d4320a5f5eadfe8175e23082b2b213dad89a27e492999f31d7", size = 15147519, upload-time = "2026-11-23T21:56:00.361Z" }, + { url = "https://files.pythonhosted.org/packages/39/9e/1198ed7f809a228e359f2c64c9bad90256f5a769d867ed9670f40c7e6f6c/ty-0.0.109-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:f5948f669f8a9ed429c087f2a496fff87594ce0c31a8b2401f47483496446d06", size = 15098455, upload-time = "2026-11-23T21:56:03.03Z" }, + { url = "https://files.pythonhosted.org/packages/68/81/62dd3b8c7a13d4ebdba6a0bf4b208c60a758dbc4c7eee78c07e1856ba55c/ty-0.0.109-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:d404b7cafbb3af0d1c4754f61fe6cedc6c67bd839b5821e05998468f2e0a9a53", size = 16080888, upload-time = "2026-11-23T21:56:06.606Z" }, + { url = "https://files.pythonhosted.org/packages/a4/3b/e5e24977c4c120bf377d664350ba3b709792c22a79f62cb6f90d67655ea7/ty-0.0.109-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:267fa530665c437f5f490c55a3d60aea8be00795462f614009913418737b3a99", size = 16567295, upload-time = "2026-11-23T21:56:09.888Z" }, + { url = "https://files.pythonhosted.org/packages/43/c4/fbbf890c41ad8259f34f1fd1d95496257350f55b58d84f8a0efdc31b936e/ty-0.0.109-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:f22795bea2a7ff99ddbf9b38c8fa54f0b2e85047f21cab34d8492cbfad07cba7", size = 16407749, upload-time = "2026-11-23T21:56:12.671Z" }, + { url = "https://files.pythonhosted.org/packages/76/54/481866afd012b19a78d3c42c4c078511dc6acde7a3f0f9f2b34dd0b79f06/ty-0.0.109-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7e9dc77a3a1e1124c08fb094dcadc7068081a8579859017b5d5de37b257969c8", size = 17728861, upload-time = "2026-11-23T21:56:15.361Z" }, + { url = "https://files.pythonhosted.org/packages/95/00/f029d69c2890c68802774fd43390c039f33ff09fefeed469252b2efb409d/ty-0.0.109-py3-none-manylinux_2_31_riscv64.whl", hash = "sha256:b706b0f4cff9ceed46c813e7132dbbacce9f7fb9524cb5b7a6f8ad63677e8436", size = 15962907, upload-time = "2026-11-23T21:56:17.973Z" }, + { url = "https://files.pythonhosted.org/packages/96/cb/3ce9fa0614a9b53972a2ff717c3b6b584fab232bec5f39eb21dd5700e73b/ty-0.0.109-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:b856cb4ae2a51a81b2bc2f4de108091d0000845fb262a095f14a2430397d4321", size = 14746495, upload-time = "2026-11-23T21:56:21.335Z" }, + { url = "https://files.pythonhosted.org/packages/1a/bb/1325975f9b91bac8894c503e69f0e8f33b049e52797c018007dd459eacf5/ty-0.0.109-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:5bb6fc5faca2f2a584a5fe1cd5c57e2a11d0c65dd6b55ba78610d96548c837f9", size = 15110227, upload-time = "2026-11-23T21:56:24.114Z" }, + { url = "https://files.pythonhosted.org/packages/54/be/0501c641b820c4625317efeafa72b6186f9aad62a836ea1883b7c04550e3/ty-0.0.109-py3-none-musllinux_1_2_i686.whl", hash = "sha256:202919a6429e504cfe1b88d34ca231b4b4625816c688fb368dbcfda9d324bb5a", size = 15461978, upload-time = "2026-11-23T21:56:27.293Z" }, + { url = "https://files.pythonhosted.org/packages/01/2b/88df59af9c99f0f76dc668caf9e6c54e454d09b637fa10f7c952716c6b7d/ty-0.0.109-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:3425dd066d43e6125dd2ddc42c348d1e0801b7ae35b886d63916a37a9ec80830", size = 15804246, upload-time = "2026-11-23T21:56:29.857Z" }, + { url = "https://files.pythonhosted.org/packages/a7/85/6ea4abb0e579a8b2b95b83e7ef7d9199c0c90541fe754e5dd6883e8744db/ty-0.0.109-py3-none-win32.whl", hash = "sha256:66d382a0022de5c9ce0d082bca23a696e24c890cd8316f3461d485cf0c8b6aa7", size = 14286019, upload-time = "2026-11-23T21:56:32.395Z" }, + { url = "https://files.pythonhosted.org/packages/44/56/672e78e29be87f695b1140d8371448bdbb6c9508e44bfcb9bc8e6ec985c5/ty-0.0.109-py3-none-win_amd64.whl", hash = "sha256:ec3330a2ed852eecedb663d7db67b100b21971c74f4c95e4f9a1e9d706b0677e", size = 15117350, upload-time = "2026-11-23T21:56:34.976Z" }, + { url = "https://files.pythonhosted.org/packages/ba/d6/b647de810df0b589368f8ff542ba1887f12464a779c35907420422fb3035/ty-0.0.109-py3-none-win_arm64.whl", hash = "sha256:897796fe1d8a5ac1122900e19d31eeb8272b542f9934cb40cf1377050f477200", size = 14377902, upload-time = "2026-11-23T21:56:37.483Z" }, ] [[package]]