Skip to content

Commit 99318d9

Browse files
authored
Merge pull request #122 from writer/release-please--branches--main--changes--next
release: 1.5.0
2 parents f1b91ed + 265c21b commit 99318d9

9 files changed

Lines changed: 56 additions & 16 deletions

File tree

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "1.4.0"
2+
".": "1.5.0"
33
}

CHANGELOG.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,31 @@
11
# Changelog
22

3+
## 1.5.0 (2024-11-28)
4+
5+
Full Changelog: [v1.4.0...v1.5.0](https://github.com/writer/writer-python/compare/v1.4.0...v1.5.0)
6+
7+
### Features
8+
9+
* **api:** manual updates ([#127](https://github.com/writer/writer-python/issues/127)) ([ae6716d](https://github.com/writer/writer-python/commit/ae6716d8b2345d493ff342cb31adb02e85d7c2a8))
10+
11+
12+
### Bug Fixes
13+
14+
* **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))
15+
16+
17+
### Chores
18+
19+
* fix formatting ([c33a293](https://github.com/writer/writer-python/commit/c33a2932a49d4d51ad81045ba312162f02821cbc))
20+
* **internal:** codegen related update ([#125](https://github.com/writer/writer-python/issues/125)) ([a72d9d9](https://github.com/writer/writer-python/commit/a72d9d997ef4e0f14cfd707e143f8ca0c53c6b97))
21+
* **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))
22+
* remove now unused `cached-property` dep ([#124](https://github.com/writer/writer-python/issues/124)) ([96715e2](https://github.com/writer/writer-python/commit/96715e244454c9b5133cae97187f61f0e6ed9b02))
23+
24+
25+
### Documentation
26+
27+
* add info log level to readme ([#123](https://github.com/writer/writer-python/issues/123)) ([126bf74](https://github.com/writer/writer-python/commit/126bf74e40f7a69d08bef5e8d881af7efc56ae1b))
28+
329
## 1.4.0 (2024-11-20)
430

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

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,12 +282,14 @@ Note that requests that time out are [retried twice by default](#retries).
282282

283283
We use the standard library [`logging`](https://docs.python.org/3/library/logging.html) module.
284284

285-
You can enable logging by setting the environment variable `WRITER_LOG` to `debug`.
285+
You can enable logging by setting the environment variable `WRITER_LOG` to `info`.
286286

287287
```shell
288-
$ export WRITER_LOG=debug
288+
$ export WRITER_LOG=info
289289
```
290290

291+
Or to `debug` for more verbose logging.
292+
291293
### How to tell whether `None` means `null` or missing
292294

293295
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`:

mypy.ini

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ show_error_codes = True
55
# Exclude _files.py because mypy isn't smart enough to apply
66
# the correct type narrowing and as this is an internal module
77
# it's fine to just use Pyright.
8-
exclude = ^(src/writerai/_files\.py|_dev/.*\.py)$
8+
#
9+
# We also exclude our `tests` as mypy doesn't always infer
10+
# types correctly and Pyright will still catch any type errors.
11+
exclude = ^(src/writerai/_files\.py|_dev/.*\.py|tests/.*)$
912

1013
strict_equality = True
1114
implicit_reexport = True

pyproject.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "writer-sdk"
3-
version = "1.4.0"
3+
version = "1.5.0"
44
description = "The official Python library for the writer API"
55
dynamic = ["readme"]
66
license = "Apache-2.0"
@@ -14,7 +14,6 @@ dependencies = [
1414
"anyio>=3.5.0, <5",
1515
"distro>=1.7.0, <2",
1616
"sniffio",
17-
"cached-property; python_version < '3.8'",
1817
]
1918
requires-python = ">= 3.8"
2019
classifiers = [

src/writerai/_base_client.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -795,6 +795,7 @@ def __init__(
795795
custom_query: Mapping[str, object] | None = None,
796796
_strict_response_validation: bool,
797797
) -> None:
798+
kwargs: dict[str, Any] = {}
798799
if limits is not None:
799800
warnings.warn(
800801
"The `connection_pool_limits` argument is deprecated. The `http_client` argument should be passed instead",
@@ -807,6 +808,7 @@ def __init__(
807808
limits = DEFAULT_CONNECTION_LIMITS
808809

809810
if transport is not None:
811+
kwargs["transport"] = transport
810812
warnings.warn(
811813
"The `transport` argument is deprecated. The `http_client` argument should be passed instead",
812814
category=DeprecationWarning,
@@ -816,6 +818,7 @@ def __init__(
816818
raise ValueError("The `http_client` argument is mutually exclusive with `transport`")
817819

818820
if proxies is not None:
821+
kwargs["proxies"] = proxies
819822
warnings.warn(
820823
"The `proxies` argument is deprecated. The `http_client` argument should be passed instead",
821824
category=DeprecationWarning,
@@ -859,10 +862,9 @@ def __init__(
859862
base_url=base_url,
860863
# cast to a valid type because mypy doesn't understand our type narrowing
861864
timeout=cast(Timeout, timeout),
862-
proxies=proxies,
863-
transport=transport,
864865
limits=limits,
865866
follow_redirects=True,
867+
**kwargs, # type: ignore
866868
)
867869

868870
def is_closed(self) -> bool:
@@ -1370,6 +1372,7 @@ def __init__(
13701372
custom_headers: Mapping[str, str] | None = None,
13711373
custom_query: Mapping[str, object] | None = None,
13721374
) -> None:
1375+
kwargs: dict[str, Any] = {}
13731376
if limits is not None:
13741377
warnings.warn(
13751378
"The `connection_pool_limits` argument is deprecated. The `http_client` argument should be passed instead",
@@ -1382,6 +1385,7 @@ def __init__(
13821385
limits = DEFAULT_CONNECTION_LIMITS
13831386

13841387
if transport is not None:
1388+
kwargs["transport"] = transport
13851389
warnings.warn(
13861390
"The `transport` argument is deprecated. The `http_client` argument should be passed instead",
13871391
category=DeprecationWarning,
@@ -1391,6 +1395,7 @@ def __init__(
13911395
raise ValueError("The `http_client` argument is mutually exclusive with `transport`")
13921396

13931397
if proxies is not None:
1398+
kwargs["proxies"] = proxies
13941399
warnings.warn(
13951400
"The `proxies` argument is deprecated. The `http_client` argument should be passed instead",
13961401
category=DeprecationWarning,
@@ -1434,10 +1439,9 @@ def __init__(
14341439
base_url=base_url,
14351440
# cast to a valid type because mypy doesn't understand our type narrowing
14361441
timeout=cast(Timeout, timeout),
1437-
proxies=proxies,
1438-
transport=transport,
14391442
limits=limits,
14401443
follow_redirects=True,
1444+
**kwargs, # type: ignore
14411445
)
14421446

14431447
def is_closed(self) -> bool:

src/writerai/_compat.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,8 @@ def model_dump(
145145
exclude=exclude,
146146
exclude_unset=exclude_unset,
147147
exclude_defaults=exclude_defaults,
148-
warnings=warnings,
148+
# warnings are not supported in Pydantic v1
149+
warnings=warnings if PYDANTIC_V2 else True,
149150
)
150151
return cast(
151152
"dict[str, Any]",
@@ -213,9 +214,6 @@ def __set_name__(self, owner: type[Any], name: str) -> None: ...
213214
# __set__ is not defined at runtime, but @cached_property is designed to be settable
214215
def __set__(self, instance: object, value: _T) -> None: ...
215216
else:
216-
try:
217-
from functools import cached_property as cached_property
218-
except ImportError:
219-
from cached_property import cached_property as cached_property
217+
from functools import cached_property as cached_property
220218

221219
typed_cached_property = cached_property

src/writerai/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

33
__title__ = "writerai"
4-
__version__ = "1.4.0" # x-release-please-version
4+
__version__ = "1.5.0" # x-release-please-version

tests/test_models.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,14 @@ class Model(BaseModel):
561561
m.model_dump(warnings=False)
562562

563563

564+
def test_compat_method_no_error_for_warnings() -> None:
565+
class Model(BaseModel):
566+
foo: Optional[str]
567+
568+
m = Model(foo="hello")
569+
assert isinstance(model_dump(m, warnings=False), dict)
570+
571+
564572
def test_to_json() -> None:
565573
class Model(BaseModel):
566574
foo: Optional[str] = Field(alias="FOO", default=None)

0 commit comments

Comments
 (0)