Skip to content

Commit

Permalink
chore(package): lift anyio v4 restriction (#266)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-bot authored Dec 4, 2023
1 parent 29d0c8b commit a217e99
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 29 deletions.
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ dependencies = [
"httpx>=0.23.0, <1",
"pydantic>=1.9.0, <3",
"typing-extensions>=4.5, <5",
"anyio>=3.5.0, <4",
"anyio>=3.5.0, <5",
"distro>=1.7.0, <2",
"sniffio",
"tokenizers >= 0.13.0"
Expand Down Expand Up @@ -49,7 +49,7 @@ dev-dependencies = [
"pyright==1.1.332",
"mypy==1.7.1",
"black==23.3.0",
"respx==0.19.2",
"respx==0.20.2",
"pytest==7.1.1",
"pytest-asyncio==0.21.1",
"ruff==0.0.282",
Expand Down
13 changes: 6 additions & 7 deletions requirements-dev.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

-e file:.
annotated-types==0.6.0
anyio==3.7.1
anyio==4.1.0
argcomplete==3.1.2
attrs==23.1.0
black==23.3.0
Expand All @@ -21,10 +21,10 @@ distlib==0.3.7
distro==1.8.0
exceptiongroup==1.1.3
filelock==3.12.4
fsspec==2023.10.0
h11==0.12.0
httpcore==0.15.0
httpx==0.23.0
fsspec==2023.12.0
h11==0.14.0
httpcore==1.0.2
httpx==0.25.2
huggingface-hub==0.16.4
idna==3.4
iniconfig==2.0.0
Expand All @@ -47,8 +47,7 @@ python-dateutil==2.8.2
pytz==2023.3.post1
pyyaml==6.0.1
requests==2.31.0
respx==0.19.2
rfc3986==1.5.0
respx==0.20.2
ruff==0.0.282
six==1.16.0
sniffio==1.3.0
Expand Down
17 changes: 8 additions & 9 deletions requirements.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,25 @@

-e file:.
annotated-types==0.6.0
anyio==3.7.1
anyio==4.1.0
certifi==2023.7.22
charset-normalizer==3.3.0
charset-normalizer==3.3.2
distro==1.8.0
exceptiongroup==1.1.3
filelock==3.12.4
fsspec==2023.9.2
h11==0.12.0
httpcore==0.15.0
httpx==0.23.0
filelock==3.13.1
fsspec==2023.12.0
h11==0.14.0
httpcore==1.0.2
httpx==0.25.2
huggingface-hub==0.16.4
idna==3.4
packaging==23.2
pydantic==2.4.2
pydantic-core==2.10.1
pyyaml==6.0.1
requests==2.31.0
rfc3986==1.5.0
sniffio==1.3.0
tokenizers==0.14.0
tqdm==4.66.1
typing-extensions==4.8.0
urllib3==2.0.7
urllib3==2.1.0
30 changes: 19 additions & 11 deletions tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import json
import asyncio
import inspect
from typing import Any, Dict, Union, cast
from typing import Any, Union, cast
from unittest import mock

import httpx
Expand Down Expand Up @@ -366,7 +366,7 @@ def test_request_extra_query(self) -> None:
),
),
)
params = cast(Dict[str, str], dict(request.url.params))
params = dict(request.url.params)
assert params == {"my_query_param": "Foo"}

# if both `query` and `extra_query` are given, they are merged
Expand All @@ -380,7 +380,7 @@ def test_request_extra_query(self) -> None:
),
),
)
params = cast(Dict[str, str], dict(request.url.params))
params = dict(request.url.params)
assert params == {"bar": "1", "foo": "2"}

# `extra_query` takes priority over `query` when keys clash
Expand All @@ -394,7 +394,7 @@ def test_request_extra_query(self) -> None:
),
),
)
params = cast(Dict[str, str], dict(request.url.params))
params = dict(request.url.params)
assert params == {"foo": "2"}

@pytest.mark.respx(base_url=base_url)
Expand Down Expand Up @@ -541,7 +541,9 @@ def test_transport_option_is_deprecated(self) -> None:
DeprecationWarning,
match="The `transport` argument is deprecated. The `http_client` argument should be passed instead",
):
transport = httpx.MockTransport(lambda: None)
transport = httpx.MockTransport(
lambda: None, # type: ignore
)

client = Anthropic(
base_url=base_url, api_key=api_key, _strict_response_validation=True, transport=transport
Expand All @@ -557,7 +559,9 @@ def test_transport_option_mutually_exclusive_with_http_client(self) -> None:
base_url=base_url,
api_key=api_key,
_strict_response_validation=True,
transport=httpx.MockTransport(lambda: None),
transport=httpx.MockTransport(
lambda: None, # type: ignore
),
http_client=http_client,
)

Expand Down Expand Up @@ -1114,7 +1118,7 @@ def test_request_extra_query(self) -> None:
),
),
)
params = cast(Dict[str, str], dict(request.url.params))
params = dict(request.url.params)
assert params == {"my_query_param": "Foo"}

# if both `query` and `extra_query` are given, they are merged
Expand All @@ -1128,7 +1132,7 @@ def test_request_extra_query(self) -> None:
),
),
)
params = cast(Dict[str, str], dict(request.url.params))
params = dict(request.url.params)
assert params == {"bar": "1", "foo": "2"}

# `extra_query` takes priority over `query` when keys clash
Expand All @@ -1142,7 +1146,7 @@ def test_request_extra_query(self) -> None:
),
),
)
params = cast(Dict[str, str], dict(request.url.params))
params = dict(request.url.params)
assert params == {"foo": "2"}

@pytest.mark.respx(base_url=base_url)
Expand Down Expand Up @@ -1297,7 +1301,9 @@ def test_transport_option_is_deprecated(self) -> None:
DeprecationWarning,
match="The `transport` argument is deprecated. The `http_client` argument should be passed instead",
):
transport = httpx.MockTransport(lambda: None)
transport = httpx.MockTransport(
lambda: None, # type: ignore
)

client = AsyncAnthropic(
base_url=base_url, api_key=api_key, _strict_response_validation=True, transport=transport
Expand All @@ -1313,7 +1319,9 @@ async def test_transport_option_mutually_exclusive_with_http_client(self) -> Non
base_url=base_url,
api_key=api_key,
_strict_response_validation=True,
transport=httpx.MockTransport(lambda: None),
transport=httpx.MockTransport(
lambda: None, # type: ignore
),
http_client=http_client,
)

Expand Down

0 comments on commit a217e99

Please sign in to comment.