From 6465256a5ea41a1d06645fb129fe03237a503ca6 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 23 Nov 2024 03:20:03 +0000 Subject: [PATCH 1/3] chore(internal): fix compat model_dump method when warnings are passed (#525) --- src/finch/_compat.py | 3 ++- tests/test_models.py | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/finch/_compat.py b/src/finch/_compat.py index 4794129c..df173f85 100644 --- a/src/finch/_compat.py +++ b/src/finch/_compat.py @@ -145,7 +145,8 @@ def model_dump( exclude=exclude, exclude_unset=exclude_unset, exclude_defaults=exclude_defaults, - warnings=warnings, + # warnings are not supported in Pydantic v1 + warnings=warnings if PYDANTIC_V2 else True, ) return cast( "dict[str, Any]", diff --git a/tests/test_models.py b/tests/test_models.py index d43cfa6c..faebc131 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -561,6 +561,14 @@ class Model(BaseModel): m.model_dump(warnings=False) +def test_compat_method_no_error_for_warnings() -> None: + class Model(BaseModel): + foo: Optional[str] + + m = Model(foo="hello") + assert isinstance(model_dump(m, warnings=False), dict) + + def test_to_json() -> None: class Model(BaseModel): foo: Optional[str] = Field(alias="FOO", default=None) From 28ca9f0f4ff5d727e7dbdd1affb6d65a3cf5c030 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 23 Nov 2024 03:21:44 +0000 Subject: [PATCH 2/3] docs: add info log level to readme (#527) --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f2f135ee..1a97f28b 100644 --- a/README.md +++ b/README.md @@ -278,12 +278,14 @@ client = Finch( We use the standard library [`logging`](https://docs.python.org/3/library/logging.html) module. -You can enable logging by setting the environment variable `FINCH_LOG` to `debug`. +You can enable logging by setting the environment variable `FINCH_LOG` to `info`. ```shell -$ export FINCH_LOG=debug +$ export FINCH_LOG=info ``` +Or to `debug` for more verbose logging. + ### How to tell whether `None` means `null` or missing In an API response, a field may be explicitly `null`, or missing entirely; in either case, its value is `None` in this library. You can differentiate the two cases with `.model_fields_set`: From fff8286b59b335a67ce31c97a3c7d6d0889ccc44 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 23 Nov 2024 03:22:04 +0000 Subject: [PATCH 3/3] release: 1.10.1 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 13 +++++++++++++ pyproject.toml | 2 +- src/finch/_version.py | 2 +- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index eb4e0dba..e8fdcd65 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.10.0" + ".": "1.10.1" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index d6a68516..82bb20f5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Changelog +## 1.10.1 (2024-11-23) + +Full Changelog: [v1.10.0...v1.10.1](https://github.com/Finch-API/finch-api-python/compare/v1.10.0...v1.10.1) + +### Chores + +* **internal:** fix compat model_dump method when warnings are passed ([#525](https://github.com/Finch-API/finch-api-python/issues/525)) ([6465256](https://github.com/Finch-API/finch-api-python/commit/6465256a5ea41a1d06645fb129fe03237a503ca6)) + + +### Documentation + +* add info log level to readme ([#527](https://github.com/Finch-API/finch-api-python/issues/527)) ([28ca9f0](https://github.com/Finch-API/finch-api-python/commit/28ca9f0f4ff5d727e7dbdd1affb6d65a3cf5c030)) + ## 1.10.0 (2024-11-19) Full Changelog: [v1.9.0...v1.10.0](https://github.com/Finch-API/finch-api-python/compare/v1.9.0...v1.10.0) diff --git a/pyproject.toml b/pyproject.toml index db73455f..d1aed4ba 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "finch-api" -version = "1.10.0" +version = "1.10.1" description = "The official Python library for the Finch API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/finch/_version.py b/src/finch/_version.py index a5e26d91..2561cdaf 100644 --- a/src/finch/_version.py +++ b/src/finch/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "finch" -__version__ = "1.10.0" # x-release-please-version +__version__ = "1.10.1" # x-release-please-version