|
| 1 | +# Verda Python SDK |
| 2 | + |
| 3 | +Welcome to the documentation for the official Verda (formerly Datacrunch) Python SDK. |
| 4 | + |
| 5 | +The Public API documentation is [available here](https://api.verda.com/v1/docs) |
| 6 | + |
| 7 | +The Python SDK is open-sourced and can be [found here](https://github.com/verda-cloud/sdk-python) |
| 8 | + |
| 9 | +## Basic Examples: |
| 10 | + |
| 11 | +First, get your client credentials - [instructions available here](https://api.verda.com/v1/docs#description/quick-start-guide). |
| 12 | + |
| 13 | +Deploy a new instance: |
| 14 | + |
| 15 | +```python |
| 16 | +import os |
| 17 | +from verda import VerdaClient |
| 18 | + |
| 19 | +# Get client secret from environment variable |
| 20 | +CLIENT_SECRET = os.environ['VERDA_CLIENT_SECRET'] |
| 21 | +CLIENT_ID = 'Ibk5bdxV64lKAWOqYnvSi' # Replace with your client ID |
| 22 | + |
| 23 | +# Create client |
| 24 | +verda = VerdaClient(CLIENT_ID, CLIENT_SECRET) |
| 25 | + |
| 26 | +# Get all SSH keys id's |
| 27 | +ssh_keys = verda.ssh_keys.get() |
| 28 | +ssh_keys_ids = list(map(lambda ssh_key: ssh_key.id, ssh_keys)) |
| 29 | + |
| 30 | +# Create a new instance |
| 31 | +instance = verda.instances.create(instance_type='1V100.6V', |
| 32 | + image='ubuntu-24.04-cuda-12.8-open-docker', |
| 33 | + ssh_key_ids=ssh_keys_ids, |
| 34 | + hostname='example', |
| 35 | + description='example instance') |
| 36 | +``` |
| 37 | + |
| 38 | +List all existing instances, ssh keys, startup scripts: |
| 39 | + |
| 40 | +```python |
| 41 | +instances = verda.instances.get() |
| 42 | +keys = verda.ssh_keys.get() |
| 43 | +scripts = verda.startup_scripts.get() |
| 44 | +``` |
| 45 | + |
| 46 | +List all available instance & image types (information about available |
| 47 | +os images and instances to deploy) |
| 48 | + |
| 49 | +```python |
| 50 | +instance_types = verda.instance_types.get() |
| 51 | +images_types = verda.images.get() |
| 52 | +``` |
0 commit comments