Skip to content

Commit c77f771

Browse files
authored
docs: add v2 upgrade notes (#405)
Add upgrade notes for the new v2 release.
1 parent 1970d84 commit c77f771

3 files changed

Lines changed: 82 additions & 3 deletions

File tree

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ for server in servers:
4545
print(f"{server.id=} {server.name=} {server.status=}")
4646
```
4747

48-
For more details, please see the [API reference](https://hcloud-python.readthedocs.io/en/stable/api.html).
49-
50-
You can find some more examples under the [`examples/`](https://github.com/hetznercloud/hcloud-python/tree/main/examples) directory.
48+
- To upgrade the package, please read the [instructions available in the documentation](https://hcloud-python.readthedocs.io/en/stable/upgrading.html).
49+
- For more details on the API, please see the [API reference](https://hcloud-python.readthedocs.io/en/stable/api.html).
50+
- You can find some more examples under the [`examples/`](https://github.com/hetznercloud/hcloud-python/tree/main/examples) directory.
5151

5252
## Supported Python versions
5353

docs/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ installation.rst
77
api.rst
88
Hetzner Cloud API Documentation <https://docs.hetzner.cloud>
99
contributing.rst
10+
upgrading.md
1011
changelog.md
1112

1213
:::

docs/upgrading.md

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# Upgrading
2+
3+
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
4+
5+
Before upgrading, make sure to resolve any deprecation warnings.
6+
7+
## Upgrading to v2
8+
9+
- [#397](https://github.com/hetznercloud/hcloud-python/pull/397): The package version was moved from `hcloud.__version__.VERSION` to `hcloud.__version__`, make sure to update your import paths:
10+
11+
```diff
12+
-from hcloud.__version__ import VERSION
13+
+from hcloud import __version__ as VERSION
14+
```
15+
16+
- [#401](https://github.com/hetznercloud/hcloud-python/pull/401): The deprecated `hcloud.hcloud` module was removed, make sure to update your import paths:
17+
18+
```diff
19+
-from hcloud.hcloud import Client
20+
+from hcloud import Client
21+
```
22+
23+
- [#398](https://github.com/hetznercloud/hcloud-python/pull/398): The [`Client.poll_interval`](#hcloud.Client) property is now private, make sure to configure it while creating the [`Client`](#hcloud.Client):
24+
25+
```diff
26+
-client = Client(token=token)
27+
-client.poll_interval = 2
28+
+client = Client(
29+
+ token=token,
30+
+ poll_interval=2,
31+
+)
32+
```
33+
34+
- [#400](https://github.com/hetznercloud/hcloud-python/pull/400): The [`Client.request`](#hcloud.Client.request) method now returns an empty dict instead of an empty string when the API response is empty:
35+
36+
```diff
37+
response = client.request(method="DELETE", url="/primary_ips/123456")
38+
-assert response == ""
39+
+assert response == {}
40+
```
41+
42+
- [#402](https://github.com/hetznercloud/hcloud-python/pull/402): In the [`Client.isos.get_list`](#hcloud.isos.client.IsosClient.get_list) and [`Client.isos.get_all`](#hcloud.isos.client.IsosClient.get_all) methods, the deprecated `include_wildcard_architecture` argument was removed, make sure to use the `include_architecture_wildcard` argument instead:
43+
44+
```diff
45+
client.isos.get_all(
46+
- include_wildcard_architecture=True,
47+
+ include_architecture_wildcard=True,
48+
)
49+
```
50+
51+
- [#363](https://github.com/hetznercloud/hcloud-python/pull/363): In the [`Client.primary_ips.create`](#hcloud.primary_ips.client.PrimaryIPsClient.create) method, the `datacenter` argument was moved after `name` argument and is now optional:
52+
53+
```diff
54+
client.primary_ips.create(
55+
"ipv4",
56+
- None,
57+
"my-ip",
58+
assignee_id=12345,
59+
)
60+
```
61+
62+
```diff
63+
client.primary_ips.create(
64+
"ipv4",
65+
- Datacenter(name="fsn1-dc14"),
66+
"my-ip",
67+
+ datacenter=Datacenter(name="fsn1-dc14"),
68+
)
69+
```
70+
71+
- [#406](https://github.com/hetznercloud/hcloud-python/pull/406): In the [`Client.servers.rebuild`](#hcloud.servers.client.ServersClient.rebuild) method, the single action return value was deprecated and is now removed. The method now returns a full response wrapping the action and an optional root password:
72+
73+
```diff
74+
-action = client.servers.rebuild(server, image)
75+
+resp = client.servers.rebuild(server, image)
76+
+action = resp.action
77+
+root_password = resp.root_password
78+
```

0 commit comments

Comments
 (0)