|
| 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