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
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ client.with_options(max_retries=5).hris.directory.list_individuals()

### Timeouts

Requests time out after 60 seconds by default. You can configure this with a `timeout` option,
Requests time out after 1 minute by default. You can configure this with a `timeout` option,
which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/#fine-tuning-the-configuration):

```python
Expand Down Expand Up @@ -268,10 +268,15 @@ See the httpx documentation for information about the [`proxies`](https://www.py

By default we will close the underlying HTTP connections whenever the client is [garbage collected](https://docs.python.org/3/reference/datamodel.html#object.__del__) is called but you can also manually close the client using the `.close()` method if desired, or with a context manager that closes when exiting.

## Status
## Versioning

This package is in beta. Its internals and interfaces are not stable and subject to change without a major semver bump;
please reach out if you rely on any undocumented behavior.
This package generally attempts to follow [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:

1. Changes that only affect static types, without breaking runtime behavior.
2. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals)_.
3. Changes that we do not expect to impact the vast majority of users in practice.

We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.

We are keen for your feedback; please open an [issue](https://www.github.com/Finch-API/finch-api-python/issues) with questions, bugs, or suggestions.

Expand Down
238 changes: 133 additions & 105 deletions poetry.lock

Large diffs are not rendered by default.

11 changes: 6 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,20 @@ packages = [
python = "^3.7"
httpx = ">= 0.23.0, < 1"
pydantic = "^1.9.0"
typing-extensions = ">= 4.1.1, < 5"
typing-extensions = ">= 4.5, < 5"
anyio = ">= 3.5.0, < 4"
distro = ">= 1.7.0, < 2"



[tool.poetry.group.dev.dependencies]
pyright = "1.1.318"
mypy = "1.1.1"
black = "22.10.0"
mypy = "1.4.1"
black = "23.3.0"
respx = "0.19.2"
pytest = "7.1.1"
pytest-asyncio = "0.18.3"
ruff = "0.0.239"
pytest-asyncio = "0.21.1"
ruff = "0.0.282"
isort = "5.10.1"
time-machine = "^2.9.0"

Expand Down
3 changes: 3 additions & 0 deletions release-please-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@
"hidden": true
}
],
"reviewers": [
"yjp20"
],
"release-type": "python",
"extra-files": [
"src/finch/_version.py"
Expand Down
1 change: 1 addition & 0 deletions src/finch/_base_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
_AsyncStreamT = TypeVar("_AsyncStreamT", bound=AsyncStream[Any])


# default timeout is 1 minute
DEFAULT_TIMEOUT = Timeout(timeout=60.0, connect=5.0)
DEFAULT_MAX_RETRIES = 2
DEFAULT_LIMITS = Limits(max_connections=100, max_keepalive_connections=20)
Expand Down
4 changes: 2 additions & 2 deletions src/finch/types/ats/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
from typing import Optional
from datetime import datetime

from .stage import Stage
from ..._models import BaseModel
from ...types.ats import stage

__all__ = ["Application", "RejectedReason"]

Expand All @@ -26,4 +26,4 @@ class Application(BaseModel):

rejected_reason: Optional[RejectedReason]

stage: Optional[stage.Stage]
stage: Optional[Stage]
6 changes: 3 additions & 3 deletions src/finch/types/hris/benefits/individual_benefit.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from typing_extensions import Literal

from ...._models import BaseModel
from ....types.hris import benfit_contribution
from ..benfit_contribution import BenfitContribution

__all__ = ["IndividualBenefit", "Body"]

Expand All @@ -21,9 +21,9 @@ class Body(BaseModel):
for this individual.
"""

company_contribution: Optional[benfit_contribution.BenfitContribution]
company_contribution: Optional[BenfitContribution]

employee_deduction: Optional[benfit_contribution.BenfitContribution]
employee_deduction: Optional[BenfitContribution]

hsa_contribution_limit: Optional[Literal["individual", "family"]]
"""Type for HSA contribution limit if the benefit is a HSA."""
Expand Down
4 changes: 2 additions & 2 deletions src/finch/types/hris/company.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
from typing import List, Optional
from typing_extensions import Literal

from ...types import location
from ..._models import BaseModel
from ..location import Location

__all__ = ["Company", "Account", "Department", "DepartmentParent", "Entity"]

Expand Down Expand Up @@ -69,7 +69,7 @@ class Company(BaseModel):
legal_name: Optional[str]
"""The legal name of the company."""

locations: Optional[List[Optional[location.Location]]]
locations: Optional[List[Optional[Location]]]

primary_email: Optional[str]
"""The email of the main administrator on the account."""
Expand Down
12 changes: 7 additions & 5 deletions src/finch/types/hris/company_benefit.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,23 @@
from typing import Optional

from ..._models import BaseModel
from ...types.hris import benefit_type, benefit_frequency, benfit_contribution
from .benefit_type import BenefitType
from .benefit_frequency import BenefitFrequency
from .benfit_contribution import BenfitContribution

__all__ = ["CompanyBenefit"]


class CompanyBenefit(BaseModel):
benefit_id: str

company_contribution: Optional[benfit_contribution.BenfitContribution]
company_contribution: Optional[BenfitContribution]

description: Optional[str]

employee_deduction: Optional[benfit_contribution.BenfitContribution]
employee_deduction: Optional[BenfitContribution]

frequency: Optional[benefit_frequency.BenefitFrequency]
frequency: Optional[BenefitFrequency]

type: Optional[benefit_type.BenefitType]
type: Optional[BenefitType]
"""Type of benefit."""
4 changes: 2 additions & 2 deletions src/finch/types/hris/individual.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
from typing import List, Optional
from typing_extensions import Literal

from ...types import location
from ..._models import BaseModel
from ..location import Location

__all__ = ["Individual", "Email", "PhoneNumber"]

Expand Down Expand Up @@ -46,7 +46,7 @@ class Individual(BaseModel):
preferred_name: Optional[str]
"""The preferred name of the individual."""

residence: Optional[location.Location]
residence: Optional[Location]

ssn: Optional[str]
"""Note: This property is only available if enabled for your account.
Expand Down
4 changes: 2 additions & 2 deletions src/finch/types/hris/individual_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
from typing import Optional

from ..._models import BaseModel
from ...types.hris import individual
from .individual import Individual

__all__ = ["IndividualResponse"]


class IndividualResponse(BaseModel):
body: Optional[individual.Individual]
body: Optional[Individual]

code: Optional[int]

Expand Down
9 changes: 5 additions & 4 deletions src/finch/types/hris/individuals/employment_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@

from pydantic import Field as FieldInfo

from ....types import income, location
from ...income import Income
from ...._models import BaseModel
from ...location import Location

__all__ = ["EmploymentData", "Department", "Employment", "Manager"]

Expand Down Expand Up @@ -51,10 +52,10 @@ class EmploymentData(BaseModel):
first_name: Optional[str]
"""The legal first name of the individual."""

income_history: Optional[List[Optional[income.Income]]]
income_history: Optional[List[Optional[Income]]]
"""The array of income history."""

income: Optional[income.Income]
income: Optional[Income]
"""The employee's income as reported by the provider.

This may not always be annualized income, but may be in units of bi-weekly,
Expand All @@ -67,7 +68,7 @@ class EmploymentData(BaseModel):
last_name: Optional[str]
"""The legal last name of the individual."""

location: Optional[location.Location]
location: Optional[Location]

manager: Optional[Manager]
"""The manager object representing the manager of the individual within the org."""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
from typing import Optional

from ...._models import BaseModel
from ....types.hris.individuals import employment_data
from .employment_data import EmploymentData

__all__ = ["EmploymentDataResponse"]


class EmploymentDataResponse(BaseModel):
body: Optional[employment_data.EmploymentData]
body: Optional[EmploymentData]

code: Optional[int]

Expand Down
12 changes: 6 additions & 6 deletions src/finch/types/hris/pay_statement.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
from typing import List, Optional
from typing_extensions import Literal

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

__all__ = ["PayStatement", "Earning", "EmployeeDeduction", "EmployerContribution", "Tax"]

Expand Down Expand Up @@ -60,7 +60,7 @@ class EmployeeDeduction(BaseModel):
pre_tax: Optional[bool]
"""Boolean indicating if the deduction is pre-tax."""

type: Optional[benefit_type.BenefitType]
type: Optional[BenefitType]
"""Type of benefit."""


Expand All @@ -74,7 +74,7 @@ class EmployerContribution(BaseModel):
name: Optional[str]
"""The contribution name from the pay statement."""

type: Optional[benefit_type.BenefitType]
type: Optional[BenefitType]
"""Type of benefit."""


Expand Down Expand Up @@ -104,12 +104,12 @@ class PayStatement(BaseModel):

employer_contributions: Optional[List[Optional[EmployerContribution]]]

gross_pay: Optional[money.Money]
gross_pay: Optional[Money]

individual_id: Optional[str]
"""A stable Finch `id` (UUID v4) for an individual in the company"""

net_pay: Optional[money.Money]
net_pay: Optional[Money]

payment_method: Optional[Literal["check", "direct_deposit"]]
"""The payment method."""
Expand Down
4 changes: 2 additions & 2 deletions src/finch/types/hris/pay_statement_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
from typing import Optional

from ..._models import BaseModel
from ...types.hris import pay_statement_response_body
from .pay_statement_response_body import PayStatementResponseBody

__all__ = ["PayStatementResponse"]


class PayStatementResponse(BaseModel):
body: Optional[pay_statement_response_body.PayStatementResponseBody]
body: Optional[PayStatementResponseBody]

code: Optional[int]

Expand Down
8 changes: 4 additions & 4 deletions src/finch/types/hris/pay_statement_response_body.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

from typing import List, Optional

from ...types import paging
from ..paging import Paging
from ..._models import BaseModel
from ...types.hris import pay_statement
from .pay_statement import PayStatement

__all__ = ["PayStatementResponseBody"]


class PayStatementResponseBody(BaseModel):
paging: Optional[paging.Paging]
paging: Optional[Paging]

pay_statements: Optional[List[pay_statement.PayStatement]]
pay_statements: Optional[List[PayStatement]]
"""The array of pay statements for the current payment."""
12 changes: 6 additions & 6 deletions src/finch/types/hris/payment.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from typing import List, Optional

from ...types import money
from ..money import Money
from ..._models import BaseModel

__all__ = ["Payment", "PayPeriod"]
Expand All @@ -18,20 +18,20 @@ class Payment(BaseModel):
id: Optional[str]
"""The unique id for the payment."""

company_debit: Optional[money.Money]
company_debit: Optional[Money]

debit_date: Optional[str]

employee_taxes: Optional[money.Money]
employee_taxes: Optional[Money]

employer_taxes: Optional[money.Money]
employer_taxes: Optional[Money]

gross_pay: Optional[money.Money]
gross_pay: Optional[Money]

individual_ids: Optional[List[str]]
"""Array of every individual on this payment."""

net_pay: Optional[money.Money]
net_pay: Optional[Money]

pay_date: Optional[str]

Expand Down
4 changes: 2 additions & 2 deletions src/finch/types/hris/supported_benefit.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from typing_extensions import Literal

from ..._models import BaseModel
from ...types.hris import benefit_type
from .benefit_type import BenefitType

__all__ = ["SupportedBenefit"]

Expand Down Expand Up @@ -43,5 +43,5 @@ class SupportedBenefit(BaseModel):
values for HSA benefits.
"""

type: Optional[benefit_type.BenefitType]
type: Optional[BenefitType]
"""Type of benefit."""
7 changes: 5 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import asyncio
from typing import Iterator

import pytest

pytest.register_assert_rewrite("tests.utils")


@pytest.fixture(scope="session")
def event_loop() -> asyncio.AbstractEventLoop:
return asyncio.new_event_loop()
def event_loop() -> Iterator[asyncio.AbstractEventLoop]:
loop = asyncio.new_event_loop()
yield loop
loop.close()