diff --git a/.release-please-manifest.json b/.release-please-manifest.json index b34aa0b2..507912c5 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.41.2" + ".": "1.42.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 8d224370..459fe737 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 46 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-970ab04a97244c68824c0c52e06925cba14fb7dbfc36c03167c1afe74cd1b150.yml -openapi_spec_hash: 315e7859c3f77311261fb824b74a8247 -config_hash: f2846563903bf75ab0858872154df0f7 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-39e0191e43a9db93c8f35e91d10013f05352a2bedcf7ead6bac437957f6e922e.yml +openapi_spec_hash: 58c2cf578f0736b8c5df957f6a61190b +config_hash: 0892e2e0eeb0343a022afa62e9080dd1 diff --git a/CHANGELOG.md b/CHANGELOG.md index b16a3763..99c96c42 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,26 @@ # Changelog +## 1.42.0 (2025-12-02) + +Full Changelog: [v1.41.2...v1.42.0](https://github.com/Finch-API/finch-api-python/compare/v1.41.2...v1.42.0) + +### Features + +* **api:** api update ([f730687](https://github.com/Finch-API/finch-api-python/commit/f7306871020ec264ad289455f31b942d0251809e)) +* **api:** manual updates ([a00107b](https://github.com/Finch-API/finch-api-python/commit/a00107bb227b9dfa7daa3858fb06063d5b053e68)) + + +### Bug Fixes + +* ensure streams are always closed ([3b90188](https://github.com/Finch-API/finch-api-python/commit/3b90188ae6b7c3029cdd649d96ce4a07418584e2)) +* **java:** Resolve name collisions ([b43172b](https://github.com/Finch-API/finch-api-python/commit/b43172be04510b5a760a1446d3b302e9487cf3ab)) + + +### Chores + +* **deps:** mypy 1.18.1 has a regression, pin to 1.17 ([f37f836](https://github.com/Finch-API/finch-api-python/commit/f37f836bfcafc6eca093e2158eaaf874350f52ee)) +* update lockfile ([2b0384b](https://github.com/Finch-API/finch-api-python/commit/2b0384bce698659f8349abaa89c4c72fecc83b68)) + ## 1.41.2 (2025-11-21) Full Changelog: [v1.41.1...v1.41.2](https://github.com/Finch-API/finch-api-python/compare/v1.41.1...v1.41.2) diff --git a/pyproject.toml b/pyproject.toml index 812de227..e8bc00b1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,20 +1,22 @@ [project] name = "finch-api" -version = "1.41.2" +version = "1.42.0" description = "The official Python library for the Finch API" dynamic = ["readme"] license = "Apache-2.0" authors = [ { name = "Finch", email = "founders@tryfinch.com" }, ] + dependencies = [ - "httpx>=0.23.0, <1", - "pydantic>=1.9.0, <3", - "typing-extensions>=4.10, <5", - "anyio>=3.5.0, <5", - "distro>=1.7.0, <2", - "sniffio", + "httpx>=0.23.0, <1", + "pydantic>=1.9.0, <3", + "typing-extensions>=4.10, <5", + "anyio>=3.5.0, <5", + "distro>=1.7.0, <2", + "sniffio", ] + requires-python = ">= 3.9" classifiers = [ "Typing :: Typed", @@ -46,7 +48,7 @@ managed = true # version pins are in requirements-dev.lock dev-dependencies = [ "pyright==1.1.399", - "mypy", + "mypy==1.17", "respx", "pytest", "pytest-asyncio", diff --git a/requirements-dev.lock b/requirements-dev.lock index 11981681..96c9c174 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -12,40 +12,45 @@ -e file:. aiohappyeyeballs==2.6.1 # via aiohttp -aiohttp==3.12.8 +aiohttp==3.13.2 # via finch-api # via httpx-aiohttp -aiosignal==1.3.2 +aiosignal==1.4.0 # via aiohttp -annotated-types==0.6.0 +annotated-types==0.7.0 # via pydantic -anyio==4.4.0 +anyio==4.12.0 # via finch-api # via httpx -argcomplete==3.1.2 +argcomplete==3.6.3 # via nox async-timeout==5.0.1 # via aiohttp -attrs==25.3.0 +attrs==25.4.0 # via aiohttp -certifi==2023.7.22 + # via nox +backports-asyncio-runner==1.2.0 + # via pytest-asyncio +certifi==2025.11.12 # via httpcore # via httpx -colorlog==6.7.0 +colorlog==6.10.1 + # via nox +dependency-groups==1.3.1 # via nox -dirty-equals==0.6.0 -distlib==0.3.7 +dirty-equals==0.11 +distlib==0.4.0 # via virtualenv -distro==1.8.0 +distro==1.9.0 # via finch-api -exceptiongroup==1.2.2 +exceptiongroup==1.3.1 # via anyio # via pytest -execnet==2.1.1 +execnet==2.1.2 # via pytest-xdist -filelock==3.12.4 +filelock==3.19.1 # via virtualenv -frozenlist==1.6.2 +frozenlist==1.8.0 # via aiohttp # via aiosignal h11==0.16.0 @@ -58,80 +63,87 @@ httpx==0.28.1 # via respx httpx-aiohttp==0.1.9 # via finch-api -idna==3.4 +humanize==4.13.0 + # via nox +idna==3.11 # via anyio # via httpx # via yarl -importlib-metadata==7.0.0 -iniconfig==2.0.0 +importlib-metadata==8.7.0 +iniconfig==2.1.0 # via pytest markdown-it-py==3.0.0 # via rich mdurl==0.1.2 # via markdown-it-py -multidict==6.4.4 +multidict==6.7.0 # via aiohttp # via yarl -mypy==1.14.1 -mypy-extensions==1.0.0 +mypy==1.17.0 +mypy-extensions==1.1.0 # via mypy -nodeenv==1.8.0 +nodeenv==1.9.1 # via pyright -nox==2023.4.22 -packaging==23.2 +nox==2025.11.12 +packaging==25.0 + # via dependency-groups # via nox # via pytest -platformdirs==3.11.0 +pathspec==0.12.1 + # via mypy +platformdirs==4.4.0 # via virtualenv -pluggy==1.5.0 +pluggy==1.6.0 # via pytest -propcache==0.3.1 +propcache==0.4.1 # via aiohttp # via yarl -pydantic==2.11.9 +pydantic==2.12.5 # via finch-api -pydantic-core==2.33.2 +pydantic-core==2.41.5 # via pydantic -pygments==2.18.0 +pygments==2.19.2 + # via pytest # via rich pyright==1.1.399 -pytest==8.3.3 +pytest==8.4.2 # via pytest-asyncio # via pytest-xdist -pytest-asyncio==0.24.0 -pytest-xdist==3.7.0 -python-dateutil==2.8.2 +pytest-asyncio==1.2.0 +pytest-xdist==3.8.0 +python-dateutil==2.9.0.post0 # via time-machine -pytz==2023.3.post1 - # via dirty-equals respx==0.22.0 -rich==13.7.1 -ruff==0.9.4 -setuptools==68.2.2 - # via nodeenv -six==1.16.0 +rich==14.2.0 +ruff==0.14.7 +six==1.17.0 # via python-dateutil -sniffio==1.3.0 - # via anyio +sniffio==1.3.1 # via finch-api -time-machine==2.9.0 -tomli==2.0.2 +time-machine==2.19.0 +tomli==2.3.0 + # via dependency-groups # via mypy + # via nox # via pytest -typing-extensions==4.12.2 +typing-extensions==4.15.0 + # via aiosignal # via anyio + # via exceptiongroup # via finch-api # via multidict # via mypy # via pydantic # via pydantic-core # via pyright + # via pytest-asyncio # via typing-inspection -typing-inspection==0.4.1 + # via virtualenv +typing-inspection==0.4.2 # via pydantic -virtualenv==20.24.5 +virtualenv==20.35.4 # via nox -yarl==1.20.0 +yarl==1.22.0 # via aiohttp -zipp==3.17.0 +zipp==3.23.0 # via importlib-metadata diff --git a/requirements.lock b/requirements.lock index b68ef972..dbf05384 100644 --- a/requirements.lock +++ b/requirements.lock @@ -12,28 +12,28 @@ -e file:. aiohappyeyeballs==2.6.1 # via aiohttp -aiohttp==3.12.8 +aiohttp==3.13.2 # via finch-api # via httpx-aiohttp -aiosignal==1.3.2 +aiosignal==1.4.0 # via aiohttp -annotated-types==0.6.0 +annotated-types==0.7.0 # via pydantic -anyio==4.4.0 +anyio==4.12.0 # via finch-api # via httpx async-timeout==5.0.1 # via aiohttp -attrs==25.3.0 +attrs==25.4.0 # via aiohttp -certifi==2023.7.22 +certifi==2025.11.12 # via httpcore # via httpx -distro==1.8.0 +distro==1.9.0 # via finch-api -exceptiongroup==1.2.2 +exceptiongroup==1.3.1 # via anyio -frozenlist==1.6.2 +frozenlist==1.8.0 # via aiohttp # via aiosignal h11==0.16.0 @@ -45,31 +45,32 @@ httpx==0.28.1 # via httpx-aiohttp httpx-aiohttp==0.1.9 # via finch-api -idna==3.4 +idna==3.11 # via anyio # via httpx # via yarl -multidict==6.4.4 +multidict==6.7.0 # via aiohttp # via yarl -propcache==0.3.1 +propcache==0.4.1 # via aiohttp # via yarl -pydantic==2.11.9 +pydantic==2.12.5 # via finch-api -pydantic-core==2.33.2 +pydantic-core==2.41.5 # via pydantic -sniffio==1.3.0 - # via anyio +sniffio==1.3.1 # via finch-api -typing-extensions==4.12.2 +typing-extensions==4.15.0 + # via aiosignal # via anyio + # via exceptiongroup # via finch-api # via multidict # via pydantic # via pydantic-core # via typing-inspection -typing-inspection==0.4.1 +typing-inspection==0.4.2 # via pydantic -yarl==1.20.0 +yarl==1.22.0 # via aiohttp diff --git a/src/finch/_streaming.py b/src/finch/_streaming.py index 82877ebb..facc5e66 100644 --- a/src/finch/_streaming.py +++ b/src/finch/_streaming.py @@ -54,11 +54,12 @@ def __stream__(self) -> Iterator[_T]: process_data = self._client._process_response_data iterator = self._iter_events() - for sse in iterator: - yield process_data(data=sse.json(), cast_to=cast_to, response=response) - - # As we might not fully consume the response stream, we need to close it explicitly - response.close() + try: + for sse in iterator: + yield process_data(data=sse.json(), cast_to=cast_to, response=response) + finally: + # Ensure the response is closed even if the consumer doesn't read all data + response.close() def __enter__(self) -> Self: return self @@ -117,11 +118,12 @@ async def __stream__(self) -> AsyncIterator[_T]: process_data = self._client._process_response_data iterator = self._iter_events() - async for sse in iterator: - yield process_data(data=sse.json(), cast_to=cast_to, response=response) - - # As we might not fully consume the response stream, we need to close it explicitly - await response.aclose() + try: + async for sse in iterator: + yield process_data(data=sse.json(), cast_to=cast_to, response=response) + finally: + # Ensure the response is closed even if the consumer doesn't read all data + await response.aclose() async def __aenter__(self) -> Self: return self diff --git a/src/finch/_version.py b/src/finch/_version.py index 71049362..1adaf11f 100644 --- a/src/finch/_version.py +++ b/src/finch/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "finch" -__version__ = "1.41.2" # x-release-please-version +__version__ = "1.42.0" # x-release-please-version diff --git a/src/finch/resources/request_forwarding.py b/src/finch/resources/request_forwarding.py index 62e2a25e..dacb93fd 100644 --- a/src/finch/resources/request_forwarding.py +++ b/src/finch/resources/request_forwarding.py @@ -45,8 +45,8 @@ def forward( method: str, route: str, data: Optional[str] | Omit = omit, - headers: Optional[Dict[str, Optional[object]]] | Omit = omit, params: Optional[Dict[str, Optional[object]]] | Omit = omit, + request_headers: Optional[Dict[str, Optional[object]]] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -72,13 +72,13 @@ def forward( data: The body for the forwarded request. This value must be specified as either a string or a valid JSON object. - headers: The HTTP headers to include on the forwarded request. This value must be - specified as an object of key-value pairs. Example: - `{"Content-Type": "application/xml", "X-API-Version": "v1" }` - params: The query parameters for the forwarded request. This value must be specified as a valid JSON object rather than a query string. + request_headers: The HTTP headers to include on the forwarded request. This value must be + specified as an object of key-value pairs. Example: + `{"Content-Type": "application/xml", "X-API-Version": "v1" }` + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -94,8 +94,8 @@ def forward( "method": method, "route": route, "data": data, - "headers": headers, "params": params, + "request_headers": request_headers, }, request_forwarding_forward_params.RequestForwardingForwardParams, ), @@ -132,8 +132,8 @@ async def forward( method: str, route: str, data: Optional[str] | Omit = omit, - headers: Optional[Dict[str, Optional[object]]] | Omit = omit, params: Optional[Dict[str, Optional[object]]] | Omit = omit, + request_headers: Optional[Dict[str, Optional[object]]] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -159,13 +159,13 @@ async def forward( data: The body for the forwarded request. This value must be specified as either a string or a valid JSON object. - headers: The HTTP headers to include on the forwarded request. This value must be - specified as an object of key-value pairs. Example: - `{"Content-Type": "application/xml", "X-API-Version": "v1" }` - params: The query parameters for the forwarded request. This value must be specified as a valid JSON object rather than a query string. + request_headers: The HTTP headers to include on the forwarded request. This value must be + specified as an object of key-value pairs. Example: + `{"Content-Type": "application/xml", "X-API-Version": "v1" }` + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -181,8 +181,8 @@ async def forward( "method": method, "route": route, "data": data, - "headers": headers, "params": params, + "request_headers": request_headers, }, request_forwarding_forward_params.RequestForwardingForwardParams, ), diff --git a/src/finch/types/request_forwarding_forward_params.py b/src/finch/types/request_forwarding_forward_params.py index a7d9f205..9fff24b5 100644 --- a/src/finch/types/request_forwarding_forward_params.py +++ b/src/finch/types/request_forwarding_forward_params.py @@ -28,15 +28,15 @@ class RequestForwardingForwardParams(TypedDict, total=False): This value must be specified as either a string or a valid JSON object. """ - headers: Optional[Dict[str, Optional[object]]] - """The HTTP headers to include on the forwarded request. - - This value must be specified as an object of key-value pairs. Example: - `{"Content-Type": "application/xml", "X-API-Version": "v1" }` - """ - params: Optional[Dict[str, Optional[object]]] """The query parameters for the forwarded request. This value must be specified as a valid JSON object rather than a query string. """ + + request_headers: Optional[Dict[str, Optional[object]]] + """The HTTP headers to include on the forwarded request. + + This value must be specified as an object of key-value pairs. Example: + `{"Content-Type": "application/xml", "X-API-Version": "v1" }` + """ diff --git a/src/finch/types/sandbox/payment_create_params.py b/src/finch/types/sandbox/payment_create_params.py index 1f74fb81..f3fbcd67 100644 --- a/src/finch/types/sandbox/payment_create_params.py +++ b/src/finch/types/sandbox/payment_create_params.py @@ -55,6 +55,7 @@ class PayStatementEmployeeDeduction(TypedDict, total=False): amount: int name: str + """The deduction name. Required when type is specified.""" pre_tax: bool @@ -85,6 +86,7 @@ class PayStatementEmployerContribution(TypedDict, total=False): amount: int name: str + """The contribution name. Required when type is specified.""" type: Literal[ "457", diff --git a/tests/api_resources/test_request_forwarding.py b/tests/api_resources/test_request_forwarding.py index 5615e4d2..5bd28a5f 100644 --- a/tests/api_resources/test_request_forwarding.py +++ b/tests/api_resources/test_request_forwarding.py @@ -31,8 +31,8 @@ def test_method_forward_with_all_params(self, client: Finch) -> None: method="method", route="route", data="data", - headers={"foo": "bar"}, params={"foo": "bar"}, + request_headers={"foo": "bar"}, ) assert_matches_type(RequestForwardingForwardResponse, request_forwarding, path=["response"]) @@ -82,8 +82,8 @@ async def test_method_forward_with_all_params(self, async_client: AsyncFinch) -> method="method", route="route", data="data", - headers={"foo": "bar"}, params={"foo": "bar"}, + request_headers={"foo": "bar"}, ) assert_matches_type(RequestForwardingForwardResponse, request_forwarding, path=["response"])