From 56f5c746f742d7c5684cefe6546aaf106f997412 Mon Sep 17 00:00:00 2001 From: Jacob Lasky Date: Sat, 25 Jul 2026 13:32:56 -0400 Subject: [PATCH] chore(deps): deepgram-sdk 6.0.1 -> 7.6.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Separate from the general dependency refresh on purpose: this is the axis most likely to break, so it gets to fail on its own. The app's v1 surface is unaffected. Comparing connect() signatures across the major, NOTHING was removed and one param was added (`diarize_model`), so every call site keeps working. `_SDK_CONNECT_KWARGS` is computed from the installed SDK rather than hardcoded, so the named/passthrough split re-derived itself with no edit — which is the whole reason it was written that way. The only breakage was in this repo's own test helper: TypeError: DeepgramClientEnvironment.__init__() missing 1 required keyword-only argument: 'agent_rest' 7.0 added an endpoint field, and the helper named its fields positionally. It now enumerates the constructor signature instead, so the next regeneration that adds a URL field costs nothing. Worth noting the wire-contract tests added last week are what caught this at all; the rest of the suite passed. Also unblocks the Flux work. 7.x ships `listen.v2.connect()` with the full Flux parameter surface — eot_threshold, eager_eot_threshold, eot_timeout_ms, language_hint, keyterm, numerals, profanity_filter — so Flux does not need the parallel raw-WebSocket path that would have been necessary on 6.x. Verified: - 113 passed, 1 skipped. - App boots on 7.6.0; GET / returns 200; UI probe passes. - Real WebSocket handshake still carries keyterm/passthrough params correctly. --- pyproject.toml | 2 +- tests/test_wire_contract.py | 26 ++++++++++++++++++++++---- uv.lock | 8 ++++---- 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index a94dc02..a91c661 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ authors = [{ name = "Jacob-Lasky", email = "jacob.s.lasky@gmail.com" }] requires-python = ">=3.12, <3.13" readme = "README.md" dependencies = [ - "deepgram-sdk==6.0.1", + "deepgram-sdk>=7.6.0,<8", "fastapi>=0.115.0,<1", "python-socketio>=5.11.0,<6", "uvicorn>=0.30.0,<1", diff --git a/tests/test_wire_contract.py b/tests/test_wire_contract.py index 26c6e3c..a5c9343 100644 --- a/tests/test_wire_contract.py +++ b/tests/test_wire_contract.py @@ -15,6 +15,8 @@ class of failure — the value was present in our dict and absent on the wire No Deepgram credential is needed, and none should ever be added here: the server is ours, the handshake is local, and the assertion is on the path string. """ +import inspect + import pytest from deepgram import AsyncDeepgramClient from deepgram.environment import DeepgramClientEnvironment @@ -23,6 +25,25 @@ class of failure — the value was present in our dict and absent on the wire from app import _params_to_sdk_kwargs +def _local_environment(port: int) -> DeepgramClientEnvironment: + """Point every SDK endpoint at our loopback server. + + Built by introspecting the constructor rather than naming its fields, because + the SDK adds URL fields between regenerations — 7.0 added `agent_rest`, which + broke this helper with a TypeError while the app itself was fine. Enumerating + the signature means the next added field costs nothing. + """ + ws = f"ws://127.0.0.1:{port}" + http = f"http://127.0.0.1:{port}" + fields = inspect.signature(DeepgramClientEnvironment.__init__).parameters + kwargs = { + name: (http if "rest" in name or name == "base" else ws) + for name in fields + if name != "self" + } + return DeepgramClientEnvironment(**kwargs) + + async def _handshake_path(params: dict) -> str: """Connect the SDK to a local WS server; return the path it requested.""" seen: list[str] = [] @@ -33,12 +54,9 @@ async def handler(ws): async with await serve(handler, "127.0.0.1", 0) as server: port = server.sockets[0].getsockname()[1] - url = f"ws://127.0.0.1:{port}" dg = AsyncDeepgramClient( api_key="wire-contract-test-key", - environment=DeepgramClientEnvironment( - base=f"http://127.0.0.1:{port}", production=url, agent=url - ), + environment=_local_environment(port), ) try: async with dg.listen.v1.connect(**_params_to_sdk_kwargs(params)): diff --git a/uv.lock b/uv.lock index 53bf89e..47dc80e 100644 --- a/uv.lock +++ b/uv.lock @@ -164,7 +164,7 @@ wheels = [ [[package]] name = "deepgram-sdk" -version = "6.0.1" +version = "7.6.0" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "httpx" }, @@ -173,9 +173,9 @@ dependencies = [ { name = "typing-extensions" }, { name = "websockets" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/73/46/6dc45de574d766a20853452d7beccf17cb0cfeb685a0f03460f1fe49b48e/deepgram_sdk-6.0.1.tar.gz", hash = "sha256:88558a43d6173a861c8b6d6491b9ee8805679fb09fb81ef51eeb6871dad77767", size = 176743, upload-time = "2026-02-24T13:52:17.163Z" } +sdist = { url = "https://files.pythonhosted.org/packages/b4/10/35a13dabd910604da4e47d4f29d45531d5536bf22110ebcc952142cc07e9/deepgram_sdk-7.6.0.tar.gz", hash = "sha256:e35b67e79f3d5e37e2384350ddfec30b5d086f80eaed0e71f9540e0ecec60a11", size = 228515, upload-time = "2026-07-22T13:30:55.999Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/58/a4/53b9075816edc566694aed014d9864febedf232677b74f5d30bdde64b5de/deepgram_sdk-6.0.1-py3-none-any.whl", hash = "sha256:1b33d621b1c0b1d7a6a7b46fdc393aef4212e670521fada99764f5fb3f9d55fd", size = 490751, upload-time = "2026-02-24T13:52:15.998Z" }, + { url = "https://files.pythonhosted.org/packages/2f/4f/c8a5e6aae60f67e1580697936933e94396d0007b22bea45153083995a010/deepgram_sdk-7.6.0-py3-none-any.whl", hash = "sha256:3edcf491168819a516fc45042e31dbc8212a47f48b283b7116248a41dd7fffde", size = 605727, upload-time = "2026-07-22T13:30:54.467Z" }, ] [[package]] @@ -206,7 +206,7 @@ dev = [ [package.metadata] requires-dist = [ - { name = "deepgram-sdk", specifier = "==6.0.1" }, + { name = "deepgram-sdk", specifier = ">=7.6.0,<8" }, { name = "fastapi", specifier = ">=0.115.0,<1" }, { name = "httpx", specifier = ">=0.27.0,<1" }, { name = "mutagen", specifier = ">=1.47.0" },