Skip to content

Commit 4e18676

Browse files
committed
fix(sdk): remove incorrect remove_tunnel DeprecationWarning
1 parent 1ddf564 commit 4e18676

4 files changed

Lines changed: 24 additions & 40 deletions

File tree

src/runloop_api_client/sdk/async_devbox.py

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import asyncio
66
import logging
7-
import warnings
7+
88
from typing import TYPE_CHECKING, Any, Callable, Optional, Sequence, Awaitable, cast
99
from typing_extensions import Unpack, override
1010

@@ -835,7 +835,7 @@ async def remove_tunnel(
835835
self,
836836
**params: Unpack[SDKDevboxRemoveTunnelParams],
837837
) -> object:
838-
"""[Deprecated] V2 tunnels cannot be removed and close on devbox shutdown.
838+
"""Remove a tunnel from the devbox.
839839
840840
:param params: See :typeddict:`~runloop_api_client.sdk._types.SDKDevboxRemoveTunnelParams` for available parameters
841841
:return: Response confirming the tunnel removal
@@ -844,14 +844,7 @@ async def remove_tunnel(
844844
Example:
845845
>>> await devbox.net.remove_tunnel()
846846
"""
847-
warnings.warn(
848-
"remove_tunnel is deprecated; V2 tunnels cannot be removed and close on devbox shutdown.",
849-
DeprecationWarning,
850-
stacklevel=2,
847+
return await self._devbox._client.devboxes.remove_tunnel(
848+
self._devbox.id,
849+
**params,
851850
)
852-
with warnings.catch_warnings():
853-
warnings.simplefilter("ignore", DeprecationWarning)
854-
return await self._devbox._client.devboxes.remove_tunnel( # type: ignore[deprecated]
855-
self._devbox.id,
856-
**params,
857-
)

src/runloop_api_client/sdk/devbox.py

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from __future__ import annotations
44

55
import logging
6-
import warnings
6+
77
import threading
88
from typing import TYPE_CHECKING, Any, Callable, Optional, Sequence
99
from typing_extensions import Unpack, override
@@ -838,7 +838,7 @@ def remove_tunnel(
838838
self,
839839
**params: Unpack[SDKDevboxRemoveTunnelParams],
840840
) -> object:
841-
"""[Deprecated] V2 tunnels cannot be removed and close on devbox shutdown.
841+
"""Remove a tunnel from the devbox.
842842
843843
:param params: See :typeddict:`~runloop_api_client.sdk._types.SDKDevboxRemoveTunnelParams` for available parameters
844844
:return: Response confirming the tunnel removal
@@ -847,14 +847,7 @@ def remove_tunnel(
847847
Example:
848848
>>> devbox.net.remove_tunnel()
849849
"""
850-
warnings.warn(
851-
"remove_tunnel is deprecated; V2 tunnels cannot be removed and close on devbox shutdown.",
852-
DeprecationWarning,
853-
stacklevel=2,
850+
return self._devbox._client.devboxes.remove_tunnel(
851+
self._devbox.id,
852+
**params,
854853
)
855-
with warnings.catch_warnings():
856-
warnings.simplefilter("ignore", DeprecationWarning)
857-
return self._devbox._client.devboxes.remove_tunnel( # type: ignore[deprecated]
858-
self._devbox.id,
859-
**params,
860-
)

tests/sdk/async_devbox/test_interfaces.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -184,14 +184,13 @@ async def test_remove_tunnel(self, mock_async_client: AsyncMock) -> None:
184184
mock_async_client.devboxes.remove_tunnel = AsyncMock(return_value=object())
185185

186186
devbox = AsyncDevbox(mock_async_client, "dbx_123")
187-
with pytest.warns(DeprecationWarning, match="remove_tunnel is deprecated"):
188-
result = await devbox.net.remove_tunnel(
189-
extra_headers={"X-Custom": "value"},
190-
extra_query={"param": "value"},
191-
extra_body={"key": "value"},
192-
timeout=30.0,
193-
idempotency_key="key-123",
194-
)
187+
result = await devbox.net.remove_tunnel(
188+
extra_headers={"X-Custom": "value"},
189+
extra_query={"param": "value"},
190+
extra_body={"key": "value"},
191+
timeout=30.0,
192+
idempotency_key="key-123",
193+
)
195194

196195
assert result is not None # Verify return value is propagated
197196
mock_async_client.devboxes.remove_tunnel.assert_called_once()

tests/sdk/devbox/test_interfaces.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -285,14 +285,13 @@ def test_remove_tunnel(self, mock_client: Mock) -> None:
285285
mock_client.devboxes.remove_tunnel.return_value = object()
286286

287287
devbox = Devbox(mock_client, "dbx_123")
288-
with pytest.warns(DeprecationWarning, match="remove_tunnel is deprecated"):
289-
result = devbox.net.remove_tunnel(
290-
extra_headers={"X-Custom": "value"},
291-
extra_query={"param": "value"},
292-
extra_body={"key": "value"},
293-
timeout=30.0,
294-
idempotency_key="key-123",
295-
)
288+
result = devbox.net.remove_tunnel(
289+
extra_headers={"X-Custom": "value"},
290+
extra_query={"param": "value"},
291+
extra_body={"key": "value"},
292+
timeout=30.0,
293+
idempotency_key="key-123",
294+
)
296295

297296
assert result is not None # Verify return value is propagated
298297
mock_client.devboxes.remove_tunnel.assert_called_once_with(

0 commit comments

Comments
 (0)