diff --git a/.release-please-manifest.json b/.release-please-manifest.json index d16cffca..45e748c6 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.21.4" + ".": "0.21.5" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 3feb9fd4..65dda387 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +## 0.21.5 (2024-06-28) + +Full Changelog: [v0.21.4...v0.21.5](https://github.com/Finch-API/finch-api-python/compare/v0.21.4...v0.21.5) + +### Bug Fixes + +* **build:** include more files in sdist builds ([#409](https://github.com/Finch-API/finch-api-python/issues/409)) ([1508b49](https://github.com/Finch-API/finch-api-python/commit/1508b49756620d8fda71886beb750bc0bdc05d89)) + + +### Chores + +* **deps:** bump anyio to v4.4.0 ([#411](https://github.com/Finch-API/finch-api-python/issues/411)) ([45c5047](https://github.com/Finch-API/finch-api-python/commit/45c50471351af8213f414d60c269fbf3e2b4e4bd)) +* **internal:** add reflection helper function ([#412](https://github.com/Finch-API/finch-api-python/issues/412)) ([1e84873](https://github.com/Finch-API/finch-api-python/commit/1e848737d7505b57702604b8e95c3a8c85c75bc9)) + ## 0.21.4 (2024-06-26) Full Changelog: [v0.21.3...v0.21.4](https://github.com/Finch-API/finch-api-python/compare/v0.21.3...v0.21.4) diff --git a/pyproject.toml b/pyproject.toml index 70174cd2..47cc7b24 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "finch-api" -version = "0.21.4" +version = "0.21.5" description = "The official Python library for the Finch API" dynamic = ["readme"] license = "Apache-2.0" @@ -99,6 +99,21 @@ include = [ [tool.hatch.build.targets.wheel] packages = ["src/finch"] +[tool.hatch.build.targets.sdist] +# Basically everything except hidden files/directories (such as .github, .devcontainers, .python-version, etc) +include = [ + "/*.toml", + "/*.json", + "/*.lock", + "/*.md", + "/mypy.ini", + "/noxfile.py", + "bin/*", + "examples/*", + "src/*", + "tests/*", +] + [tool.hatch.metadata.hooks.fancy-pypi-readme] content-type = "text/markdown" diff --git a/requirements-dev.lock b/requirements-dev.lock index 08bf0559..1d784324 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -10,7 +10,7 @@ -e file:. annotated-types==0.6.0 # via pydantic -anyio==4.1.0 +anyio==4.4.0 # via finch-api # via httpx argcomplete==3.1.2 @@ -86,6 +86,7 @@ tomli==2.0.1 # via mypy # via pytest typing-extensions==4.8.0 + # via anyio # via finch-api # via mypy # via pydantic diff --git a/requirements.lock b/requirements.lock index ca7f06dd..22018417 100644 --- a/requirements.lock +++ b/requirements.lock @@ -10,7 +10,7 @@ -e file:. annotated-types==0.6.0 # via pydantic -anyio==4.1.0 +anyio==4.4.0 # via finch-api # via httpx certifi==2023.7.22 @@ -38,6 +38,7 @@ sniffio==1.3.0 # via finch-api # via httpx typing-extensions==4.8.0 + # via anyio # via finch-api # via pydantic # via pydantic-core diff --git a/src/finch/_utils/__init__.py b/src/finch/_utils/__init__.py index 667e2473..3efe66c8 100644 --- a/src/finch/_utils/__init__.py +++ b/src/finch/_utils/__init__.py @@ -49,4 +49,7 @@ maybe_transform as maybe_transform, async_maybe_transform as async_maybe_transform, ) -from ._reflection import function_has_argument as function_has_argument +from ._reflection import ( + function_has_argument as function_has_argument, + assert_signatures_in_sync as assert_signatures_in_sync, +) diff --git a/src/finch/_utils/_reflection.py b/src/finch/_utils/_reflection.py index e134f58e..9a53c7bd 100644 --- a/src/finch/_utils/_reflection.py +++ b/src/finch/_utils/_reflection.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import inspect from typing import Any, Callable @@ -6,3 +8,35 @@ def function_has_argument(func: Callable[..., Any], arg_name: str) -> bool: """Returns whether or not the given function has a specific parameter""" sig = inspect.signature(func) return arg_name in sig.parameters + + +def assert_signatures_in_sync( + source_func: Callable[..., Any], + check_func: Callable[..., Any], + *, + exclude_params: set[str] = set(), +) -> None: + """Ensure that the signature of the second function matches the first.""" + + check_sig = inspect.signature(check_func) + source_sig = inspect.signature(source_func) + + errors: list[str] = [] + + for name, source_param in source_sig.parameters.items(): + if name in exclude_params: + continue + + custom_param = check_sig.parameters.get(name) + if not custom_param: + errors.append(f"the `{name}` param is missing") + continue + + if custom_param.annotation != source_param.annotation: + errors.append( + f"types for the `{name}` param are do not match; source={repr(source_param.annotation)} checking={repr(source_param.annotation)}" + ) + continue + + if errors: + raise AssertionError(f"{len(errors)} errors encountered when comparing signatures:\n\n" + "\n\n".join(errors)) diff --git a/src/finch/_version.py b/src/finch/_version.py index b2617b10..da53b920 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__ = "0.21.4" # x-release-please-version +__version__ = "0.21.5" # x-release-please-version