Skip to content
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.22.0"
".": "1.23.0"
}
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 46
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-ff61a38530dfae03860bceb49379e84bfc7434eeb5d2f1dc9677cb162014faf1.yml
openapi_spec_hash: df3bdaf4acf575bb07767cae7ca24d69
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-46640c1b468813b828be61b1af5cb5450f9555c4c757c5a740189906a8d56672.yml
openapi_spec_hash: 1d5845ae61d2c0a143db43d579b048c5
config_hash: 53778a0b839c4f6ad34fbba051f5e8a6
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
# Changelog

## 1.23.0 (2025-04-21)

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

### Features

* **api:** api update ([6355866](https://github.com/Finch-API/finch-api-python/commit/6355866b36eba70636f458528a9db94d24b38998))


### Bug Fixes

* **internal:** fix fixture import lint ([a4d1919](https://github.com/Finch-API/finch-api-python/commit/a4d19190d65a235e57eb1895645059b01df3332b))


### Chores

* **internal:** base client updates ([dd645de](https://github.com/Finch-API/finch-api-python/commit/dd645de5788da66d69a639904ab95c72eae09a48))
* **internal:** bump pyright version ([9a19507](https://github.com/Finch-API/finch-api-python/commit/9a1950770cb00259bf703f270065252b2a5858b6))
* **internal:** update models test ([8fca672](https://github.com/Finch-API/finch-api-python/commit/8fca67214e73ed85bb66e9fbec2dd2e9454538ac))

## 1.22.0 (2025-04-14)

Full Changelog: [v1.21.1...v1.22.0](https://github.com/Finch-API/finch-api-python/compare/v1.21.1...v1.22.0)
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "finch-api"
version = "1.22.0"
version = "1.23.0"
description = "The official Python library for the Finch API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down Expand Up @@ -42,7 +42,7 @@ Repository = "https://github.com/Finch-API/finch-api-python"
managed = true
# version pins are in requirements-dev.lock
dev-dependencies = [
"pyright>=1.1.359",
"pyright==1.1.399",
"mypy",
"respx",
"pytest",
Expand Down
2 changes: 1 addition & 1 deletion requirements-dev.lock
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ pydantic-core==2.27.1
# via pydantic
pygments==2.18.0
# via rich
pyright==1.1.392.post0
pyright==1.1.399
pytest==8.3.3
# via pytest-asyncio
pytest-asyncio==0.24.0
Expand Down
31 changes: 30 additions & 1 deletion src/finch/_base_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,11 @@
_AsyncStreamT = TypeVar("_AsyncStreamT", bound=AsyncStream[Any])

if TYPE_CHECKING:
from httpx._config import DEFAULT_TIMEOUT_CONFIG as HTTPX_DEFAULT_TIMEOUT
from httpx._config import (
DEFAULT_TIMEOUT_CONFIG, # pyright: ignore[reportPrivateImportUsage]
)

HTTPX_DEFAULT_TIMEOUT = DEFAULT_TIMEOUT_CONFIG
else:
try:
from httpx._config import DEFAULT_TIMEOUT_CONFIG as HTTPX_DEFAULT_TIMEOUT
Expand All @@ -116,6 +120,7 @@ class PageInfo:

url: URL | NotGiven
params: Query | NotGiven
json: Body | NotGiven

@overload
def __init__(
Expand All @@ -131,19 +136,30 @@ def __init__(
params: Query,
) -> None: ...

@overload
def __init__(
self,
*,
json: Body,
) -> None: ...

def __init__(
self,
*,
url: URL | NotGiven = NOT_GIVEN,
json: Body | NotGiven = NOT_GIVEN,
params: Query | NotGiven = NOT_GIVEN,
) -> None:
self.url = url
self.json = json
self.params = params

@override
def __repr__(self) -> str:
if self.url:
return f"{self.__class__.__name__}(url={self.url})"
if self.json:
return f"{self.__class__.__name__}(json={self.json})"
return f"{self.__class__.__name__}(params={self.params})"


Expand Down Expand Up @@ -192,6 +208,19 @@ def _info_to_options(self, info: PageInfo) -> FinalRequestOptions:
options.url = str(url)
return options

if not isinstance(info.json, NotGiven):
if not is_mapping(info.json):
raise TypeError("Pagination is only supported with mappings")

if not options.json_data:
options.json_data = {**info.json}
else:
if not is_mapping(options.json_data):
raise TypeError("Pagination is only supported with mappings")

options.json_data = {**options.json_data, **info.json}
return options

raise ValueError("Unexpected PageInfo state")


Expand Down
1 change: 0 additions & 1 deletion src/finch/_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
)

import pydantic
import pydantic.generics
from pydantic.fields import FieldInfo

from ._types import (
Expand Down
2 changes: 1 addition & 1 deletion src/finch/_utils/_typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class MyResponse(Foo[_T]):
```
"""
cls = cast(object, get_origin(typ) or typ)
if cls in generic_bases:
if cls in generic_bases: # pyright: ignore[reportUnnecessaryContains]
# we're given the class directly
return extract_type_arg(typ, index)

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.22.0" # x-release-please-version
__version__ = "1.23.0" # x-release-please-version
6 changes: 4 additions & 2 deletions src/finch/resources/sandbox/company.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ def update(

primary_email: The email of the main administrator on the account.

primary_phone_number: The phone number of the main administrator on the account. Format: `XXXXXXXXXX`
primary_phone_number: The phone number of the main administrator on the account. Format: E.164, with
extension where applicable, e.g. `+NNNNNNNNNNN xExtension`

extra_headers: Send extra headers

Expand Down Expand Up @@ -163,7 +164,8 @@ async def update(

primary_email: The email of the main administrator on the account.

primary_phone_number: The phone number of the main administrator on the account. Format: `XXXXXXXXXX`
primary_phone_number: The phone number of the main administrator on the account. Format: E.164, with
extension where applicable, e.g. `+NNNNNNNNNNN xExtension`

extra_headers: Send extra headers

Expand Down
5 changes: 4 additions & 1 deletion src/finch/types/hris/company/company.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,7 @@ class Company(BaseModel):
"""The email of the main administrator on the account."""

primary_phone_number: Optional[str] = None
"""The phone number of the main administrator on the account. Format: `XXXXXXXXXX`"""
"""The phone number of the main administrator on the account.

Format: E.164, with extension where applicable, e.g. `+NNNNNNNNNNN xExtension`
"""
5 changes: 4 additions & 1 deletion src/finch/types/sandbox/company_update_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ class CompanyUpdateParams(TypedDict, total=False):
"""The email of the main administrator on the account."""

primary_phone_number: Required[Optional[str]]
"""The phone number of the main administrator on the account. Format: `XXXXXXXXXX`"""
"""The phone number of the main administrator on the account.

Format: E.164, with extension where applicable, e.g. `+NNNNNNNNNNN xExtension`
"""


class Account(TypedDict, total=False):
Expand Down
5 changes: 4 additions & 1 deletion src/finch/types/sandbox/company_update_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,7 @@ class CompanyUpdateResponse(BaseModel):
"""The email of the main administrator on the account."""

primary_phone_number: Optional[str] = None
"""The phone number of the main administrator on the account. Format: `XXXXXXXXXX`"""
"""The phone number of the main administrator on the account.

Format: E.164, with extension where applicable, e.g. `+NNNNNNNNNNN xExtension`
"""
3 changes: 2 additions & 1 deletion tests/api_resources/test_access_tokens.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
from tests.utils import assert_matches_type

if TYPE_CHECKING:
from _pytest.fixtures import FixtureRequest

from _pytest.fixtures import FixtureRequest # pyright: ignore[reportPrivateImportUsage]

base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
client_id = "00000000-0000-0000-0000-000000000000"
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from finch import Finch, AsyncFinch

if TYPE_CHECKING:
from _pytest.fixtures import FixtureRequest
from _pytest.fixtures import FixtureRequest # pyright: ignore[reportPrivateImportUsage]

pytest.register_assert_rewrite("tests.utils")

Expand Down
5 changes: 4 additions & 1 deletion tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,12 +492,15 @@ class Model(BaseModel):
resource_id: Optional[str] = None

m = Model.construct()
assert m.resource_id is None
assert "resource_id" not in m.model_fields_set

m = Model.construct(resource_id=None)
assert m.resource_id is None
assert "resource_id" in m.model_fields_set

m = Model.construct(resource_id="foo")
assert m.resource_id == "foo"
assert "resource_id" in m.model_fields_set


Expand Down Expand Up @@ -832,7 +835,7 @@ class B(BaseModel):

@pytest.mark.skipif(not PYDANTIC_V2, reason="TypeAliasType is not supported in Pydantic v1")
def test_type_alias_type() -> None:
Alias = TypeAliasType("Alias", str)
Alias = TypeAliasType("Alias", str) # pyright: ignore

class Model(BaseModel):
alias: Alias
Expand Down