hcloud


Namehcloud JSON
Version 2.6.0 PyPI version JSON
download
home_pagehttps://github.com/hetznercloud/hcloud-python
SummaryOfficial Hetzner Cloud python library
upload_time2025-09-08 10:15:33
maintainerNone
docs_urlNone
authorHetzner Cloud GmbH
requires_python>=3.9
licenseMIT
keywords hcloud hetzner cloud
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Hetzner Cloud Python

[![](https://github.com/hetznercloud/hcloud-python/actions/workflows/test.yml/badge.svg)](https://github.com/hetznercloud/hcloud-python/actions/workflows/test.yml)
[![](https://github.com/hetznercloud/hcloud-python/actions/workflows/lint.yml/badge.svg)](https://github.com/hetznercloud/hcloud-python/actions/workflows/lint.yml)
[![](https://codecov.io/github/hetznercloud/hcloud-python/graph/badge.svg?token=3YGRqB5t1L)](https://codecov.io/github/hetznercloud/hcloud-python/tree/main)
[![](https://readthedocs.org/projects/hcloud-python/badge/?version=latest)](https://hcloud-python.readthedocs.io)
[![](https://img.shields.io/pypi/pyversions/hcloud.svg)](https://pypi.org/project/hcloud/)

Official Hetzner Cloud python library.

The library's documentation is available at [hcloud-python.readthedocs.io](https://hcloud-python.readthedocs.io), the public API documentation is available at [docs.hetzner.cloud](https://docs.hetzner.cloud).

> [!IMPORTANT]
> Make sure to follow our API changelog available at
> [docs.hetzner.cloud/changelog](https://docs.hetzner.cloud/changelog) (or the RSS feed
> available at
> [docs.hetzner.cloud/changelog/feed.rss](https://docs.hetzner.cloud/changelog/feed.rss))
> to be notified about additions, deprecations and removals.

## Usage

Install the `hcloud` library:

```sh
pip install hcloud
```

For more installation details, please see the [installation docs](https://hcloud-python.readthedocs.io/en/stable/installation.html).

Here is an example that creates a server and list them:

```python
from hcloud import Client
from hcloud.images import Image
from hcloud.server_types import ServerType

client = Client(token="{YOUR_API_TOKEN}")  # Please paste your API token here

# Create a server named my-server
response = client.servers.create(
    name="my-server",
    server_type=ServerType(name="cx22"),
    image=Image(name="ubuntu-22.04"),
)
server = response.server
print(f"{server.id=} {server.name=} {server.status=}")
print(f"root password: {response.root_password}")

# List your servers
servers = client.servers.get_all()
for server in servers:
    print(f"{server.id=} {server.name=} {server.status=}")
```

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

## Supported Python versions

We support python versions until [`end-of-life`](https://devguide.python.org/versions/#status-of-python-versions).

## Experimental features

Experimental features are published as part of our regular releases (e.g. a product
public beta). During an experimental phase, breaking changes on those features may occur
within minor releases.

While experimental features will be announced in the release notes, you can also find
whether a python class or function is experimental in its docstring:

```
Experimental:
    $PRODUCT is experimental, breaking changes may occur within minor releases.
    See https://docs.hetzner.cloud/changelog#$SLUG for more details.
```

## Development

First, create a virtual environment and activate it:

```sh
make venv
source venv/bin/activate
```

You may setup [`pre-commit`](https://pre-commit.com/) to run before you commit changes, this removes the need to run it manually afterwards:

```sh
pre-commit install
```

You can then run different tasks defined in the `Makefile`, below are the most important ones:

Build the documentation and open it in your browser:

```sh
make docs
```

Lint the code:

```sh
make lint
```

Run tests using the current `python3` version:

```sh
make test
```

You may also run the tests for multiple `python3` versions using `tox`:

```sh
tox .
```

### Deprecations implementation

When deprecating a module or a function, you must:

- Update the docstring with a `deprecated` notice:

```py
"""Get image by name

.. deprecated:: 1.19
    Use :func:`hcloud.images.client.ImagesClient.get_by_name_and_architecture` instead.
"""
```

- Raise a warning when the deprecated module or function is being used:

```py
warnings.warn(
    "The 'hcloud.images.client.ImagesClient.get_by_name' method is deprecated, please use the "
    "'hcloud.images.client.ImagesClient.get_by_name_and_architecture' method instead.",
    DeprecationWarning,
    stacklevel=2,
)
```

### Releasing experimental features

To publish experimental features as part of regular releases:

- an announcement, including a link to a changelog entry, must be added to the release notes.
- an `Experimental` notice, including a link to a changelog entry, must be added to the python classes and functions that are experimental:

  ```py
  """
  Experimental:
      $PRODUCT is experimental, breaking changes may occur within minor releases.
      See https://docs.hetzner.cloud/changelog#$SLUG for more details.
  """
  ```

## License

The MIT License (MIT). Please see [`License File`](https://github.com/hetznercloud/hcloud-python/blob/main/LICENSE) for more information.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/hetznercloud/hcloud-python",
    "name": "hcloud",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "hcloud hetzner cloud",
    "author": "Hetzner Cloud GmbH",
    "author_email": "support-cloud@hetzner.com",
    "download_url": "https://files.pythonhosted.org/packages/fb/17/d226bf30e63a2362d1352297a8a29b55d58a01b8bca80096e317550fcafd/hcloud-2.6.0.tar.gz",
    "platform": null,
    "description": "# Hetzner Cloud Python\n\n[![](https://github.com/hetznercloud/hcloud-python/actions/workflows/test.yml/badge.svg)](https://github.com/hetznercloud/hcloud-python/actions/workflows/test.yml)\n[![](https://github.com/hetznercloud/hcloud-python/actions/workflows/lint.yml/badge.svg)](https://github.com/hetznercloud/hcloud-python/actions/workflows/lint.yml)\n[![](https://codecov.io/github/hetznercloud/hcloud-python/graph/badge.svg?token=3YGRqB5t1L)](https://codecov.io/github/hetznercloud/hcloud-python/tree/main)\n[![](https://readthedocs.org/projects/hcloud-python/badge/?version=latest)](https://hcloud-python.readthedocs.io)\n[![](https://img.shields.io/pypi/pyversions/hcloud.svg)](https://pypi.org/project/hcloud/)\n\nOfficial Hetzner Cloud python library.\n\nThe library's documentation is available at [hcloud-python.readthedocs.io](https://hcloud-python.readthedocs.io), the public API documentation is available at [docs.hetzner.cloud](https://docs.hetzner.cloud).\n\n> [!IMPORTANT]\n> Make sure to follow our API changelog available at\n> [docs.hetzner.cloud/changelog](https://docs.hetzner.cloud/changelog) (or the RSS feed\n> available at\n> [docs.hetzner.cloud/changelog/feed.rss](https://docs.hetzner.cloud/changelog/feed.rss))\n> to be notified about additions, deprecations and removals.\n\n## Usage\n\nInstall the `hcloud` library:\n\n```sh\npip install hcloud\n```\n\nFor more installation details, please see the [installation docs](https://hcloud-python.readthedocs.io/en/stable/installation.html).\n\nHere is an example that creates a server and list them:\n\n```python\nfrom hcloud import Client\nfrom hcloud.images import Image\nfrom hcloud.server_types import ServerType\n\nclient = Client(token=\"{YOUR_API_TOKEN}\")  # Please paste your API token here\n\n# Create a server named my-server\nresponse = client.servers.create(\n    name=\"my-server\",\n    server_type=ServerType(name=\"cx22\"),\n    image=Image(name=\"ubuntu-22.04\"),\n)\nserver = response.server\nprint(f\"{server.id=} {server.name=} {server.status=}\")\nprint(f\"root password: {response.root_password}\")\n\n# List your servers\nservers = client.servers.get_all()\nfor server in servers:\n    print(f\"{server.id=} {server.name=} {server.status=}\")\n```\n\n- To upgrade the package, please read the [instructions available in the documentation](https://hcloud-python.readthedocs.io/en/stable/upgrading.html).\n- For more details on the API, please see the [API reference](https://hcloud-python.readthedocs.io/en/stable/api.html).\n- You can find some more examples under the [`examples/`](https://github.com/hetznercloud/hcloud-python/tree/main/examples) directory.\n\n## Supported Python versions\n\nWe support python versions until [`end-of-life`](https://devguide.python.org/versions/#status-of-python-versions).\n\n## Experimental features\n\nExperimental features are published as part of our regular releases (e.g. a product\npublic beta). During an experimental phase, breaking changes on those features may occur\nwithin minor releases.\n\nWhile experimental features will be announced in the release notes, you can also find\nwhether a python class or function is experimental in its docstring:\n\n```\nExperimental:\n    $PRODUCT is experimental, breaking changes may occur within minor releases.\n    See https://docs.hetzner.cloud/changelog#$SLUG for more details.\n```\n\n## Development\n\nFirst, create a virtual environment and activate it:\n\n```sh\nmake venv\nsource venv/bin/activate\n```\n\nYou may setup [`pre-commit`](https://pre-commit.com/) to run before you commit changes, this removes the need to run it manually afterwards:\n\n```sh\npre-commit install\n```\n\nYou can then run different tasks defined in the `Makefile`, below are the most important ones:\n\nBuild the documentation and open it in your browser:\n\n```sh\nmake docs\n```\n\nLint the code:\n\n```sh\nmake lint\n```\n\nRun tests using the current `python3` version:\n\n```sh\nmake test\n```\n\nYou may also run the tests for multiple `python3` versions using `tox`:\n\n```sh\ntox .\n```\n\n### Deprecations implementation\n\nWhen deprecating a module or a function, you must:\n\n- Update the docstring with a `deprecated` notice:\n\n```py\n\"\"\"Get image by name\n\n.. deprecated:: 1.19\n    Use :func:`hcloud.images.client.ImagesClient.get_by_name_and_architecture` instead.\n\"\"\"\n```\n\n- Raise a warning when the deprecated module or function is being used:\n\n```py\nwarnings.warn(\n    \"The 'hcloud.images.client.ImagesClient.get_by_name' method is deprecated, please use the \"\n    \"'hcloud.images.client.ImagesClient.get_by_name_and_architecture' method instead.\",\n    DeprecationWarning,\n    stacklevel=2,\n)\n```\n\n### Releasing experimental features\n\nTo publish experimental features as part of regular releases:\n\n- an announcement, including a link to a changelog entry, must be added to the release notes.\n- an `Experimental` notice, including a link to a changelog entry, must be added to the python classes and functions that are experimental:\n\n  ```py\n  \"\"\"\n  Experimental:\n      $PRODUCT is experimental, breaking changes may occur within minor releases.\n      See https://docs.hetzner.cloud/changelog#$SLUG for more details.\n  \"\"\"\n  ```\n\n## License\n\nThe MIT License (MIT). Please see [`License File`](https://github.com/hetznercloud/hcloud-python/blob/main/LICENSE) for more information.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Official Hetzner Cloud python library",
    "version": "2.6.0",
    "project_urls": {
        "Bug Tracker": "https://github.com/hetznercloud/hcloud-python/issues",
        "Changelog": "https://github.com/hetznercloud/hcloud-python/blob/main/CHANGELOG.md",
        "Documentation": "https://hcloud-python.readthedocs.io/en/stable/",
        "Homepage": "https://github.com/hetznercloud/hcloud-python",
        "Source Code": "https://github.com/hetznercloud/hcloud-python"
    },
    "split_keywords": [
        "hcloud",
        "hetzner",
        "cloud"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "3c70e6658fc566f1ec1dabbf54268c0455fe078ecbdd49e71748bd3f2b578515",
                "md5": "e6b128cbb765e388283b311e90d32734",
                "sha256": "f1bd8f9997653c049c6454d9dfeb8909061d7fdffdafa4ea98cd4589e876dcc0"
            },
            "downloads": -1,
            "filename": "hcloud-2.6.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e6b128cbb765e388283b311e90d32734",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 89243,
            "upload_time": "2025-09-08T10:15:31",
            "upload_time_iso_8601": "2025-09-08T10:15:31.776651Z",
            "url": "https://files.pythonhosted.org/packages/3c/70/e6658fc566f1ec1dabbf54268c0455fe078ecbdd49e71748bd3f2b578515/hcloud-2.6.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "fb17d226bf30e63a2362d1352297a8a29b55d58a01b8bca80096e317550fcafd",
                "md5": "b4032ca4211cfd6c2b331e52c7f0a580",
                "sha256": "45933390763ed08b9679c61d79bafde1acb7f0296d9b8b61377c2a4e4e12c9a1"
            },
            "downloads": -1,
            "filename": "hcloud-2.6.0.tar.gz",
            "has_sig": false,
            "md5_digest": "b4032ca4211cfd6c2b331e52c7f0a580",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 125232,
            "upload_time": "2025-09-08T10:15:33",
            "upload_time_iso_8601": "2025-09-08T10:15:33.395486Z",
            "url": "https://files.pythonhosted.org/packages/fb/17/d226bf30e63a2362d1352297a8a29b55d58a01b8bca80096e317550fcafd/hcloud-2.6.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-09-08 10:15:33",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "hetznercloud",
    "github_project": "hcloud-python",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "hcloud"
}
        
Elapsed time: 2.09739s