Skip to content

release: 0.3.0 #155

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 8 commits into from
Oct 27, 2023
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
41 changes: 41 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
lint:
name: lint
runs-on: ubuntu-latest
if: github.repository == 'Finch-API/finch-api-python'

steps:
- uses: actions/checkout@v3

- name: Install Rye
run: |
curl -sSf https://rye-up.com/get | bash
echo "$HOME/.rye/shims" >> $GITHUB_PATH
env:
RYE_VERSION: 0.15.2
RYE_INSTALL_OPTION: "--yes"

- name: Install dependencies
run: |
rye sync --all-features

- name: Run ruff
run: |
rye run check:ruff

- name: Run type checking
run: |
rye run typecheck

- name: Ensure importable
run: |
rye run python -c 'import finch'
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.9.18
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.2.3"
".": "0.3.0"
}
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
# Changelog

## 0.3.0 (2023-10-27)

Full Changelog: [v0.2.3...v0.3.0](https://github.com/finch-api/finch-api-python/compare/v0.2.3...v0.3.0)

### Features

* **client:** adjust retry behavior to be exponential backoff ([#149](https://github.com/finch-api/finch-api-python/issues/149)) ([6c76643](https://github.com/finch-api/finch-api-python/commit/6c766434ba25b5684c41261dfd68355ea9c347ad))
* **client:** improve file upload types ([#148](https://github.com/finch-api/finch-api-python/issues/148)) ([7f9db48](https://github.com/finch-api/finch-api-python/commit/7f9db48ced6c9914cc65ad6e071f3e10ec02885c))
* **client:** support accessing raw response objects ([#154](https://github.com/finch-api/finch-api-python/issues/154)) ([10638eb](https://github.com/finch-api/finch-api-python/commit/10638eb2689ce1a4a522c989df8a9a474e0590f8))


### Chores

* **internal:** require explicit overrides ([#153](https://github.com/finch-api/finch-api-python/issues/153)) ([9ffdf66](https://github.com/finch-api/finch-api-python/commit/9ffdf669051d12e34078205d49d12b7c55909611))


### Documentation

* improve to dictionary example ([#151](https://github.com/finch-api/finch-api-python/issues/151)) ([098d453](https://github.com/finch-api/finch-api-python/commit/098d453e1f1170d14362090500c460fba36d70e9))

## 0.2.3 (2023-10-20)

Full Changelog: [v0.2.2...v0.2.3](https://github.com/Finch-API/finch-api-python/compare/v0.2.2...v0.2.3)
Expand Down
21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Functionality between the synchronous and asynchronous clients is otherwise iden

## Using types

Nested request parameters are [TypedDicts](https://docs.python.org/3/library/typing.html#typing.TypedDict). Responses are [Pydantic models](https://docs.pydantic.dev), which provide helper methods for things like serializing back into JSON ([v1](https://docs.pydantic.dev/1.10/usage/models/), [v2](https://docs.pydantic.dev/latest/usage/serialization/)). To get a dictionary, call `dict(model)`.
Nested request parameters are [TypedDicts](https://docs.python.org/3/library/typing.html#typing.TypedDict). Responses are [Pydantic models](https://docs.pydantic.dev), which provide helper methods for things like serializing back into JSON ([v1](https://docs.pydantic.dev/1.10/usage/models/), [v2](https://docs.pydantic.dev/latest/usage/serialization/)). To get a dictionary, call `model.model_dump()`.

Typed requests and responses provide autocomplete and documentation within your editor. If you would like to see type errors in VS Code to help catch bugs earlier, set `python.analysis.typeCheckingMode` to `basic`.

Expand Down Expand Up @@ -296,6 +296,25 @@ if response.my_field is None:
print('Got json like {"my_field": null}.')
```

### Accessing raw response data (e.g. headers)

The "raw" Response object can be accessed by prefixing `.with_raw_response.` to any HTTP method call.

```py
from finch import Finch

client = Finch()
page = client.hris.directory.with_raw_response.list()
response = page.individuals[0]

print(response.headers.get('X-My-Header'))

directory = response.parse() # get the object that `hris.directory.list()` would have returned
print(directory.first_name)
```

These methods return an [`APIResponse`](https://github.com/Finch-API/finch-api-python/src/finch/_response.py) object.

### Configuring the HTTP client

You can directly override the [httpx client](https://www.python-httpx.org/api/#client) to customize it for your use case, including:
Expand Down
6 changes: 5 additions & 1 deletion mypy.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
[mypy]
pretty = True
show_error_codes = True
exclude = _dev

# Exclude _files.py because mypy isn't smart enough to apply
# the correct type narrowing and as this is an internal module
# it's fine to just use Pyright.
exclude = ^(src/finch/_files\.py|_dev/.*\.py)$

strict_equality = True
implicit_reexport = True
Expand Down
16 changes: 15 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "finch-api"
version = "0.2.3"
version = "0.3.0"
description = "Client library for the Finch API"
readme = "README.md"
license = "Apache-2.0"
Expand Down Expand Up @@ -38,6 +38,7 @@ dev-dependencies = [
"isort==5.10.1",
"time-machine==2.9.0",
"nox==2023.4.22",
"dirty-equals>=0.6.0",

]

Expand All @@ -53,6 +54,16 @@ format = { chain = [
"format:ruff" = "ruff --fix ."
"format:isort" = "isort ."

"check:ruff" = "ruff ."

typecheck = { chain = [
"typecheck:pyright",
"typecheck:mypy"
]}
"typecheck:pyright" = "pyright"
"typecheck:verify-types" = "pyright --verifytypes finch --ignoreexternal"
"typecheck:mypy" = "mypy --enable-incomplete-feature=Unpack ."

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
Expand Down Expand Up @@ -90,6 +101,9 @@ exclude = [
".venv",
".nox",
]

reportImplicitOverride = true

reportImportCycles = false
reportPrivateUsage = false

Expand Down
1 change: 1 addition & 0 deletions requirements-dev.lock
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ black==23.3.0
certifi==2023.7.22
click==8.1.7
colorlog==6.7.0
dirty-equals==0.6.0
distlib==0.3.7
distro==1.8.0
exceptiongroup==1.1.3
Expand Down
Loading