diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 684b8710..ef7a1f97 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.165.0" + ".": "0.165.1" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index e465c908..35e4ffc1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,25 @@ # Changelog +## 0.165.1 (2024-11-28) + +Full Changelog: [v0.165.0...v0.165.1](https://github.com/Increase/increase-python/compare/v0.165.0...v0.165.1) + +### Bug Fixes + +* **client:** compat with new httpx 0.28.0 release ([#852](https://github.com/Increase/increase-python/issues/852)) ([28d4060](https://github.com/Increase/increase-python/commit/28d40602c4ee66322c57d44422514e113b86be10)) + + +### Chores + +* **internal:** codegen related update ([#851](https://github.com/Increase/increase-python/issues/851)) ([8613769](https://github.com/Increase/increase-python/commit/86137695ae922047e266fc8e4250354f1d9af9c5)) +* **internal:** fix compat model_dump method when warnings are passed ([#847](https://github.com/Increase/increase-python/issues/847)) ([c3addcd](https://github.com/Increase/increase-python/commit/c3addcd6b36e6420247c985a65edbb91b863bd5b)) +* remove now unused `cached-property` dep ([#850](https://github.com/Increase/increase-python/issues/850)) ([8bb79b8](https://github.com/Increase/increase-python/commit/8bb79b8606840f609a6b86fe3442802ab398c4d8)) + + +### Documentation + +* add info log level to readme ([#849](https://github.com/Increase/increase-python/issues/849)) ([3f7c52a](https://github.com/Increase/increase-python/commit/3f7c52a47537d6b750d373fa1d8c604526458d1e)) + ## 0.165.0 (2024-11-22) Full Changelog: [v0.164.0...v0.165.0](https://github.com/Increase/increase-python/compare/v0.164.0...v0.165.0) diff --git a/README.md b/README.md index f845add0..064156d1 100644 --- a/README.md +++ b/README.md @@ -284,12 +284,14 @@ Note that requests that time out are [retried twice by default](#retries). We use the standard library [`logging`](https://docs.python.org/3/library/logging.html) module. -You can enable logging by setting the environment variable `INCREASE_LOG` to `debug`. +You can enable logging by setting the environment variable `INCREASE_LOG` to `info`. ```shell -$ export INCREASE_LOG=debug +$ export INCREASE_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`: diff --git a/mypy.ini b/mypy.ini index f3e97c62..42fb84c2 100644 --- a/mypy.ini +++ b/mypy.ini @@ -5,7 +5,10 @@ show_error_codes = True # 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/increase/_files\.py|_dev/.*\.py)$ +# +# We also exclude our `tests` as mypy doesn't always infer +# types correctly and Pyright will still catch any type errors. +exclude = ^(src/increase/_files\.py|_dev/.*\.py|tests/.*)$ strict_equality = True implicit_reexport = True diff --git a/pyproject.toml b/pyproject.toml index 3735a7f8..1eb95e68 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "increase" -version = "0.165.0" +version = "0.165.1" description = "The official Python library for the increase API" dynamic = ["readme"] license = "Apache-2.0" @@ -14,7 +14,6 @@ dependencies = [ "anyio>=3.5.0, <5", "distro>=1.7.0, <2", "sniffio", - "cached-property; python_version < '3.8'", ] requires-python = ">= 3.8" classifiers = [ diff --git a/src/increase/_base_client.py b/src/increase/_base_client.py index 92681ce9..5d09af06 100644 --- a/src/increase/_base_client.py +++ b/src/increase/_base_client.py @@ -792,6 +792,7 @@ def __init__( custom_query: Mapping[str, object] | None = None, _strict_response_validation: bool, ) -> None: + kwargs: dict[str, Any] = {} if limits is not None: warnings.warn( "The `connection_pool_limits` argument is deprecated. The `http_client` argument should be passed instead", @@ -804,6 +805,7 @@ def __init__( limits = DEFAULT_CONNECTION_LIMITS if transport is not None: + kwargs["transport"] = transport warnings.warn( "The `transport` argument is deprecated. The `http_client` argument should be passed instead", category=DeprecationWarning, @@ -813,6 +815,7 @@ def __init__( raise ValueError("The `http_client` argument is mutually exclusive with `transport`") if proxies is not None: + kwargs["proxies"] = proxies warnings.warn( "The `proxies` argument is deprecated. The `http_client` argument should be passed instead", category=DeprecationWarning, @@ -856,10 +859,9 @@ def __init__( base_url=base_url, # cast to a valid type because mypy doesn't understand our type narrowing timeout=cast(Timeout, timeout), - proxies=proxies, - transport=transport, limits=limits, follow_redirects=True, + **kwargs, # type: ignore ) def is_closed(self) -> bool: @@ -1358,6 +1360,7 @@ def __init__( custom_headers: Mapping[str, str] | None = None, custom_query: Mapping[str, object] | None = None, ) -> None: + kwargs: dict[str, Any] = {} if limits is not None: warnings.warn( "The `connection_pool_limits` argument is deprecated. The `http_client` argument should be passed instead", @@ -1370,6 +1373,7 @@ def __init__( limits = DEFAULT_CONNECTION_LIMITS if transport is not None: + kwargs["transport"] = transport warnings.warn( "The `transport` argument is deprecated. The `http_client` argument should be passed instead", category=DeprecationWarning, @@ -1379,6 +1383,7 @@ def __init__( raise ValueError("The `http_client` argument is mutually exclusive with `transport`") if proxies is not None: + kwargs["proxies"] = proxies warnings.warn( "The `proxies` argument is deprecated. The `http_client` argument should be passed instead", category=DeprecationWarning, @@ -1422,10 +1427,9 @@ def __init__( base_url=base_url, # cast to a valid type because mypy doesn't understand our type narrowing timeout=cast(Timeout, timeout), - proxies=proxies, - transport=transport, limits=limits, follow_redirects=True, + **kwargs, # type: ignore ) def is_closed(self) -> bool: diff --git a/src/increase/_compat.py b/src/increase/_compat.py index 4794129c..92d9ee61 100644 --- a/src/increase/_compat.py +++ b/src/increase/_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]", @@ -213,9 +214,6 @@ def __set_name__(self, owner: type[Any], name: str) -> None: ... # __set__ is not defined at runtime, but @cached_property is designed to be settable def __set__(self, instance: object, value: _T) -> None: ... else: - try: - from functools import cached_property as cached_property - except ImportError: - from cached_property import cached_property as cached_property + from functools import cached_property as cached_property typed_cached_property = cached_property diff --git a/src/increase/_version.py b/src/increase/_version.py index a36f1dc6..4e2aeb6c 100644 --- a/src/increase/_version.py +++ b/src/increase/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "increase" -__version__ = "0.165.0" # x-release-please-version +__version__ = "0.165.1" # x-release-please-version diff --git a/tests/test_models.py b/tests/test_models.py index adbf5f93..5d2ac4e1 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)