Skip to main content

The official SDK for interacting with the Cherry Servers API

Project description

Cherry Servers Python SDK

codecov unit-test lint Documentation Status PyPI - Python Version

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

  1. Clone the repository with:
git clone git@github.com:caliban0/cherryservers-sdk-python.git
cd cherryservers-sdk-python
  1. 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:

  1. CHERRY_TEST_API_KEY - your Cherry Servers API key.
  2. CHERRY_TEST_TEAM_ID - the team for which the resources will be provisioned.
  3. 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

  1. Update version in pyproject.toml.
  2. Update version in cherryservers_sdk_python/_version.py.
  3. Run git cliff -o CHANGELOG.md --tag {version} to generate the changelog.
  4. Create a GitHub release.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cherryservers_sdk_python-1.1.0.tar.gz (32.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cherryservers_sdk_python-1.1.0-py3-none-any.whl (42.6 kB view details)

Uploaded Python 3

File details

Details for the file cherryservers_sdk_python-1.1.0.tar.gz.

File metadata

  • Download URL: cherryservers_sdk_python-1.1.0.tar.gz
  • Upload date:
  • Size: 32.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.13.1 Linux/6.11.0-1018-azure

File hashes

Hashes for cherryservers_sdk_python-1.1.0.tar.gz
Algorithm Hash digest
SHA256 93c2f6eb3f9c8a1d7b41a731399504f07792f601763aaac8797989da926652a3
MD5 228ed272989aab3d355a2d06e619a751
BLAKE2b-256 c6a96cfa65fa0cbbd2a7ed233262aed92628e31fc9977477aac36b9a72487058

See more details on using hashes here.

File details

Details for the file cherryservers_sdk_python-1.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for cherryservers_sdk_python-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 38f5080b033ec912a828ecaba2794e8186b13d696b324ed1248fed3a5f4e0807
MD5 67472abeb747ea911dee2bea2d62f22d
BLAKE2b-256 100be00b8d32f89b19e03a5e074a011b0f84ad2ee50aa2ae7be7fe55c25bbe64

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page