The official SDK for interacting with the Cherry Servers API
Project description
Cherry Servers Python SDK
Cherry Servers Python library for resource management.
The documentation for this library is available at https://cherryservers-sdk-python.readthedocs.io. The documentation for the Cherry Servers API can be found at https://api.cherryservers.com/doc/.
Usage
The preferred way to install this package is with pip:
pip install cherryservers-sdk-python
A simple example of how to provision a server and print its information:
import cherryservers_sdk_python
facade = cherryservers_sdk_python.facade.CherryApiFacade(token="my-token")
# Create a server.
creation_req = cherryservers_sdk_python.servers.CreationRequest(
region="LT-Siauliai", plan="B1-1-1gb-20s-shared"
)
server = facade.servers.create(creation_req, project_id=220189)
print(server.get_model())
For more examples, check out the documentation.
Development
Requirements
- Python version >= 3.10
- poetry version >= 2.0.0
Setup
- Clone the repository with:
git clone git@github.com:caliban0/cherryservers-sdk-python.git
cd cherryservers-sdk-python
- Install package dependencies:
poetry install --with dev
If ran from inside a virtual environment, poetry should detect and use it. Otherwise, it will create a new one, which you can activate with:
eval $(poetry env activate)
It's also highly recommended to set up pre-commit:
pre-commit install
Testing
Run unit tests:
pytest tests/unit
Running integration tests requires the following environment variables to be set:
- CHERRY_TEST_API_KEY - your Cherry Servers API key.
- CHERRY_TEST_TEAM_ID - the team for which the resources will be provisioned.
- CHERRY_TEST_BAREMETAL_SERVER_ID - pre-existing baremetal server, for storage testing.
WARNING: running integration tests consumes real resources and will incur costs!
Run integration tests:
pytest tests/integration
Release
- Update version in
pyproject.toml. - Update version in
cherryservers_sdk_python/_version.py. - Run
git cliff -o CHANGELOG.md --tag {version}to generate the changelog. - Create a GitHub release.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cherryservers_sdk_python-1.0.1.tar.gz.
File metadata
- Download URL: cherryservers_sdk_python-1.0.1.tar.gz
- Upload date:
- Size: 32.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.3 CPython/3.13.1 Linux/6.11.0-1015-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
259c20cb0cfd4348e16b3965ef9e8e4db24920c3bf364b6f77d62ca72de5af27
|
|
| MD5 |
e89d0aeb66bb9678690c791047b32f7f
|
|
| BLAKE2b-256 |
79e1cbf5828d2e2107a84f8d917b41b3dde1de22cabd61bc137eacd9f6c3b3e1
|
File details
Details for the file cherryservers_sdk_python-1.0.1-py3-none-any.whl.
File metadata
- Download URL: cherryservers_sdk_python-1.0.1-py3-none-any.whl
- Upload date:
- Size: 42.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.3 CPython/3.13.1 Linux/6.11.0-1015-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
456a2bba1335b69989a34da4090b1c2143d236d19ddac01143f045b4d1f7166f
|
|
| MD5 |
5caee47e8faa9d07c929b04883b6893e
|
|
| BLAKE2b-256 |
89e1034aa0f5cfe1baaae7e7e6e96fd5de3246a5bf21c833dc5ab1d10bd4f611
|