File anthropic-pr777-httpx-remove-deprecated.patch of Package python-anthropic

diff --git a/src/anthropic/_client.py b/src/anthropic/_client.py
index ac14894..ba40faf 100644
--- a/src/anthropic/_client.py
+++ b/src/anthropic/_client.py
@@ -18,7 +18,6 @@ from ._types import (
     NotGiven,
     Transport,
     ProxiesTypes,
-    AsyncTransport,
     RequestOptions,
 )
 from ._utils import (
@@ -35,11 +34,8 @@ from ._tokenizers import (
 )
 from ._base_client import (
     DEFAULT_MAX_RETRIES,
-    DEFAULT_CONNECTION_LIMITS,
     SyncAPIClient,
     AsyncAPIClient,
-    SyncHttpxClientWrapper,
-    AsyncHttpxClientWrapper,
 )
 
 __all__ = [
@@ -83,12 +79,6 @@ class Anthropic(SyncAPIClient):
         # We provide a `DefaultHttpxClient` class that you can pass to retain the default values we use for `limits`, `timeout` & `follow_redirects`.
         # See the [httpx documentation](https://www.python-httpx.org/api/#client) for more details.
         http_client: httpx.Client | None = None,
-        # See httpx documentation for [custom transports](https://www.python-httpx.org/advanced/#custom-transports)
-        transport: Transport | None = None,
-        # See httpx documentation for [proxies](https://www.python-httpx.org/advanced/#http-proxying)
-        proxies: ProxiesTypes | None = None,
-        # See httpx documentation for [limits](https://www.python-httpx.org/advanced/#pool-limit-configuration)
-        connection_pool_limits: httpx.Limits | None = None,
         # Enable or disable schema validation for data returned by the API.
         # When enabled an error APIResponseValidationError is raised
         # if the API responds with invalid data for the expected schema.
@@ -124,9 +114,6 @@ class Anthropic(SyncAPIClient):
             max_retries=max_retries,
             timeout=timeout,
             http_client=http_client,
-            transport=transport,
-            proxies=proxies,
-            limits=connection_pool_limits,
             custom_headers=default_headers,
             custom_query=default_query,
             _strict_response_validation=_strict_response_validation,
@@ -201,7 +188,6 @@ class Anthropic(SyncAPIClient):
         base_url: str | httpx.URL | None = None,
         timeout: float | Timeout | None | NotGiven = NOT_GIVEN,
         http_client: httpx.Client | None = None,
-        connection_pool_limits: httpx.Limits | None = None,
         max_retries: int | NotGiven = NOT_GIVEN,
         default_headers: Mapping[str, str] | None = None,
         set_default_headers: Mapping[str, str] | None = None,
@@ -230,31 +216,13 @@ class Anthropic(SyncAPIClient):
         elif set_default_query is not None:
             params = set_default_query
 
-        if connection_pool_limits is not None:
-            if http_client is not None:
-                raise ValueError("The 'http_client' argument is mutually exclusive with 'connection_pool_limits'")
-
-            if not isinstance(self._client, SyncHttpxClientWrapper):
-                raise ValueError(
-                    "A custom HTTP client has been set and is mutually exclusive with the 'connection_pool_limits' argument"
-                )
-
-            http_client = None
-        else:
-            if self._limits is not DEFAULT_CONNECTION_LIMITS:
-                connection_pool_limits = self._limits
-            else:
-                connection_pool_limits = None
-
-            http_client = http_client or self._client
-
+        http_client = http_client or self._client
         return self.__class__(
             api_key=api_key or self.api_key,
             auth_token=auth_token or self.auth_token,
             base_url=base_url or self.base_url,
             timeout=self.timeout if isinstance(timeout, NotGiven) else timeout,
             http_client=http_client,
-            connection_pool_limits=connection_pool_limits,
             max_retries=max_retries if is_given(max_retries) else self.max_retries,
             default_headers=headers,
             default_query=params,
@@ -345,12 +313,6 @@ class AsyncAnthropic(AsyncAPIClient):
         # We provide a `DefaultAsyncHttpxClient` class that you can pass to retain the default values we use for `limits`, `timeout` & `follow_redirects`.
         # See the [httpx documentation](https://www.python-httpx.org/api/#asyncclient) for more details.
         http_client: httpx.AsyncClient | None = None,
-        # See httpx documentation for [custom transports](https://www.python-httpx.org/advanced/#custom-transports)
-        transport: AsyncTransport | None = None,
-        # See httpx documentation for [proxies](https://www.python-httpx.org/advanced/#http-proxying)
-        proxies: ProxiesTypes | None = None,
-        # See httpx documentation for [limits](https://www.python-httpx.org/advanced/#pool-limit-configuration)
-        connection_pool_limits: httpx.Limits | None = None,
         # Enable or disable schema validation for data returned by the API.
         # When enabled an error APIResponseValidationError is raised
         # if the API responds with invalid data for the expected schema.
@@ -386,9 +348,6 @@ class AsyncAnthropic(AsyncAPIClient):
             max_retries=max_retries,
             timeout=timeout,
             http_client=http_client,
-            transport=transport,
-            proxies=proxies,
-            limits=connection_pool_limits,
             custom_headers=default_headers,
             custom_query=default_query,
             _strict_response_validation=_strict_response_validation,
@@ -463,7 +422,6 @@ class AsyncAnthropic(AsyncAPIClient):
         base_url: str | httpx.URL | None = None,
         timeout: float | Timeout | None | NotGiven = NOT_GIVEN,
         http_client: httpx.AsyncClient | None = None,
-        connection_pool_limits: httpx.Limits | None = None,
         max_retries: int | NotGiven = NOT_GIVEN,
         default_headers: Mapping[str, str] | None = None,
         set_default_headers: Mapping[str, str] | None = None,
@@ -492,31 +450,13 @@ class AsyncAnthropic(AsyncAPIClient):
         elif set_default_query is not None:
             params = set_default_query
 
-        if connection_pool_limits is not None:
-            if http_client is not None:
-                raise ValueError("The 'http_client' argument is mutually exclusive with 'connection_pool_limits'")
-
-            if not isinstance(self._client, AsyncHttpxClientWrapper):
-                raise ValueError(
-                    "A custom HTTP client has been set and is mutually exclusive with the 'connection_pool_limits' argument"
-                )
-
-            http_client = None
-        else:
-            if self._limits is not DEFAULT_CONNECTION_LIMITS:
-                connection_pool_limits = self._limits
-            else:
-                connection_pool_limits = None
-
-            http_client = http_client or self._client
-
+        http_client = http_client or self._client
         return self.__class__(
             api_key=api_key or self.api_key,
             auth_token=auth_token or self.auth_token,
             base_url=base_url or self.base_url,
             timeout=self.timeout if isinstance(timeout, NotGiven) else timeout,
             http_client=http_client,
-            connection_pool_limits=connection_pool_limits,
             max_retries=max_retries if is_given(max_retries) else self.max_retries,
             default_headers=headers,
             default_query=params,
diff --git a/tests/test_client.py b/tests/test_client.py
index ee145a3..4c36acd 100644
--- a/tests/test_client.py
+++ b/tests/test_client.py
@@ -631,99 +631,6 @@ class TestAnthropic:
         )
         assert request.url == "https://myapi.com/foo"
 
-    def test_transport_option_is_deprecated(self) -> None:
-        with pytest.warns(
-            DeprecationWarning,
-            match="The `transport` argument is deprecated. The `http_client` argument should be passed instead",
-        ):
-            transport = httpx.MockTransport(
-                lambda: None,  # type: ignore
-            )
-
-            client = Anthropic(
-                base_url=base_url, api_key=api_key, _strict_response_validation=True, transport=transport
-            )
-
-            assert client._client._transport is transport
-
-    def test_transport_option_mutually_exclusive_with_http_client(self) -> None:
-        with httpx.Client() as http_client:
-            with pytest.raises(ValueError, match="The `http_client` argument is mutually exclusive with `transport`"):
-                with pytest.warns(DeprecationWarning):
-                    Anthropic(
-                        base_url=base_url,
-                        api_key=api_key,
-                        _strict_response_validation=True,
-                        transport=httpx.MockTransport(
-                            lambda: None,  # type: ignore
-                        ),
-                        http_client=http_client,
-                    )
-
-    def test_connection_pool_limits_option_is_deprecated(self) -> None:
-        with pytest.warns(
-            DeprecationWarning,
-            match="The `connection_pool_limits` argument is deprecated. The `http_client` argument should be passed instead",
-        ):
-            connection_pool_limits = httpx.Limits(
-                max_connections=101, max_keepalive_connections=76, keepalive_expiry=23
-            )
-
-            client = Anthropic(
-                base_url=base_url,
-                api_key=api_key,
-                _strict_response_validation=True,
-                connection_pool_limits=connection_pool_limits,
-            )
-
-            assert isinstance(client._client._transport, httpx.HTTPTransport)
-            assert client._client._transport._pool._max_connections == 101
-            assert client._client._transport._pool._max_keepalive_connections == 76
-            assert client._client._transport._pool._keepalive_expiry == 23
-
-    def test_connection_pool_limits_option_mutually_exclusive_with_http_client(self) -> None:
-        with httpx.Client() as http_client:
-            with pytest.raises(
-                ValueError, match="The `http_client` argument is mutually exclusive with `connection_pool_limits`"
-            ):
-                with pytest.warns(DeprecationWarning):
-                    Anthropic(
-                        base_url=base_url,
-                        api_key=api_key,
-                        _strict_response_validation=True,
-                        connection_pool_limits=httpx.Limits(
-                            max_connections=101, max_keepalive_connections=76, keepalive_expiry=23
-                        ),
-                        http_client=http_client,
-                    )
-
-    def test_proxies_option_is_deprecated(self) -> None:
-        with pytest.warns(
-            DeprecationWarning,
-            match="The `proxies` argument is deprecated. The `http_client` argument should be passed instead",
-        ):
-            proxies = "https://www.example.com/proxy"
-
-            client = Anthropic(base_url=base_url, api_key=api_key, _strict_response_validation=True, proxies=proxies)
-
-            mounts = list(client._client._mounts.keys())
-            assert len(mounts) == 1
-
-            pattern = mounts[0].pattern
-            assert pattern == "all://"
-
-    def test_proxies_option_mutually_exclusive_with_http_client(self) -> None:
-        with httpx.Client() as http_client:
-            with pytest.raises(ValueError, match="The `http_client` argument is mutually exclusive with `proxies`"):
-                with pytest.warns(DeprecationWarning):
-                    Anthropic(
-                        base_url=base_url,
-                        api_key=api_key,
-                        _strict_response_validation=True,
-                        proxies="https://www.example.com/proxy",
-                        http_client=http_client,
-                    )
-
     def test_copied_client_does_not_close_http(self) -> None:
         client = Anthropic(base_url=base_url, api_key=api_key, _strict_response_validation=True)
         assert not client.is_closed()
@@ -1519,101 +1426,6 @@ class TestAsyncAnthropic:
         )
         assert request.url == "https://myapi.com/foo"
 
-    def test_transport_option_is_deprecated(self) -> None:
-        with pytest.warns(
-            DeprecationWarning,
-            match="The `transport` argument is deprecated. The `http_client` argument should be passed instead",
-        ):
-            transport = httpx.MockTransport(
-                lambda: None,  # type: ignore
-            )
-
-            client = AsyncAnthropic(
-                base_url=base_url, api_key=api_key, _strict_response_validation=True, transport=transport
-            )
-
-            assert client._client._transport is transport
-
-    async def test_transport_option_mutually_exclusive_with_http_client(self) -> None:
-        async with httpx.AsyncClient() as http_client:
-            with pytest.raises(ValueError, match="The `http_client` argument is mutually exclusive with `transport`"):
-                with pytest.warns(DeprecationWarning):
-                    AsyncAnthropic(
-                        base_url=base_url,
-                        api_key=api_key,
-                        _strict_response_validation=True,
-                        transport=httpx.MockTransport(
-                            lambda: None,  # type: ignore
-                        ),
-                        http_client=http_client,
-                    )
-
-    def test_connection_pool_limits_option_is_deprecated(self) -> None:
-        with pytest.warns(
-            DeprecationWarning,
-            match="The `connection_pool_limits` argument is deprecated. The `http_client` argument should be passed instead",
-        ):
-            connection_pool_limits = httpx.Limits(
-                max_connections=101, max_keepalive_connections=76, keepalive_expiry=23
-            )
-
-            client = AsyncAnthropic(
-                base_url=base_url,
-                api_key=api_key,
-                _strict_response_validation=True,
-                connection_pool_limits=connection_pool_limits,
-            )
-
-            assert isinstance(client._client._transport, httpx.AsyncHTTPTransport)
-            assert client._client._transport._pool._max_connections == 101
-            assert client._client._transport._pool._max_keepalive_connections == 76
-            assert client._client._transport._pool._keepalive_expiry == 23
-
-    async def test_connection_pool_limits_option_mutually_exclusive_with_http_client(self) -> None:
-        async with httpx.AsyncClient() as http_client:
-            with pytest.raises(
-                ValueError, match="The `http_client` argument is mutually exclusive with `connection_pool_limits`"
-            ):
-                with pytest.warns(DeprecationWarning):
-                    AsyncAnthropic(
-                        base_url=base_url,
-                        api_key=api_key,
-                        _strict_response_validation=True,
-                        connection_pool_limits=httpx.Limits(
-                            max_connections=101, max_keepalive_connections=76, keepalive_expiry=23
-                        ),
-                        http_client=http_client,
-                    )
-
-    def test_proxies_option_is_deprecated(self) -> None:
-        with pytest.warns(
-            DeprecationWarning,
-            match="The `proxies` argument is deprecated. The `http_client` argument should be passed instead",
-        ):
-            proxies = "https://www.example.com/proxy"
-
-            client = AsyncAnthropic(
-                base_url=base_url, api_key=api_key, _strict_response_validation=True, proxies=proxies
-            )
-
-            mounts = list(client._client._mounts.keys())
-            assert len(mounts) == 1
-
-            pattern = mounts[0].pattern
-            assert pattern == "all://"
-
-    async def test_proxies_option_mutually_exclusive_with_http_client(self) -> None:
-        async with httpx.AsyncClient() as http_client:
-            with pytest.raises(ValueError, match="The `http_client` argument is mutually exclusive with `proxies`"):
-                with pytest.warns(DeprecationWarning):
-                    AsyncAnthropic(
-                        base_url=base_url,
-                        api_key=api_key,
-                        _strict_response_validation=True,
-                        proxies="https://www.example.com/proxy",
-                        http_client=http_client,
-                    )
-
     async def test_copied_client_does_not_close_http(self) -> None:
         client = AsyncAnthropic(base_url=base_url, api_key=api_key, _strict_response_validation=True)
         assert not client.is_closed()
openSUSE Build Service is sponsored by