Skip to content

Commit 971a278

Browse files
release: 1.26.1 (#659)
* chore: fix formatting * docs: remove or fix invalid readme examples * chore(internal): avoid lint errors in pagination expressions * fix(package): support direct resource imports * release: 1.26.1 --------- Co-authored-by: stainless-app[bot] <142633134+stainless-app[bot]@users.noreply.github.com>
1 parent 483edef commit 971a278

File tree

10 files changed

+71
-18
lines changed

10 files changed

+71
-18
lines changed

.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.26.0"
2+
".": "1.26.1"
33
}

CHANGELOG.md

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

3+
## 1.26.1 (2025-05-09)
4+
5+
Full Changelog: [v1.26.0...v1.26.1](https://github.com/Finch-API/finch-api-python/compare/v1.26.0...v1.26.1)
6+
7+
### Bug Fixes
8+
9+
* **package:** support direct resource imports ([d2062bb](https://github.com/Finch-API/finch-api-python/commit/d2062bbf18bd0345c9e53019661359198f970a57))
10+
11+
12+
### Chores
13+
14+
* fix formatting ([75885aa](https://github.com/Finch-API/finch-api-python/commit/75885aa2ab70df9b3916ceb3444b943b4df22153))
15+
* **internal:** avoid lint errors in pagination expressions ([5dce648](https://github.com/Finch-API/finch-api-python/commit/5dce648eafef19e583d80f71dfa95af0b7235640))
16+
17+
18+
### Documentation
19+
20+
* remove or fix invalid readme examples ([e3d4bfd](https://github.com/Finch-API/finch-api-python/commit/e3d4bfd1ad22f6422739b7aefc3c0fc4a7d1b6e7))
21+
322
## 1.26.0 (2025-05-08)
423

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

README.md

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -131,19 +131,6 @@ for directory in first_page.individuals:
131131
# Remove `await` for non-async usage.
132132
```
133133

134-
## Nested params
135-
136-
Nested parameters are dictionaries, typed using `TypedDict`, for example:
137-
138-
```python
139-
from finch import Finch
140-
141-
client = Finch()
142-
143-
page = client.hris.directory.list()
144-
print(page.individuals)
145-
```
146-
147134
## Webhook Verification
148135

149136
We provide helper methods for verifying that a webhook request came from Finch, and not a malicious third party.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "finch-api"
3-
version = "1.26.0"
3+
version = "1.26.1"
44
description = "The official Python library for the Finch API"
55
dynamic = ["readme"]
66
license = "Apache-2.0"

src/finch/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3+
import typing as _t
4+
35
from . import types
46
from ._types import NOT_GIVEN, Omit, NoneType, NotGiven, Transport, ProxiesTypes
57
from ._utils import file_from_path
@@ -68,6 +70,9 @@
6870
"DefaultAsyncHttpxClient",
6971
]
7072

73+
if not _t.TYPE_CHECKING:
74+
from ._utils._resources_proxy import resources as resources
75+
7176
_setup_logging()
7277

7378
# Update the __module__ attribute for exported symbols so that

src/finch/_client.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,18 @@
3333
)
3434

3535
if TYPE_CHECKING:
36-
from .resources import hris, jobs, webhooks, account, connect, payroll, sandbox, providers, access_tokens, request_forwarding
36+
from .resources import (
37+
hris,
38+
jobs,
39+
account,
40+
connect,
41+
payroll,
42+
sandbox,
43+
webhooks,
44+
providers,
45+
access_tokens,
46+
request_forwarding,
47+
)
3748
from .resources.account import Account, AsyncAccount
3849
from .resources.hris.hris import HRIS, AsyncHRIS
3950
from .resources.jobs.jobs import Jobs, AsyncJobs

src/finch/_utils/_resources_proxy.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
from __future__ import annotations
2+
3+
from typing import Any
4+
from typing_extensions import override
5+
6+
from ._proxy import LazyProxy
7+
8+
9+
class ResourcesProxy(LazyProxy[Any]):
10+
"""A proxy for the `finch.resources` module.
11+
12+
This is used so that we can lazily import `finch.resources` only when
13+
needed *and* so that users can just import `finch` and reference `finch.resources`
14+
"""
15+
16+
@override
17+
def __load__(self) -> Any:
18+
import importlib
19+
20+
mod = importlib.import_module("finch.resources")
21+
return mod
22+
23+
24+
resources = ResourcesProxy().__as_proxied__()

src/finch/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

33
__title__ = "finch"
4-
__version__ = "1.26.0" # x-release-please-version
4+
__version__ = "1.26.1" # x-release-please-version

src/finch/pagination.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,8 @@ def next_page_info(self) -> Optional[PageInfo]:
138138
if self.paging is not None: # pyright: ignore[reportUnnecessaryComparison]
139139
if self.paging.offset is not None: # pyright: ignore[reportUnnecessaryComparison]
140140
offset = self.paging.offset
141+
if offset is None:
142+
return None # type: ignore[unreachable]
141143

142144
length = len(self._get_page_items())
143145
current_count = offset + length
@@ -173,6 +175,8 @@ def next_page_info(self) -> Optional[PageInfo]:
173175
if self.paging is not None: # pyright: ignore[reportUnnecessaryComparison]
174176
if self.paging.offset is not None: # pyright: ignore[reportUnnecessaryComparison]
175177
offset = self.paging.offset
178+
if offset is None:
179+
return None # type: ignore[unreachable]
176180

177181
length = len(self._get_page_items())
178182
current_count = offset + length
@@ -207,6 +211,8 @@ def next_page_info(self) -> Optional[PageInfo]:
207211
if self.paging is not None: # pyright: ignore[reportUnnecessaryComparison]
208212
if self.paging.offset is not None: # pyright: ignore[reportUnnecessaryComparison]
209213
offset = self.paging.offset
214+
if offset is None:
215+
return None # type: ignore[unreachable]
210216

211217
length = len(self._get_page_items())
212218
current_count = offset + length
@@ -241,6 +247,8 @@ def next_page_info(self) -> Optional[PageInfo]:
241247
if self.paging is not None: # pyright: ignore[reportUnnecessaryComparison]
242248
if self.paging.offset is not None: # pyright: ignore[reportUnnecessaryComparison]
243249
offset = self.paging.offset
250+
if offset is None:
251+
return None # type: ignore[unreachable]
244252

245253
length = len(self._get_page_items())
246254
current_count = offset + length

tests/api_resources/test_access_tokens.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
from tests.utils import assert_matches_type
1313

1414
if TYPE_CHECKING:
15-
1615
from _pytest.fixtures import FixtureRequest # pyright: ignore[reportPrivateImportUsage]
1716

1817
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")

0 commit comments

Comments
 (0)