Skip to content
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

release: 1.8.0 #512

Merged
merged 10 commits into from
Oct 25, 2024
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.7.0"
".": "1.8.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: 39
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-6a3981b3fb38fe3ebae980af27e09f31d22db3659699afdd61f336594209ce42.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-612b573cabcee39c562dc91f5b185e2a0bfdce3a262618f0098602af2199af67.yml
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

## 1.8.0 (2024-10-23)

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

### Features

* **api:** api update ([#511](https://github.com/Finch-API/finch-api-python/issues/511)) ([fab3cd1](https://github.com/Finch-API/finch-api-python/commit/fab3cd169bc417bb143153dc0b8a56cdb4bf7282))
* **api:** api update ([#513](https://github.com/Finch-API/finch-api-python/issues/513)) ([32e705f](https://github.com/Finch-API/finch-api-python/commit/32e705fd3d78b6c9047aae99bbaa4a79724d2730))

## 1.7.0 (2024-10-03)

Full Changelog: [v1.6.0...v1.7.0](https://github.com/Finch-API/finch-api-python/compare/v1.6.0...v1.7.0)
Expand Down
44 changes: 24 additions & 20 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@

### With Rye

We use [Rye](https://rye.astral.sh/) to manage dependencies so we highly recommend [installing it](https://rye.astral.sh/guide/installation/) as it will automatically provision a Python environment with the expected Python version.
We use [Rye](https://rye.astral.sh/) to manage dependencies because it will automatically provision a Python environment with the expected Python version. To set it up, run:

After installing Rye, you'll just have to run this command:
```sh
$ ./scripts/bootstrap
```

Or [install Rye manually](https://rye.astral.sh/guide/installation/) and run:

```sh
$ rye sync --all-features
Expand Down Expand Up @@ -39,17 +43,17 @@ modify the contents of the `src/finch/lib/` and `examples/` directories.

All files in the `examples/` directory are not modified by the generator and can be freely edited or added to.

```bash
```py
# add an example to examples/<your-example>.py

#!/usr/bin/env -S rye run python
```

```
chmod +x examples/<your-example>.py
```sh
$ chmod +x examples/<your-example>.py
# run the example against your api
./examples/<your-example>.py
$ ./examples/<your-example>.py
```

## Using the repository from source
Expand All @@ -58,8 +62,8 @@ If you’d like to use the repository from source, you can either install from g

To install via git:

```bash
pip install git+ssh://[email protected]/Finch-API/finch-api-python.git
```sh
$ pip install git+ssh://[email protected]/Finch-API/finch-api-python.git
```

Alternatively, you can build from source and install the wheel file:
Expand All @@ -68,29 +72,29 @@ Building this package will create two files in the `dist/` directory, a `.tar.gz

To create a distributable version of the library, all you have to do is run this command:

```bash
rye build
```sh
$ rye build
# or
python -m build
$ python -m build
```

Then to install:

```sh
pip install ./path-to-wheel-file.whl
$ pip install ./path-to-wheel-file.whl
```

## Running tests

Most tests require you to [set up a mock server](https://github.com/stoplightio/prism) against the OpenAPI spec to run the tests.

```bash
```sh
# you will need npm installed
npx prism mock path/to/your/openapi.yml
$ npx prism mock path/to/your/openapi.yml
```

```bash
rye run pytest
```sh
$ ./scripts/test
```

## Linting and formatting
Expand All @@ -100,14 +104,14 @@ This repository uses [ruff](https://github.com/astral-sh/ruff) and

To lint:

```bash
rye run lint
```sh
$ ./scripts/lint
```

To format and fix all ruff issues automatically:

```bash
rye run format
```sh
$ ./scripts/format
```

## Publishing and releases
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -430,3 +430,7 @@ print(finch.__version__)
## Requirements

Python 3.7 or higher.

## Contributing

See [the contributing documentation](./CONTRIBUTING.md).
10 changes: 3 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "finch-api"
version = "1.7.0"
version = "1.8.0"
description = "The official Python library for the Finch API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down Expand Up @@ -63,11 +63,11 @@ format = { chain = [
"format:ruff",
"format:docs",
"fix:ruff",
# run formatting again to fix any inconsistencies when imports are stripped
"format:ruff",
]}
"format:black" = "black ."
"format:docs" = "python scripts/utils/ruffen-docs.py README.md api.md"
"format:ruff" = "ruff format"
"format:isort" = "isort ."

"lint" = { chain = [
"check:ruff",
Expand Down Expand Up @@ -125,10 +125,6 @@ path = "README.md"
pattern = '\[(.+?)\]\(((?!https?://)\S+?)\)'
replacement = '[\1](https://github.com/Finch-API/finch-api-python/tree/main/\g<2>)'

[tool.black]
line-length = 120
target-version = ["py37"]

[tool.pytest.ini_options]
testpaths = ["tests"]
addopts = "--tb=short"
Expand Down
2 changes: 1 addition & 1 deletion requirements-dev.lock
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ pytz==2023.3.post1
# via dirty-equals
respx==0.20.2
rich==13.7.1
ruff==0.6.5
ruff==0.6.9
setuptools==68.2.2
# via nodeenv
six==1.16.0
Expand Down
11 changes: 9 additions & 2 deletions src/finch/_base_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,12 @@ def __init__(
self.url = url
self.params = params

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


class BasePage(GenericModel, Generic[_T]):
"""
Expand Down Expand Up @@ -690,7 +696,8 @@ def _calculate_retry_timeout(
if retry_after is not None and 0 < retry_after <= 60:
return retry_after

nb_retries = max_retries - remaining_retries
# Also cap retry count to 1000 to avoid any potential overflows with `pow`
nb_retries = min(max_retries - remaining_retries, 1000)

# Apply exponential backoff, but not more than the max.
sleep_seconds = min(INITIAL_RETRY_DELAY * pow(2.0, nb_retries), MAX_RETRY_DELAY)
Expand Down Expand Up @@ -1583,7 +1590,7 @@ async def _request(
except Exception as err:
log.debug("Encountered Exception", exc_info=True)

if retries_taken > 0:
if remaining_retries > 0:
return await self._retry_request(
input_options,
cast_to,
Expand Down
4 changes: 2 additions & 2 deletions src/finch/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def __init__(
@property
@override
def qs(self) -> Querystring:
return Querystring(array_format="comma")
return Querystring(array_format="brackets")

@property
@override
Expand Down Expand Up @@ -495,7 +495,7 @@ def __init__(
@property
@override
def qs(self) -> Querystring:
return Querystring(array_format="comma")
return Querystring(array_format="brackets")

@property
@override
Expand Down
3 changes: 3 additions & 0 deletions src/finch/_legacy_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,9 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T:
if cast_to == float:
return cast(R, float(response.text))

if cast_to == bool:
return cast(R, response.text.lower() == "true")

origin = get_origin(cast_to) or cast_to

if inspect.isclass(origin) and issubclass(origin, HttpxBinaryResponseContent):
Expand Down
3 changes: 3 additions & 0 deletions src/finch/_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,9 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T:
if cast_to == float:
return cast(R, float(response.text))

if cast_to == bool:
return cast(R, response.text.lower() == "true")

origin = get_origin(cast_to) or cast_to

# handle the legacy binary response case
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.7.0" # x-release-please-version
__version__ = "1.8.0" # x-release-please-version
14 changes: 0 additions & 14 deletions src/finch/types/account_update_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
"AccountUpdateEventDataAuthenticationMethodSupportedFieldsPayStatementPayStatementsEarnings",
"AccountUpdateEventDataAuthenticationMethodSupportedFieldsPayStatementPayStatementsEmployeeDeductions",
"AccountUpdateEventDataAuthenticationMethodSupportedFieldsPayStatementPayStatementsEmployerContributions",
"AccountUpdateEventDataAuthenticationMethodSupportedFieldsPayStatementPayStatementsEmployerDeductions",
"AccountUpdateEventDataAuthenticationMethodSupportedFieldsPayStatementPayStatementsTaxes",
"AccountUpdateEventDataAuthenticationMethodSupportedFieldsPayment",
"AccountUpdateEventDataAuthenticationMethodSupportedFieldsPaymentPayPeriod",
Expand Down Expand Up @@ -302,14 +301,6 @@ class AccountUpdateEventDataAuthenticationMethodSupportedFieldsPayStatementPaySt
name: Optional[bool] = None


class AccountUpdateEventDataAuthenticationMethodSupportedFieldsPayStatementPayStatementsEmployerDeductions(BaseModel):
amount: Optional[bool] = None

currency: Optional[bool] = None

name: Optional[bool] = None


class AccountUpdateEventDataAuthenticationMethodSupportedFieldsPayStatementPayStatementsTaxes(BaseModel):
amount: Optional[bool] = None

Expand All @@ -335,11 +326,6 @@ class AccountUpdateEventDataAuthenticationMethodSupportedFieldsPayStatementPaySt
AccountUpdateEventDataAuthenticationMethodSupportedFieldsPayStatementPayStatementsEmployerContributions
] = None

employer_deductions: Optional[
AccountUpdateEventDataAuthenticationMethodSupportedFieldsPayStatementPayStatementsEmployerDeductions
] = None
"""[DEPRECATED] Use `employer_contributions` instead"""

gross_pay: Optional[bool] = None

individual_id: Optional[bool] = None
Expand Down
1 change: 0 additions & 1 deletion src/finch/types/connect/session_new_response.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.



from ..._models import BaseModel

__all__ = ["SessionNewResponse"]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.



from ..._models import BaseModel

__all__ = ["SessionReauthenticateResponse"]
Expand Down
1 change: 0 additions & 1 deletion src/finch/types/disconnect_response.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.



from .._models import BaseModel

__all__ = ["DisconnectResponse"]
Expand Down
1 change: 0 additions & 1 deletion src/finch/types/hris/benfit_contribution.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.



from .benefit_contribution import BenefitContribution

__all__ = ["BenfitContribution"]
Expand Down
1 change: 0 additions & 1 deletion src/finch/types/hris/create_company_benefits_response.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.



from ..._models import BaseModel

__all__ = ["CreateCompanyBenefitsResponse"]
Expand Down
1 change: 0 additions & 1 deletion src/finch/types/hris/update_company_benefit_response.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.



from ..._models import BaseModel

__all__ = ["UpdateCompanyBenefitResponse"]
Expand Down
1 change: 0 additions & 1 deletion src/finch/types/jobs/automated_create_response.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.



from ..._models import BaseModel

__all__ = ["AutomatedCreateResponse"]
Expand Down
12 changes: 0 additions & 12 deletions src/finch/types/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
"AuthenticationMethodSupportedFieldsPayStatementPayStatementsEarnings",
"AuthenticationMethodSupportedFieldsPayStatementPayStatementsEmployeeDeductions",
"AuthenticationMethodSupportedFieldsPayStatementPayStatementsEmployerContributions",
"AuthenticationMethodSupportedFieldsPayStatementPayStatementsEmployerDeductions",
"AuthenticationMethodSupportedFieldsPayStatementPayStatementsTaxes",
"AuthenticationMethodSupportedFieldsPayment",
"AuthenticationMethodSupportedFieldsPaymentPayPeriod",
Expand Down Expand Up @@ -297,14 +296,6 @@ class AuthenticationMethodSupportedFieldsPayStatementPayStatementsEmployerContri
name: Optional[bool] = None


class AuthenticationMethodSupportedFieldsPayStatementPayStatementsEmployerDeductions(BaseModel):
amount: Optional[bool] = None

currency: Optional[bool] = None

name: Optional[bool] = None


class AuthenticationMethodSupportedFieldsPayStatementPayStatementsTaxes(BaseModel):
amount: Optional[bool] = None

Expand All @@ -326,9 +317,6 @@ class AuthenticationMethodSupportedFieldsPayStatementPayStatements(BaseModel):
AuthenticationMethodSupportedFieldsPayStatementPayStatementsEmployerContributions
] = None

employer_deductions: Optional[AuthenticationMethodSupportedFieldsPayStatementPayStatementsEmployerDeductions] = None
"""[DEPRECATED] Use `employer_contributions` instead"""

gross_pay: Optional[bool] = None

individual_id: Optional[bool] = None
Expand Down
1 change: 0 additions & 1 deletion src/finch/types/sandbox/job_create_response.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.



from ..._models import BaseModel

__all__ = ["JobCreateResponse"]
Expand Down
1 change: 0 additions & 1 deletion src/finch/types/sandbox/payment_create_response.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.



from ..._models import BaseModel

__all__ = ["PaymentCreateResponse"]
Expand Down
Loading