Skip to content

release: 0.20.3 #360

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 11 commits into from
May 1, 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
22 changes: 21 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,25 @@ jobs:
- name: Ensure importable
run: |
rye run python -c 'import finch'
test:
name: test
runs-on: ubuntu-latest
if: github.repository == 'Finch-API/finch-api-python'

steps:
- uses: actions/checkout@v4

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

- name: Bootstrap
run: ./scripts/bootstrap

- name: Run tests
run: ./scripts/test


2 changes: 1 addition & 1 deletion .github/workflows/publish-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Install Rye
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-doctor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
if: github.repository == 'Finch-API/finch-api-python' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next')

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Check release environment
run: |
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ dist
.env
.envrc
codegen.log
Brewfile.lock.json
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.20.2"
".": "0.20.3"
}
1 change: 1 addition & 0 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
configured_endpoints: 35
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch-a14d8915465614a275f05ccb91513576fab0525b488cb878dbe3d692f5b2349f.yml
2 changes: 2 additions & 0 deletions Brewfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
brew "rye"

25 changes: 25 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,30 @@
# Changelog

## 0.20.3 (2024-05-01)

Full Changelog: [v0.20.2...v0.20.3](https://github.com/Finch-API/finch-api-python/compare/v0.20.2...v0.20.3)

### Bug Fixes

* **docs:** doc improvements ([#359](https://github.com/Finch-API/finch-api-python/issues/359)) ([5fe6e56](https://github.com/Finch-API/finch-api-python/commit/5fe6e56f670aa7e528171f567fbf8e6c2aa6a7e5))


### Chores

* **client:** log response headers in debug mode ([#366](https://github.com/Finch-API/finch-api-python/issues/366)) ([5dcc0e5](https://github.com/Finch-API/finch-api-python/commit/5dcc0e5d62b6f334ca73c401dd4ce5e21dcb2d96))
* **internal:** add link to openapi spec ([#367](https://github.com/Finch-API/finch-api-python/issues/367)) ([378727a](https://github.com/Finch-API/finch-api-python/commit/378727a8d21c89384d82a99dfcf64ac0091fcd84))
* **internal:** add scripts/test, scripts/mock and add ci job ([#368](https://github.com/Finch-API/finch-api-python/issues/368)) ([ff132d5](https://github.com/Finch-API/finch-api-python/commit/ff132d5dca28c4910c6eaa9f6484d93b770bbffd))
* **internal:** bump mock server version to ~5.8.0 ([#369](https://github.com/Finch-API/finch-api-python/issues/369)) ([ad0b12e](https://github.com/Finch-API/finch-api-python/commit/ad0b12e37c5c05876cae92cf474a5fd70ad52689))
* **internal:** minor reformatting ([#365](https://github.com/Finch-API/finch-api-python/issues/365)) ([a7253ed](https://github.com/Finch-API/finch-api-python/commit/a7253edc76bad52f14d2c1f0fb876077b30128a9))
* **internal:** reformat imports ([#364](https://github.com/Finch-API/finch-api-python/issues/364)) ([62a5f98](https://github.com/Finch-API/finch-api-python/commit/62a5f983d0b099535ba06cb9f1ee2a9490d98314))
* **internal:** update test helper function ([#362](https://github.com/Finch-API/finch-api-python/issues/362)) ([5f9f330](https://github.com/Finch-API/finch-api-python/commit/5f9f330d00a95e390aa1f327afad354d97f0c52d))
* **internal:** use actions/checkout@v4 for codeflow ([#361](https://github.com/Finch-API/finch-api-python/issues/361)) ([278962a](https://github.com/Finch-API/finch-api-python/commit/278962a5e7a278b46c309fbc3a003568d7938ab6))


### Documentation

* clarify behavior around employee_size ([#363](https://github.com/Finch-API/finch-api-python/issues/363)) ([f10523a](https://github.com/Finch-API/finch-api-python/commit/f10523a9fd09d306bc8405eea73311da8a9d8a3e))

## 0.20.2 (2024-04-23)

Full Changelog: [v0.20.1...v0.20.2](https://github.com/Finch-API/finch-api-python/compare/v0.20.1...v0.20.2)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ The context manager is required so that the response will reliably be closed.

### Making custom/undocumented requests

This library is typed for convenient access the documented API.
This library is typed for convenient access to the documented API.

If you need to access undocumented endpoints, params, or response properties, the library can still be used.

Expand Down
40 changes: 0 additions & 40 deletions bin/check-env-state.py

This file was deleted.

50 changes: 0 additions & 50 deletions bin/check-test-server

This file was deleted.

3 changes: 0 additions & 3 deletions bin/test

This file was deleted.

5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "finch-api"
version = "0.20.2"
version = "0.20.3"
description = "The official Python library for the Finch API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down Expand Up @@ -68,7 +68,7 @@ format = { chain = [
"fix:ruff",
]}
"format:black" = "black ."
"format:docs" = "python bin/ruffen-docs.py README.md api.md"
"format:docs" = "python scripts/utils/ruffen-docs.py README.md api.md"
"format:ruff" = "ruff format"
"format:isort" = "isort ."

Expand Down Expand Up @@ -191,5 +191,6 @@ known-first-party = ["finch", "tests"]

[tool.ruff.per-file-ignores]
"bin/**.py" = ["T201", "T203"]
"scripts/**.py" = ["T201", "T203"]
"tests/**.py" = ["T201", "T203"]
"examples/**.py" = ["T201", "T203"]
19 changes: 19 additions & 0 deletions scripts/bootstrap
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash

set -e

cd "$(dirname "$0")/.."

if [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ]; then
brew bundle check >/dev/null 2>&1 || {
echo "==> Installing Homebrew dependencies…"
brew bundle
}
fi

echo "==> Installing Python dependencies…"

# experimental uv support makes installations significantly faster
rye config --set-bool behavior.use-uv=true

rye sync
8 changes: 8 additions & 0 deletions scripts/format
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash

set -e

cd "$(dirname "$0")/.."

rye run format

8 changes: 8 additions & 0 deletions scripts/lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash

set -e

cd "$(dirname "$0")/.."

rye run lint

41 changes: 41 additions & 0 deletions scripts/mock
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/usr/bin/env bash

set -e

cd "$(dirname "$0")/.."

if [[ -n "$1" && "$1" != '--'* ]]; then
URL="$1"
shift
else
URL="$(grep 'openapi_spec_url' .stats.yml | cut -d' ' -f2)"
fi

# Check if the URL is empty
if [ -z "$URL" ]; then
echo "Error: No OpenAPI spec path/url provided or found in .stats.yml"
exit 1
fi

echo "==> Starting mock server with URL ${URL}"

# Run prism mock on the given spec
if [ "$1" == "--daemon" ]; then
npm exec --package=@stoplight/prism-cli@~5.8 -- prism mock "$URL" &> .prism.log &

# Wait for server to come online
echo -n "Waiting for server"
while ! grep -q "✖ fatal\|Prism is listening" ".prism.log" ; do
echo -n "."
sleep 0.1
done

if grep -q "✖ fatal" ".prism.log"; then
cat .prism.log
exit 1
fi

echo
else
npm exec --package=@stoplight/prism-cli@~5.8 -- prism mock "$URL"
fi
57 changes: 57 additions & 0 deletions scripts/test
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/usr/bin/env bash

set -e

cd "$(dirname "$0")/.."

RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
NC='\033[0m' # No Color

function prism_is_running() {
curl --silent "http://localhost:4010" >/dev/null 2>&1
}

kill_server_on_port() {
pids=$(lsof -t -i tcp:"$1" || echo "")
if [ "$pids" != "" ]; then
kill "$pids"
echo "Stopped $pids."
fi
}

function is_overriding_api_base_url() {
[ -n "$TEST_API_BASE_URL" ]
}

if ! is_overriding_api_base_url && ! prism_is_running ; then
# When we exit this script, make sure to kill the background mock server process
trap 'kill_server_on_port 4010' EXIT

# Start the dev server
./scripts/mock --daemon
fi

if is_overriding_api_base_url ; then
echo -e "${GREEN}✔ Running tests against ${TEST_API_BASE_URL}${NC}"
echo
elif ! prism_is_running ; then
echo -e "${RED}ERROR:${NC} The test suite will not run without a mock Prism server"
echo -e "running against your OpenAPI spec."
echo
echo -e "To run the server, pass in the path or url of your OpenAPI"
echo -e "spec to the prism command:"
echo
echo -e " \$ ${YELLOW}npm exec --package=@stoplight/prism-cli@~5.3.2 -- prism mock path/to/your.openapi.yml${NC}"
echo

exit 1
else
echo -e "${GREEN}✔ Mock prism server is running with your OpenAPI spec${NC}"
echo
fi

# Run tests
echo "==> Running tests"
rye run pytest "$@"
File renamed without changes.
9 changes: 8 additions & 1 deletion src/finch/_base_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -946,6 +946,8 @@ def _request(
if self.custom_auth is not None:
kwargs["auth"] = self.custom_auth

log.debug("Sending HTTP Request: %s %s", request.method, request.url)

try:
response = self._client.send(
request,
Expand Down Expand Up @@ -984,7 +986,12 @@ def _request(
raise APIConnectionError(request=request) from err

log.debug(
'HTTP Request: %s %s "%i %s"', request.method, request.url, response.status_code, response.reason_phrase
'HTTP Response: %s %s "%i %s" %s',
request.method,
request.url,
response.status_code,
response.reason_phrase,
response.headers,
)

try:
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__ = "0.20.2" # x-release-please-version
__version__ = "0.20.3" # x-release-please-version
Loading