Skip to content

Commit 50ee18c

Browse files
authored
Merge pull request #1474 from weaviate/update_httpx
Enable new httpx versions
2 parents 1efb556 + 210b510 commit 50ee18c

File tree

5 files changed

+11
-23
lines changed

5 files changed

+11
-23
lines changed

requirements-devel.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
httpx==0.25.2
1+
httpx==0.26.0
22
validators==0.34.0
33
authlib==1.3.1
44
grpcio==1.66.2

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ packages =
2929
platforms = any
3030
include_package_data = True
3131
install_requires =
32-
httpx>=0.25.0,<=0.27.0
32+
httpx>=0.26.0,<0.29.0
3333
validators==0.34.0
3434
authlib>=1.2.1,<1.3.2
3535
pydantic>=2.8.0,<3.0.0

weaviate/connect/authentication_async.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from ..warnings import _Warnings
1818

1919
if TYPE_CHECKING:
20-
from .base import _ConnectionBase
20+
from . import ConnectionV4
2121

2222
AUTH_DEFAULT_TIMEOUT = 5
2323
OIDC_CONFIG = Dict[str, Union[str, List[str]]]
@@ -28,7 +28,7 @@ def __init__(
2828
self,
2929
oidc_config: OIDC_CONFIG,
3030
credentials: AuthCredentials,
31-
connection: _ConnectionBase,
31+
connection: ConnectionV4,
3232
) -> None:
3333
self._credentials: AuthCredentials = credentials
3434
self._connection = connection
@@ -48,7 +48,7 @@ def __init__(
4848

4949
@classmethod
5050
async def use(
51-
cls, oidc_config: OIDC_CONFIG, credentials: AuthCredentials, connection: _ConnectionBase
51+
cls, oidc_config: OIDC_CONFIG, credentials: AuthCredentials, connection: ConnectionV4
5252
) -> _Auth:
5353
auth = cls(oidc_config, credentials, connection)
5454
auth._token_endpoint = await auth._get_token_endpoint()
@@ -76,7 +76,7 @@ async def _validate(self, oidc_config: OIDC_CONFIG) -> None:
7676
async def _get_token_endpoint(self) -> str:
7777
if self._token_endpoint is not None:
7878
return self._token_endpoint
79-
async with httpx.AsyncClient(proxies=self._connection.get_proxies()) as client:
79+
async with httpx.AsyncClient(mounts=self._connection._make_mounts()) as client:
8080
response_auth = await client.get(self._open_id_config_url)
8181
response_auth_json = _decode_json_response_dict(response_auth, "Get token endpoint")
8282
assert response_auth_json is not None

weaviate/connect/base.py

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import datetime
22
import os
33
import time
4-
from abc import ABC, abstractmethod
54
from typing import Any, Dict, Mapping, Sequence, Tuple, TypeVar, Union, cast, Optional
65
from urllib.parse import urlparse
76

@@ -139,17 +138,7 @@ def _http_url(self) -> str:
139138
return f"{self._http_scheme}://{self.http.host}:{self.http.port}"
140139

141140

142-
class _ConnectionBase(ABC):
143-
@abstractmethod
144-
def get_current_bearer_token(self) -> str:
145-
raise NotImplementedError
146-
147-
@abstractmethod
148-
def get_proxies(self) -> dict:
149-
raise NotImplementedError
150-
151-
152-
def _get_proxies(proxies: Union[dict, str, Proxies, None], trust_env: bool) -> dict:
141+
def _get_proxies(proxies: Union[dict, str, Proxies, None], trust_env: bool) -> Dict[str, str]:
153142
"""
154143
Get proxies as dict, compatible with 'requests' library.
155144
NOTE: 'proxies' has priority over 'trust_env', i.e. if 'proxies' is NOT None, 'trust_env'

weaviate/connect/v4.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444
from weaviate.connect.base import (
4545
ConnectionParams,
4646
JSONPayload,
47-
_ConnectionBase,
4847
_get_proxies,
4948
)
5049
from weaviate.connect.integrations import _IntegrationConfig
@@ -87,7 +86,7 @@ def __post_init__(self) -> None:
8786
self.ok = self.ok_in
8887

8988

90-
class ConnectionV4(_ConnectionBase):
89+
class ConnectionV4:
9190
"""
9291
Connection class used to communicate to a weaviate instance.
9392
"""
@@ -217,7 +216,7 @@ def set_integrations(self, integrations_config: List[_IntegrationConfig]) -> Non
217216
self._headers.update(integration._to_header())
218217
self.__additional_headers.update(integration._to_header())
219218

220-
def __make_mounts(self) -> Dict[str, AsyncHTTPTransport]:
219+
def _make_mounts(self) -> Dict[str, AsyncHTTPTransport]:
221220
return {
222221
f"{key}://" if key == "http" or key == "https" else key: AsyncHTTPTransport(
223222
limits=Limits(
@@ -235,7 +234,7 @@ def __make_mounts(self) -> Dict[str, AsyncHTTPTransport]:
235234
def __make_async_client(self) -> AsyncClient:
236235
return AsyncClient(
237236
headers=self._headers,
238-
mounts=self.__make_mounts(),
237+
mounts=self._make_mounts(),
239238
trust_env=self.__trust_env,
240239
)
241240

@@ -596,7 +595,7 @@ def server_version(self) -> str:
596595
"""
597596
return str(self._weaviate_version)
598597

599-
def get_proxies(self) -> dict:
598+
def get_proxies(self) -> Dict[str, str]:
600599
return self._proxies
601600

602601
@property

0 commit comments

Comments
 (0)