Skip to content

release: 1.13.3 #573

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "1.13.2"
".": "1.13.3"
}
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,26 @@
# Changelog

## 1.13.3 (2025-01-21)

Full Changelog: [v1.13.2...v1.13.3](https://github.com/Finch-API/finch-api-python/compare/v1.13.2...v1.13.3)

### Bug Fixes

* **tests:** make test_get_platform less flaky ([#576](https://github.com/Finch-API/finch-api-python/issues/576)) ([6b6b36c](https://github.com/Finch-API/finch-api-python/commit/6b6b36cf740f3d403b8f874f9d6b6b56c9942fe4))


### Chores

* **internal:** avoid pytest-asyncio deprecation warning ([#577](https://github.com/Finch-API/finch-api-python/issues/577)) ([54f644a](https://github.com/Finch-API/finch-api-python/commit/54f644aacd018a5bbc7a76e530f4fe5ceec8d874))
* **internal:** bump pyright dependency ([#574](https://github.com/Finch-API/finch-api-python/issues/574)) ([24ccfc8](https://github.com/Finch-API/finch-api-python/commit/24ccfc8732a8c6e9819b37a9d30651fe1ab565fd))
* **internal:** minor style changes ([#578](https://github.com/Finch-API/finch-api-python/issues/578)) ([ed9a105](https://github.com/Finch-API/finch-api-python/commit/ed9a105b2ac4ee283a191fdecf26105ed4aa62ad))
* **internal:** update deps ([#572](https://github.com/Finch-API/finch-api-python/issues/572)) ([40c663f](https://github.com/Finch-API/finch-api-python/commit/40c663f4be579ea1451ae489055e9d1b381f33d6))


### Documentation

* **raw responses:** fix duplicate `the` ([#575](https://github.com/Finch-API/finch-api-python/issues/575)) ([ae1b97a](https://github.com/Finch-API/finch-api-python/commit/ae1b97a538f2eb075a8ff1f38ab8ab2e9ec0e2b6))

## 1.13.2 (2025-01-10)

Full Changelog: [v1.13.1...v1.13.2](https://github.com/Finch-API/finch-api-python/compare/v1.13.1...v1.13.2)
Expand Down
2 changes: 1 addition & 1 deletion mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ cache_fine_grained = True
# ```
# Changing this codegen to make mypy happy would increase complexity
# and would not be worth it.
disable_error_code = func-returns-value
disable_error_code = func-returns-value,overload-cannot-match

# https://github.com/python/mypy/issues/12162
[mypy.overrides]
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "finch-api"
version = "1.13.2"
version = "1.13.3"
description = "The official Python library for the Finch API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down Expand Up @@ -129,6 +129,7 @@ testpaths = ["tests"]
addopts = "--tb=short"
xfail_strict = true
asyncio_mode = "auto"
asyncio_default_fixture_loop_scope = "session"
filterwarnings = [
"error"
]
Expand Down
4 changes: 2 additions & 2 deletions requirements-dev.lock
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ markdown-it-py==3.0.0
# via rich
mdurl==0.1.2
# via markdown-it-py
mypy==1.13.0
mypy==1.14.1
mypy-extensions==1.0.0
# via mypy
nest-asyncio==1.6.0
Expand All @@ -68,7 +68,7 @@ pydantic-core==2.27.1
# via pydantic
pygments==2.18.0
# via rich
pyright==1.1.390
pyright==1.1.392.post0
pytest==8.3.3
# via pytest-asyncio
pytest-asyncio==0.24.0
Expand Down
16 changes: 12 additions & 4 deletions src/finch/_legacy_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,8 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T:
if cast_to and is_annotated_type(cast_to):
cast_to = extract_type_arg(cast_to, 0)

origin = get_origin(cast_to) or cast_to

if self._stream:
if to:
if not is_stream_class_type(to):
Expand Down Expand Up @@ -254,15 +256,15 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T:
if cast_to == bool:
return cast(R, response.text.lower() == "true")

origin = get_origin(cast_to) or cast_to

if inspect.isclass(origin) and issubclass(origin, HttpxBinaryResponseContent):
return cast(R, cast_to(response)) # type: ignore

if origin == LegacyAPIResponse:
raise RuntimeError("Unexpected state - cast_to is `APIResponse`")

if inspect.isclass(origin) and issubclass(origin, httpx.Response):
if inspect.isclass(
origin # pyright: ignore[reportUnknownArgumentType]
) and issubclass(origin, httpx.Response):
# Because of the invariance of our ResponseT TypeVar, users can subclass httpx.Response
# and pass that class to our request functions. We cannot change the variance to be either
# covariant or contravariant as that makes our usage of ResponseT illegal. We could construct
Expand All @@ -272,7 +274,13 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T:
raise ValueError(f"Subclasses of httpx.Response cannot be passed to `cast_to`")
return cast(R, response)

if inspect.isclass(origin) and not issubclass(origin, BaseModel) and issubclass(origin, pydantic.BaseModel):
if (
inspect.isclass(
origin # pyright: ignore[reportUnknownArgumentType]
)
and not issubclass(origin, BaseModel)
and issubclass(origin, pydantic.BaseModel)
):
raise TypeError("Pydantic models must subclass our base model type, e.g. `from finch import BaseModel`")

if (
Expand Down
12 changes: 9 additions & 3 deletions src/finch/_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T:
if cast_to and is_annotated_type(cast_to):
cast_to = extract_type_arg(cast_to, 0)

origin = get_origin(cast_to) or cast_to

if self._is_sse_stream:
if to:
if not is_stream_class_type(to):
Expand Down Expand Up @@ -195,8 +197,6 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T:
if cast_to == bool:
return cast(R, response.text.lower() == "true")

origin = get_origin(cast_to) or cast_to

# handle the legacy binary response case
if inspect.isclass(cast_to) and cast_to.__name__ == "HttpxBinaryResponseContent":
return cast(R, cast_to(response)) # type: ignore
Expand All @@ -214,7 +214,13 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T:
raise ValueError(f"Subclasses of httpx.Response cannot be passed to `cast_to`")
return cast(R, response)

if inspect.isclass(origin) and not issubclass(origin, BaseModel) and issubclass(origin, pydantic.BaseModel):
if (
inspect.isclass(
origin # pyright: ignore[reportUnknownArgumentType]
)
and not issubclass(origin, BaseModel)
and issubclass(origin, pydantic.BaseModel)
):
raise TypeError("Pydantic models must subclass our base model type, e.g. `from finch import BaseModel`")

if (
Expand Down
2 changes: 1 addition & 1 deletion src/finch/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

__title__ = "finch"
__version__ = "1.13.2" # x-release-please-version
__version__ = "1.13.3" # x-release-please-version
4 changes: 2 additions & 2 deletions src/finch/resources/access_tokens.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class AccessTokens(SyncAPIResource):
@cached_property
def with_raw_response(self) -> AccessTokensWithRawResponse:
"""
This property can be used as a prefix for any HTTP method call to return the
This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.

For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers
Expand Down Expand Up @@ -99,7 +99,7 @@ class AsyncAccessTokens(AsyncAPIResource):
@cached_property
def with_raw_response(self) -> AsyncAccessTokensWithRawResponse:
"""
This property can be used as a prefix for any HTTP method call to return the
This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.

For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers
Expand Down
4 changes: 2 additions & 2 deletions src/finch/resources/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class Account(SyncAPIResource):
@cached_property
def with_raw_response(self) -> AccountWithRawResponse:
"""
This property can be used as a prefix for any HTTP method call to return the
This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.

For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers
Expand Down Expand Up @@ -79,7 +79,7 @@ class AsyncAccount(AsyncAPIResource):
@cached_property
def with_raw_response(self) -> AsyncAccountWithRawResponse:
"""
This property can be used as a prefix for any HTTP method call to return the
This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.

For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers
Expand Down
4 changes: 2 additions & 2 deletions src/finch/resources/connect/connect.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def sessions(self) -> Sessions:
@cached_property
def with_raw_response(self) -> ConnectWithRawResponse:
"""
This property can be used as a prefix for any HTTP method call to return the
This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.

For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers
Expand All @@ -49,7 +49,7 @@ def sessions(self) -> AsyncSessions:
@cached_property
def with_raw_response(self) -> AsyncConnectWithRawResponse:
"""
This property can be used as a prefix for any HTTP method call to return the
This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.

For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers
Expand Down
4 changes: 2 additions & 2 deletions src/finch/resources/connect/sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class Sessions(SyncAPIResource):
@cached_property
def with_raw_response(self) -> SessionsWithRawResponse:
"""
This property can be used as a prefix for any HTTP method call to return the
This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.

For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers
Expand Down Expand Up @@ -166,7 +166,7 @@ class AsyncSessions(AsyncAPIResource):
@cached_property
def with_raw_response(self) -> AsyncSessionsWithRawResponse:
"""
This property can be used as a prefix for any HTTP method call to return the
This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.

For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers
Expand Down
4 changes: 2 additions & 2 deletions src/finch/resources/hris/benefits/benefits.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def individuals(self) -> Individuals:
@cached_property
def with_raw_response(self) -> BenefitsWithRawResponse:
"""
This property can be used as a prefix for any HTTP method call to return the
This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.

For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers
Expand Down Expand Up @@ -228,7 +228,7 @@ def individuals(self) -> AsyncIndividuals:
@cached_property
def with_raw_response(self) -> AsyncBenefitsWithRawResponse:
"""
This property can be used as a prefix for any HTTP method call to return the
This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.

For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers
Expand Down
4 changes: 2 additions & 2 deletions src/finch/resources/hris/benefits/individuals.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Individuals(SyncAPIResource):
@cached_property
def with_raw_response(self) -> IndividualsWithRawResponse:
"""
This property can be used as a prefix for any HTTP method call to return the
This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.

For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers
Expand Down Expand Up @@ -214,7 +214,7 @@ class AsyncIndividuals(AsyncAPIResource):
@cached_property
def with_raw_response(self) -> AsyncIndividualsWithRawResponse:
"""
This property can be used as a prefix for any HTTP method call to return the
This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.

For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers
Expand Down
4 changes: 2 additions & 2 deletions src/finch/resources/hris/company.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class CompanyResource(SyncAPIResource):
@cached_property
def with_raw_response(self) -> CompanyResourceWithRawResponse:
"""
This property can be used as a prefix for any HTTP method call to return the
This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.

For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers
Expand Down Expand Up @@ -59,7 +59,7 @@ class AsyncCompanyResource(AsyncAPIResource):
@cached_property
def with_raw_response(self) -> AsyncCompanyResourceWithRawResponse:
"""
This property can be used as a prefix for any HTTP method call to return the
This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.

For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers
Expand Down
4 changes: 2 additions & 2 deletions src/finch/resources/hris/directory.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class Directory(SyncAPIResource):
@cached_property
def with_raw_response(self) -> DirectoryWithRawResponse:
"""
This property can be used as a prefix for any HTTP method call to return the
This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.

For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers
Expand Down Expand Up @@ -130,7 +130,7 @@ class AsyncDirectory(AsyncAPIResource):
@cached_property
def with_raw_response(self) -> AsyncDirectoryWithRawResponse:
"""
This property can be used as a prefix for any HTTP method call to return the
This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.

For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers
Expand Down
4 changes: 2 additions & 2 deletions src/finch/resources/hris/documents.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class Documents(SyncAPIResource):
@cached_property
def with_raw_response(self) -> DocumentsWithRawResponse:
"""
This property can be used as a prefix for any HTTP method call to return the
This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.

For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers
Expand Down Expand Up @@ -147,7 +147,7 @@ class AsyncDocuments(AsyncAPIResource):
@cached_property
def with_raw_response(self) -> AsyncDocumentsWithRawResponse:
"""
This property can be used as a prefix for any HTTP method call to return the
This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.

For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers
Expand Down
4 changes: 2 additions & 2 deletions src/finch/resources/hris/employments.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class Employments(SyncAPIResource):
@cached_property
def with_raw_response(self) -> EmploymentsWithRawResponse:
"""
This property can be used as a prefix for any HTTP method call to return the
This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.

For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers
Expand Down Expand Up @@ -81,7 +81,7 @@ class AsyncEmployments(AsyncAPIResource):
@cached_property
def with_raw_response(self) -> AsyncEmploymentsWithRawResponse:
"""
This property can be used as a prefix for any HTTP method call to return the
This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.

For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers
Expand Down
4 changes: 2 additions & 2 deletions src/finch/resources/hris/hris.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def benefits(self) -> Benefits:
@cached_property
def with_raw_response(self) -> HRISWithRawResponse:
"""
This property can be used as a prefix for any HTTP method call to return the
This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.

For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers
Expand Down Expand Up @@ -161,7 +161,7 @@ def benefits(self) -> AsyncBenefits:
@cached_property
def with_raw_response(self) -> AsyncHRISWithRawResponse:
"""
This property can be used as a prefix for any HTTP method call to return the
This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.

For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers
Expand Down
4 changes: 2 additions & 2 deletions src/finch/resources/hris/individuals.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class Individuals(SyncAPIResource):
@cached_property
def with_raw_response(self) -> IndividualsWithRawResponse:
"""
This property can be used as a prefix for any HTTP method call to return the
This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.

For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers
Expand Down Expand Up @@ -86,7 +86,7 @@ class AsyncIndividuals(AsyncAPIResource):
@cached_property
def with_raw_response(self) -> AsyncIndividualsWithRawResponse:
"""
This property can be used as a prefix for any HTTP method call to return the
This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.

For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers
Expand Down
4 changes: 2 additions & 2 deletions src/finch/resources/hris/pay_statements.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class PayStatements(SyncAPIResource):
@cached_property
def with_raw_response(self) -> PayStatementsWithRawResponse:
"""
This property can be used as a prefix for any HTTP method call to return the
This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.

For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers
Expand Down Expand Up @@ -86,7 +86,7 @@ class AsyncPayStatements(AsyncAPIResource):
@cached_property
def with_raw_response(self) -> AsyncPayStatementsWithRawResponse:
"""
This property can be used as a prefix for any HTTP method call to return the
This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.

For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers
Expand Down
Loading
Loading