Skip to content

Commit 8d60c28

Browse files
release: 1.35.0 (#672)
* feat(api): api update * chore: update github action * chore(internal): change ci workflow machines * fix: avoid newer type syntax * chore(internal): update pyright exclude list * chore(internal): minor formatting change * chore(internal): add Sequence related utils * feat(types): replace List[str] with SequenceNotStr in params * release: 1.35.0 --------- Co-authored-by: stainless-app[bot] <142633134+stainless-app[bot]@users.noreply.github.com>
1 parent ffcc48a commit 8d60c28

25 files changed

+135
-45
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ jobs:
3636
run: ./scripts/lint
3737

3838
build:
39-
if: github.repository == 'stainless-sdks/finch-python' && (github.event_name == 'push' || github.event.pull_request.head.repo.fork)
39+
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
4040
timeout-minutes: 10
4141
name: build
4242
permissions:
4343
contents: read
4444
id-token: write
45-
runs-on: depot-ubuntu-24.04
45+
runs-on: ${{ github.repository == 'stainless-sdks/finch-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
4646
steps:
4747
- uses: actions/checkout@v4
4848

@@ -61,12 +61,14 @@ jobs:
6161
run: rye build
6262

6363
- name: Get GitHub OIDC Token
64+
if: github.repository == 'stainless-sdks/finch-python'
6465
id: github-oidc
6566
uses: actions/github-script@v6
6667
with:
6768
script: core.setOutput('github_token', await core.getIDToken());
6869

6970
- name: Upload tarball
71+
if: github.repository == 'stainless-sdks/finch-python'
7072
env:
7173
URL: https://pkg.stainless.com/s
7274
AUTH: ${{ steps.github-oidc.outputs.github_token }}

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "1.34.0"
2+
".": "1.35.0"
33
}

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 46
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-6d0c6a1feba5ccb895a6779cd98c2a0ae87d6394f5e98a9da51f17258c4eb297.yml
3-
openapi_spec_hash: ac3be0c8a992103e5f467fe1bcb20a81
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-bf86910e96e83e583689cf5d1a5c583268754026ec68288994fa6a969dc248f2.yml
3+
openapi_spec_hash: 195038e056891afec204c49dadce3b95
44
config_hash: 5146b12344dae76238940989dac1e8a0

CHANGELOG.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,28 @@
11
# Changelog
22

3+
## 1.35.0 (2025-09-02)
4+
5+
Full Changelog: [v1.34.0...v1.35.0](https://github.com/Finch-API/finch-api-python/compare/v1.34.0...v1.35.0)
6+
7+
### Features
8+
9+
* **api:** api update ([7f1f3fc](https://github.com/Finch-API/finch-api-python/commit/7f1f3fcb12b896ae43df668d6825e6de895a0843))
10+
* **types:** replace List[str] with SequenceNotStr in params ([7d41d8f](https://github.com/Finch-API/finch-api-python/commit/7d41d8fe116a14351d2f6aa569733c039f9a071f))
11+
12+
13+
### Bug Fixes
14+
15+
* avoid newer type syntax ([c180618](https://github.com/Finch-API/finch-api-python/commit/c18061816f2c5d81d958cbf0fd7fd16b95fa7371))
16+
17+
18+
### Chores
19+
20+
* **internal:** add Sequence related utils ([1c99d3a](https://github.com/Finch-API/finch-api-python/commit/1c99d3a79c85da901f81bfc94daa64317aedef19))
21+
* **internal:** change ci workflow machines ([825d163](https://github.com/Finch-API/finch-api-python/commit/825d1637f7058c3d80092b6b07146653cc76432f))
22+
* **internal:** minor formatting change ([7f1c96d](https://github.com/Finch-API/finch-api-python/commit/7f1c96d1ef47db7be85a93e602bfa612e50f04c1))
23+
* **internal:** update pyright exclude list ([7b620cc](https://github.com/Finch-API/finch-api-python/commit/7b620cc5f0a89e2d1aab02065ff0af4e87b022ff))
24+
* update github action ([5067831](https://github.com/Finch-API/finch-api-python/commit/50678319366698ef0d8ea19b6ae6d383e8b3725c))
25+
326
## 1.34.0 (2025-08-20)
427

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

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "finch-api"
3-
version = "1.34.0"
3+
version = "1.35.0"
44
description = "The official Python library for the Finch API"
55
dynamic = ["readme"]
66
license = "Apache-2.0"
@@ -148,6 +148,7 @@ exclude = [
148148
"_dev",
149149
".venv",
150150
".nox",
151+
".git",
151152
]
152153

153154
reportImplicitOverride = true

src/finch/_models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ def model_dump(
304304
exclude_none=exclude_none,
305305
)
306306

307-
return cast(dict[str, Any], json_safe(dumped)) if mode == "json" else dumped
307+
return cast("dict[str, Any]", json_safe(dumped)) if mode == "json" else dumped
308308

309309
@override
310310
def model_dump_json(

src/finch/_types.py

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,21 @@
1313
Mapping,
1414
TypeVar,
1515
Callable,
16+
Iterator,
1617
Optional,
1718
Sequence,
1819
)
19-
from typing_extensions import Set, Literal, Protocol, TypeAlias, TypedDict, override, runtime_checkable
20+
from typing_extensions import (
21+
Set,
22+
Literal,
23+
Protocol,
24+
TypeAlias,
25+
TypedDict,
26+
SupportsIndex,
27+
overload,
28+
override,
29+
runtime_checkable,
30+
)
2031

2132
import httpx
2233
import pydantic
@@ -219,3 +230,26 @@ class _GenericAlias(Protocol):
219230
class HttpxSendArgs(TypedDict, total=False):
220231
auth: httpx.Auth
221232
follow_redirects: bool
233+
234+
235+
_T_co = TypeVar("_T_co", covariant=True)
236+
237+
238+
if TYPE_CHECKING:
239+
# This works because str.__contains__ does not accept object (either in typeshed or at runtime)
240+
# https://github.com/hauntsaninja/useful_types/blob/5e9710f3875107d068e7679fd7fec9cfab0eff3b/useful_types/__init__.py#L285
241+
class SequenceNotStr(Protocol[_T_co]):
242+
@overload
243+
def __getitem__(self, index: SupportsIndex, /) -> _T_co: ...
244+
@overload
245+
def __getitem__(self, index: slice, /) -> Sequence[_T_co]: ...
246+
def __contains__(self, value: object, /) -> bool: ...
247+
def __len__(self) -> int: ...
248+
def __iter__(self) -> Iterator[_T_co]: ...
249+
def index(self, value: Any, start: int = 0, stop: int = ..., /) -> int: ...
250+
def count(self, value: Any, /) -> int: ...
251+
def __reversed__(self) -> Iterator[_T_co]: ...
252+
else:
253+
# just point this to a normal `Sequence` at runtime to avoid having to special case
254+
# deserializing our custom sequence type
255+
SequenceNotStr = Sequence

src/finch/_utils/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
extract_type_arg as extract_type_arg,
3939
is_iterable_type as is_iterable_type,
4040
is_required_type as is_required_type,
41+
is_sequence_type as is_sequence_type,
4142
is_annotated_type as is_annotated_type,
4243
is_type_alias_type as is_type_alias_type,
4344
strip_annotated_type as strip_annotated_type,

src/finch/_utils/_transform.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
lru_cache,
1717
is_mapping,
1818
is_iterable,
19+
is_sequence,
1920
)
2021
from .._files import is_base64_file_input
2122
from ._typing import (
@@ -24,6 +25,7 @@
2425
extract_type_arg,
2526
is_iterable_type,
2627
is_required_type,
28+
is_sequence_type,
2729
is_annotated_type,
2830
strip_annotated_type,
2931
)
@@ -184,6 +186,8 @@ def _transform_recursive(
184186
(is_list_type(stripped_type) and is_list(data))
185187
# Iterable[T]
186188
or (is_iterable_type(stripped_type) and is_iterable(data) and not isinstance(data, str))
189+
# Sequence[T]
190+
or (is_sequence_type(stripped_type) and is_sequence(data) and not isinstance(data, str))
187191
):
188192
# dicts are technically iterable, but it is an iterable on the keys of the dict and is not usually
189193
# intended as an iterable, so we don't transform it.
@@ -346,6 +350,8 @@ async def _async_transform_recursive(
346350
(is_list_type(stripped_type) and is_list(data))
347351
# Iterable[T]
348352
or (is_iterable_type(stripped_type) and is_iterable(data) and not isinstance(data, str))
353+
# Sequence[T]
354+
or (is_sequence_type(stripped_type) and is_sequence(data) and not isinstance(data, str))
349355
):
350356
# dicts are technically iterable, but it is an iterable on the keys of the dict and is not usually
351357
# intended as an iterable, so we don't transform it.

src/finch/_utils/_typing.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ def is_list_type(typ: type) -> bool:
2626
return (get_origin(typ) or typ) == list
2727

2828

29+
def is_sequence_type(typ: type) -> bool:
30+
origin = get_origin(typ) or typ
31+
return origin == typing_extensions.Sequence or origin == typing.Sequence or origin == _c_abc.Sequence
32+
33+
2934
def is_iterable_type(typ: type) -> bool:
3035
"""If the given type is `typing.Iterable[T]`"""
3136
origin = get_origin(typ) or typ

0 commit comments

Comments
 (0)