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.26.0"
".": "1.26.1"
}
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
# Changelog

## 1.26.1 (2025-05-09)

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

### Bug Fixes

* **package:** support direct resource imports ([d2062bb](https://github.com/Finch-API/finch-api-python/commit/d2062bbf18bd0345c9e53019661359198f970a57))


### Chores

* fix formatting ([75885aa](https://github.com/Finch-API/finch-api-python/commit/75885aa2ab70df9b3916ceb3444b943b4df22153))
* **internal:** avoid lint errors in pagination expressions ([5dce648](https://github.com/Finch-API/finch-api-python/commit/5dce648eafef19e583d80f71dfa95af0b7235640))


### Documentation

* remove or fix invalid readme examples ([e3d4bfd](https://github.com/Finch-API/finch-api-python/commit/e3d4bfd1ad22f6422739b7aefc3c0fc4a7d1b6e7))

## 1.26.0 (2025-05-08)

Full Changelog: [v1.25.0...v1.26.0](https://github.com/Finch-API/finch-api-python/compare/v1.25.0...v1.26.0)
Expand Down
13 changes: 0 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,19 +131,6 @@ for directory in first_page.individuals:
# Remove `await` for non-async usage.
```

## Nested params

Nested parameters are dictionaries, typed using `TypedDict`, for example:

```python
from finch import Finch

client = Finch()

page = client.hris.directory.list()
print(page.individuals)
```

## Webhook Verification

We provide helper methods for verifying that a webhook request came from Finch, and not a malicious third party.
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "finch-api"
version = "1.26.0"
version = "1.26.1"
description = "The official Python library for the Finch API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down
5 changes: 5 additions & 0 deletions src/finch/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

import typing as _t

from . import types
from ._types import NOT_GIVEN, Omit, NoneType, NotGiven, Transport, ProxiesTypes
from ._utils import file_from_path
Expand Down Expand Up @@ -68,6 +70,9 @@
"DefaultAsyncHttpxClient",
]

if not _t.TYPE_CHECKING:
from ._utils._resources_proxy import resources as resources

_setup_logging()

# Update the __module__ attribute for exported symbols so that
Expand Down
13 changes: 12 additions & 1 deletion src/finch/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,18 @@
)

if TYPE_CHECKING:
from .resources import hris, jobs, webhooks, account, connect, payroll, sandbox, providers, access_tokens, request_forwarding
from .resources import (
hris,
jobs,
account,
connect,
payroll,
sandbox,
webhooks,
providers,
access_tokens,
request_forwarding,
)
from .resources.account import Account, AsyncAccount
from .resources.hris.hris import HRIS, AsyncHRIS
from .resources.jobs.jobs import Jobs, AsyncJobs
Expand Down
24 changes: 24 additions & 0 deletions src/finch/_utils/_resources_proxy.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from __future__ import annotations

from typing import Any
from typing_extensions import override

from ._proxy import LazyProxy


class ResourcesProxy(LazyProxy[Any]):
"""A proxy for the `finch.resources` module.

This is used so that we can lazily import `finch.resources` only when
needed *and* so that users can just import `finch` and reference `finch.resources`
"""

@override
def __load__(self) -> Any:
import importlib

mod = importlib.import_module("finch.resources")
return mod


resources = ResourcesProxy().__as_proxied__()
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.26.0" # x-release-please-version
__version__ = "1.26.1" # x-release-please-version
8 changes: 8 additions & 0 deletions src/finch/pagination.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ def next_page_info(self) -> Optional[PageInfo]:
if self.paging is not None: # pyright: ignore[reportUnnecessaryComparison]
if self.paging.offset is not None: # pyright: ignore[reportUnnecessaryComparison]
offset = self.paging.offset
if offset is None:
return None # type: ignore[unreachable]

length = len(self._get_page_items())
current_count = offset + length
Expand Down Expand Up @@ -173,6 +175,8 @@ def next_page_info(self) -> Optional[PageInfo]:
if self.paging is not None: # pyright: ignore[reportUnnecessaryComparison]
if self.paging.offset is not None: # pyright: ignore[reportUnnecessaryComparison]
offset = self.paging.offset
if offset is None:
return None # type: ignore[unreachable]

length = len(self._get_page_items())
current_count = offset + length
Expand Down Expand Up @@ -207,6 +211,8 @@ def next_page_info(self) -> Optional[PageInfo]:
if self.paging is not None: # pyright: ignore[reportUnnecessaryComparison]
if self.paging.offset is not None: # pyright: ignore[reportUnnecessaryComparison]
offset = self.paging.offset
if offset is None:
return None # type: ignore[unreachable]

length = len(self._get_page_items())
current_count = offset + length
Expand Down Expand Up @@ -241,6 +247,8 @@ def next_page_info(self) -> Optional[PageInfo]:
if self.paging is not None: # pyright: ignore[reportUnnecessaryComparison]
if self.paging.offset is not None: # pyright: ignore[reportUnnecessaryComparison]
offset = self.paging.offset
if offset is None:
return None # type: ignore[unreachable]

length = len(self._get_page_items())
current_count = offset + length
Expand Down
1 change: 0 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,6 @@
from tests.utils import assert_matches_type

if TYPE_CHECKING:

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

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