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/.
The preferred way to install this package is with pip:
pip install cherryservers-sdk-pythonA 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.
- Python version >= 3.10
- poetry version >= 2.0.0
- Clone the repository with:
git clone git@github.com:caliban0/cherryservers-sdk-python.git
cd cherryservers-sdk-python- Install package dependencies:
poetry install --with devIf 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 installRun unit tests:
pytest tests/unitRunning 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- 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.