Skip to content

release: 1.15.0 #599

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 12 commits into from
Feb 27, 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 .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ USER vscode
RUN curl -sSf https://rye.astral.sh/get | RYE_VERSION="0.35.0" RYE_INSTALL_OPTION="--yes" bash
ENV PATH=/home/vscode/.rye/shims:$PATH

RUN echo "[[ -d .venv ]] && source .venv/bin/activate" >> /home/vscode/.bashrc
RUN echo "[[ -d .venv ]] && source .venv/bin/activate || export PATH=\$PATH" >> /home/vscode/.bashrc
3 changes: 3 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
}
}
}
},
"features": {
"ghcr.io/devcontainers/features/node:1": {}
}

// Features to add to the dev container. More info: https://containers.dev/features.
Expand Down
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.14.2"
".": "1.15.0"
}
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 41
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-97bf4795deec23d1bfd3b0b5fd77c2a93c87f10e5fa3375ab30f4a877be97f53.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-57fcc886b05984f78d7e68e9b2494af925f1b104e3475ed5281fde6c728a8518.yml
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,26 @@
# Changelog

## 1.15.0 (2025-02-26)

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

### Features

* **api:** api update ([#602](https://github.com/Finch-API/finch-api-python/issues/602)) ([7b60c37](https://github.com/Finch-API/finch-api-python/commit/7b60c3799d7e28af677d7f040563f011acc8475b))
* **client:** allow passing `NotGiven` for body ([#600](https://github.com/Finch-API/finch-api-python/issues/600)) ([29b8a08](https://github.com/Finch-API/finch-api-python/commit/29b8a08066e6f35ebde9625debb18ed91733618c))


### Bug Fixes

* **client:** mark some request bodies as optional ([29b8a08](https://github.com/Finch-API/finch-api-python/commit/29b8a08066e6f35ebde9625debb18ed91733618c))


### Chores

* **internal:** codegen related update ([#598](https://github.com/Finch-API/finch-api-python/issues/598)) ([065fc91](https://github.com/Finch-API/finch-api-python/commit/065fc914bcbb3848fbdf62083d289e168f782acd))
* **internal:** fix devcontainers setup ([#601](https://github.com/Finch-API/finch-api-python/issues/601)) ([c1c9f5a](https://github.com/Finch-API/finch-api-python/commit/c1c9f5a17fb7094d0f4c198473b7788089e08750))
* **internal:** properly set __pydantic_private__ ([#603](https://github.com/Finch-API/finch-api-python/issues/603)) ([0119042](https://github.com/Finch-API/finch-api-python/commit/0119042284b4d0fbf4205f41eb8e08cece7889b6))

## 1.14.2 (2025-02-11)

Full Changelog: [v1.14.1...v1.14.2](https://github.com/Finch-API/finch-api-python/compare/v1.14.1...v1.14.2)
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.14.2"
version = "1.15.0"
description = "The official Python library for the Finch API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down
10 changes: 8 additions & 2 deletions src/finch/_base_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
ModelBuilderProtocol,
)
from ._utils import is_dict, is_list, asyncify, is_given, lru_cache, is_mapping
from ._compat import model_copy, model_dump
from ._compat import PYDANTIC_V2, model_copy, model_dump
from ._models import GenericModel, FinalRequestOptions, validate_type, construct_type
from ._response import (
APIResponse,
Expand Down Expand Up @@ -208,6 +208,9 @@ def _set_private_attributes(
model: Type[_T],
options: FinalRequestOptions,
) -> None:
if PYDANTIC_V2 and getattr(self, "__pydantic_private__", None) is None:
self.__pydantic_private__ = {}

self._model = model
self._client = client
self._options = options
Expand Down Expand Up @@ -293,6 +296,9 @@ def _set_private_attributes(
client: AsyncAPIClient,
options: FinalRequestOptions,
) -> None:
if PYDANTIC_V2 and getattr(self, "__pydantic_private__", None) is None:
self.__pydantic_private__ = {}

self._model = model
self._client = client
self._options = options
Expand Down Expand Up @@ -519,7 +525,7 @@ def _build_request(
# so that passing a `TypedDict` doesn't cause an error.
# https://github.com/microsoft/pyright/issues/3526#event-6715453066
params=self.qs.stringify(cast(Mapping[str, Any], params)) if params else None,
json=json_data,
json=json_data if is_given(json_data) else None,
files=files,
**kwargs,
)
Expand Down
19 changes: 17 additions & 2 deletions src/finch/_utils/_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,20 @@
from typing import Any, TypeVar, Callable, Awaitable
from typing_extensions import ParamSpec

import anyio
import sniffio
import anyio.to_thread

T_Retval = TypeVar("T_Retval")
T_ParamSpec = ParamSpec("T_ParamSpec")


if sys.version_info >= (3, 9):
to_thread = asyncio.to_thread
_asyncio_to_thread = asyncio.to_thread
else:
# backport of https://docs.python.org/3/library/asyncio-task.html#asyncio.to_thread
# for Python 3.8 support
async def to_thread(
async def _asyncio_to_thread(
func: Callable[T_ParamSpec, T_Retval], /, *args: T_ParamSpec.args, **kwargs: T_ParamSpec.kwargs
) -> Any:
"""Asynchronously run function *func* in a separate thread.
Expand All @@ -34,6 +38,17 @@ async def to_thread(
return await loop.run_in_executor(None, func_call)


async def to_thread(
func: Callable[T_ParamSpec, T_Retval], /, *args: T_ParamSpec.args, **kwargs: T_ParamSpec.kwargs
) -> T_Retval:
if sniffio.current_async_library() == "asyncio":
return await _asyncio_to_thread(func, *args, **kwargs)

return await anyio.to_thread.run_sync(
functools.partial(func, *args, **kwargs),
)


# inspired by `asyncer`, https://github.com/tiangolo/asyncer
def asyncify(function: Callable[T_ParamSpec, T_Retval]) -> Callable[T_ParamSpec, Awaitable[T_Retval]]:
"""
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.14.2" # x-release-please-version
__version__ = "1.15.0" # x-release-please-version
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 @@ -51,7 +51,7 @@ def enroll_many(
self,
benefit_id: str,
*,
individuals: Iterable[individual_enroll_many_params.Individual],
individuals: Iterable[individual_enroll_many_params.Individual] | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
Expand Down Expand Up @@ -234,7 +234,7 @@ def enroll_many(
self,
benefit_id: str,
*,
individuals: Iterable[individual_enroll_many_params.Individual],
individuals: Iterable[individual_enroll_many_params.Individual] | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
Expand Down
4 changes: 2 additions & 2 deletions src/finch/resources/sandbox/directory.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def with_streaming_response(self) -> DirectoryWithStreamingResponse:
def create(
self,
*,
body: Iterable[directory_create_params.Body],
body: Iterable[directory_create_params.Body] | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
Expand Down Expand Up @@ -101,7 +101,7 @@ def with_streaming_response(self) -> AsyncDirectoryWithStreamingResponse:
async def create(
self,
*,
body: Iterable[directory_create_params.Body],
body: Iterable[directory_create_params.Body] | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from __future__ import annotations

from typing import Iterable, Optional
from typing_extensions import Literal, Required, TypedDict
from typing_extensions import Literal, TypedDict

__all__ = [
"IndividualEnrollManyParams",
Expand All @@ -15,7 +15,7 @@


class IndividualEnrollManyParams(TypedDict, total=False):
individuals: Required[Iterable[Individual]]
individuals: Iterable[Individual]
"""Array of the individual_id to enroll and a configuration object."""


Expand Down
58 changes: 56 additions & 2 deletions src/finch/types/hris/pay_statement.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,40 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import List, Optional
from typing import Dict, List, Optional
from typing_extensions import Literal

from ..money import Money
from ..._models import BaseModel
from .benefit_type import BenefitType

__all__ = ["PayStatement", "Earning", "EmployeeDeduction", "EmployerContribution", "Tax"]
__all__ = [
"PayStatement",
"Earning",
"EarningAttributes",
"EmployeeDeduction",
"EmployeeDeductionAttributes",
"EmployerContribution",
"EmployerContributionAttributes",
"Tax",
"TaxAttributes",
]


class EarningAttributes(BaseModel):
metadata: Optional[Dict[str, object]] = None
"""The metadata to be attached to the entity by existing rules.

It is a key-value pairs where the values can be of any type (string, number,
boolean, object, array, etc.).
"""


class Earning(BaseModel):
amount: Optional[int] = None
"""The earnings amount in cents."""

attributes: Optional[EarningAttributes] = None

currency: Optional[str] = None
"""The earnings currency code."""

Expand Down Expand Up @@ -47,10 +68,21 @@ class Earning(BaseModel):
"""The type of earning."""


class EmployeeDeductionAttributes(BaseModel):
metadata: Optional[Dict[str, object]] = None
"""The metadata to be attached to the entity by existing rules.

It is a key-value pairs where the values can be of any type (string, number,
boolean, object, array, etc.).
"""


class EmployeeDeduction(BaseModel):
amount: Optional[int] = None
"""The deduction amount in cents."""

attributes: Optional[EmployeeDeductionAttributes] = None

currency: Optional[str] = None
"""The deduction currency."""

Expand All @@ -64,10 +96,21 @@ class EmployeeDeduction(BaseModel):
"""Type of benefit."""


class EmployerContributionAttributes(BaseModel):
metadata: Optional[Dict[str, object]] = None
"""The metadata to be attached to the entity by existing rules.

It is a key-value pairs where the values can be of any type (string, number,
boolean, object, array, etc.).
"""


class EmployerContribution(BaseModel):
amount: Optional[int] = None
"""The contribution amount in cents."""

attributes: Optional[EmployerContributionAttributes] = None

currency: Optional[str] = None
"""The contribution currency."""

Expand All @@ -78,10 +121,21 @@ class EmployerContribution(BaseModel):
"""Type of benefit."""


class TaxAttributes(BaseModel):
metadata: Optional[Dict[str, object]] = None
"""The metadata to be attached to the entity by existing rules.

It is a key-value pairs where the values can be of any type (string, number,
boolean, object, array, etc.).
"""


class Tax(BaseModel):
amount: Optional[int] = None
"""The tax amount in cents."""

attributes: Optional[TaxAttributes] = None

currency: Optional[str] = None
"""The currency code."""

Expand Down
4 changes: 2 additions & 2 deletions src/finch/types/sandbox/directory_create_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from __future__ import annotations

from typing import Iterable, Optional
from typing_extensions import Literal, Required, TypedDict
from typing_extensions import Literal, TypedDict

from ..income_param import IncomeParam
from ..location_param import LocationParam
Expand All @@ -21,7 +21,7 @@


class DirectoryCreateParams(TypedDict, total=False):
body: Required[Iterable[Body]]
body: Iterable[Body]
"""Array of individuals to create.

Takes all combined fields from `/individual` and `/employment` endpoints. All
Expand Down
Loading