Skip to content

Commit

Permalink
Merge pull request #122 from writer/release-please--branches--main--c…
Browse files Browse the repository at this point in the history
…hanges--next

release: 1.5.0
  • Loading branch information
ramedina86 authored Nov 29, 2024
2 parents f1b91ed + 265c21b commit 99318d9
Show file tree
Hide file tree
Showing 9 changed files with 56 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "1.4.0"
".": "1.5.0"
}
26 changes: 26 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,31 @@
# Changelog

## 1.5.0 (2024-11-28)

Full Changelog: [v1.4.0...v1.5.0](https://github.com/writer/writer-python/compare/v1.4.0...v1.5.0)

### Features

* **api:** manual updates ([#127](https://github.com/writer/writer-python/issues/127)) ([ae6716d](https://github.com/writer/writer-python/commit/ae6716d8b2345d493ff342cb31adb02e85d7c2a8))


### Bug Fixes

* **client:** compat with new httpx 0.28.0 release ([#126](https://github.com/writer/writer-python/issues/126)) ([4c04e11](https://github.com/writer/writer-python/commit/4c04e11248fac6aa0cabb94ea4abcc78252077d5))


### Chores

* fix formatting ([c33a293](https://github.com/writer/writer-python/commit/c33a2932a49d4d51ad81045ba312162f02821cbc))
* **internal:** codegen related update ([#125](https://github.com/writer/writer-python/issues/125)) ([a72d9d9](https://github.com/writer/writer-python/commit/a72d9d997ef4e0f14cfd707e143f8ca0c53c6b97))
* **internal:** fix compat model_dump method when warnings are passed ([#121](https://github.com/writer/writer-python/issues/121)) ([51a4ae5](https://github.com/writer/writer-python/commit/51a4ae539ba4cdb9b15d3a60d2ba5998a0521671))
* remove now unused `cached-property` dep ([#124](https://github.com/writer/writer-python/issues/124)) ([96715e2](https://github.com/writer/writer-python/commit/96715e244454c9b5133cae97187f61f0e6ed9b02))


### Documentation

* add info log level to readme ([#123](https://github.com/writer/writer-python/issues/123)) ([126bf74](https://github.com/writer/writer-python/commit/126bf74e40f7a69d08bef5e8d881af7efc56ae1b))

## 1.4.0 (2024-11-20)

Full Changelog: [v1.3.0...v1.4.0](https://github.com/writer/writer-python/compare/v1.3.0...v1.4.0)
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -282,12 +282,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 `WRITER_LOG` to `debug`.
You can enable logging by setting the environment variable `WRITER_LOG` to `info`.

```shell
$ export WRITER_LOG=debug
$ export WRITER_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`:
Expand Down
5 changes: 4 additions & 1 deletion mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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/writerai/_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/writerai/_files\.py|_dev/.*\.py|tests/.*)$

strict_equality = True
implicit_reexport = True
Expand Down
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "writer-sdk"
version = "1.4.0"
version = "1.5.0"
description = "The official Python library for the writer API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand All @@ -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 = [
Expand Down
12 changes: 8 additions & 4 deletions src/writerai/_base_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -795,6 +795,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",
Expand All @@ -807,6 +808,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,
Expand All @@ -816,6 +818,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,
Expand Down Expand Up @@ -859,10 +862,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:
Expand Down Expand Up @@ -1370,6 +1372,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",
Expand All @@ -1382,6 +1385,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,
Expand All @@ -1391,6 +1395,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,
Expand Down Expand Up @@ -1434,10 +1439,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:
Expand Down
8 changes: 3 additions & 5 deletions src/writerai/_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]",
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion src/writerai/_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__ = "writerai"
__version__ = "1.4.0" # x-release-please-version
__version__ = "1.5.0" # x-release-please-version
8 changes: 8 additions & 0 deletions tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 99318d9

Please sign in to comment.