You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+98
Original file line number
Diff line number
Diff line change
@@ -13,6 +13,104 @@ Programmatic usage of this project (e.g., importing it as a Python module) and t
13
13
14
14
The 0.x prefix used in versions for this project is to indicate that breaking changes are expected frequently (several times a year). Breaking changes will increment the minor number, all other changes will increment the patch number. You can track the progress toward 1.0 [here](https://github.com/openapi-generators/openapi-python-client/projects/2).
15
15
16
+
## 0.15.0 (2023-07-23)
17
+
18
+
### Breaking Changes
19
+
20
+
#### Minimum httpx version raised to 0.20
21
+
22
+
Some features of generated clients already failed at runtime when using httpx < 0.20, but now the minimum version is enforced at generation time.
23
+
24
+
#### Connections from clients no longer automatically close (PR [#775](https://github.com/openapi-generators/openapi-python-client/pull/775))
25
+
26
+
`Client` and `AuthenticatedClient` now reuse an internal [`httpx.Client`](https://www.python-httpx.org/advanced/#client-instances) (or `AsyncClient`)—keeping connections open between requests. This will improve performance overall, but may cause resource leaking if clients are not closed properly. The new clients are intended to be used via context managers—though for compatibility they don't _have_ to be used with context managers. If not using a context manager, connections will probably leak. Note that once a client is closed (by leaving the context manager), it can no longer be used—and attempting to do so will raise an exception.
27
+
28
+
APIs should now be called like:
29
+
30
+
```python
31
+
with client as client:
32
+
my_api.sync(client)
33
+
another_api.sync(client)
34
+
# client is closed here and can no longer be used
35
+
```
36
+
37
+
Generated READMEs reflect the new syntax, but READMEs for existing generated clients should be updated manually. See [this diff](https://github.com/openapi-generators/openapi-python-client/pull/775/files#diff-62b50316369f84439d58f4981c37538f5b619d344393cb659080dadbda328547) for inspiration.
38
+
39
+
#### Generated clients and models now use the newer attrs `@define` and `field` APIs
40
+
41
+
See [the attrs docs](https://www.attrs.org/en/stable/names.html#attrs-tng) for more information on how these may affect you.
42
+
43
+
#### Removed public attributes for `Client` and `AuthenticatedClient`
44
+
45
+
The following attributes have been removed from `Client` and `AuthenticatedClient`:
46
+
47
+
-`base_url`—this can now only be set via the initializer
48
+
-`cookies`—set at initialization or use `.with_cookies()`
49
+
-`headers`—set at initialization or use `.with_headers()`
50
+
-`timeout`—set at initialization or use `.with_timeout()`
51
+
-`verify_ssl`—this can now only be set via the initializer
52
+
-`follow_redirects`—this can now only be set via the initializer
53
+
54
+
#### The `timeout` param and `with_timeout` now take an `httpx.Timeout` instead of a float
55
+
56
+
#### `AuthenticatedClient` no longer inherits from `Client`
57
+
58
+
The API of `AuthenticatedClient` is still a superset of `Client`, but the two classes no longer share a common base class.
59
+
60
+
### Features
61
+
62
+
#### Allow customizing the underlying `httpx` clients
63
+
64
+
There are many use-cases where customizing the underlying `httpx` client directly is necessary. Some examples are:
The new `Client` and `AuthenticatedClient` classes come with several methods to customize underlying clients. You can pass arbitrary arguments to `httpx.Client` or `httpx.AsyncClient` when they are constructed:
**The underlying clients are constructed lazily, only when needed. `httpx_args` are stored internally in a dictionary until the first request is made.**
78
+
79
+
You can force immediate construction of an underlying client in order to edit it directly:
#### Clients now reuse connections between requests
107
+
108
+
This happens every time you use the same `Client` or `AuthenticatedClient` instance for multiple requests, however it is best to use a context manager (e.g., `with client as client:`) to ensure the client is closed properly.
109
+
110
+
### Fixes
111
+
112
+
#### Stop showing Poetry instructions in generated READMEs when not appropriate
0 commit comments