hcloud


Namehcloud JSON
Version 2.3.0 PyPI version JSON
download
home_pagehttps://github.com/hetznercloud/hcloud-python
SummaryOfficial Hetzner Cloud python library
upload_time2024-10-09 12:55:42
maintainerNone
docs_urlNone
authorHetzner Cloud GmbH
requires_python>=3.8
licenseMIT license
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).

## 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).

## 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,
)
```

## 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.8",
    "maintainer_email": null,
    "keywords": "hcloud hetzner cloud",
    "author": "Hetzner Cloud GmbH",
    "author_email": "support-cloud@hetzner.com",
    "download_url": "https://files.pythonhosted.org/packages/f4/51/1cf7c8d332085c80f20819c9acefb3f1776820995d94f7954b1f69aff3f7/hcloud-2.3.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## 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## 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## 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 license",
    "summary": "Official Hetzner Cloud python library",
    "version": "2.3.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": "",
            "digests": {
                "blake2b_256": "732427c27642c7e576424c9b9e15d0fd7baf398974074ab217c1cb79f76a3e8e",
                "md5": "a0f60303c4b813b3a4ce9922ab974812",
                "sha256": "653bd4f53cf92e028c00a04462b9c549249278d3acafc8e6bb9b063ca426877f"
            },
            "downloads": -1,
            "filename": "hcloud-2.3.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a0f60303c4b813b3a4ce9922ab974812",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 86884,
            "upload_time": "2024-10-09T12:55:41",
            "upload_time_iso_8601": "2024-10-09T12:55:41.422250Z",
            "url": "https://files.pythonhosted.org/packages/73/24/27c27642c7e576424c9b9e15d0fd7baf398974074ab217c1cb79f76a3e8e/hcloud-2.3.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f4511cf7c8d332085c80f20819c9acefb3f1776820995d94f7954b1f69aff3f7",
                "md5": "a28968fec7bf51c77ae3da6b69a82775",
                "sha256": "e901d298b112f1d2d4568d8300f3ce19dfe782bdef3ff9c417026a81e16ee956"
            },
            "downloads": -1,
            "filename": "hcloud-2.3.0.tar.gz",
            "has_sig": false,
            "md5_digest": "a28968fec7bf51c77ae3da6b69a82775",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 121684,
            "upload_time": "2024-10-09T12:55:42",
            "upload_time_iso_8601": "2024-10-09T12:55:42.635639Z",
            "url": "https://files.pythonhosted.org/packages/f4/51/1cf7c8d332085c80f20819c9acefb3f1776820995d94f7954b1f69aff3f7/hcloud-2.3.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-09 12:55:42",
    "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: 0.35781s