Metadata-Version: 2.3
Name: denvr
Version: 0.0.1
Summary: Python SDK for the Denvr Cloud API
Project-URL: Documentation, https://github.com/denvrdata/denvrpy#readme
Project-URL: Issues, https://github.com/denvrdata/denvrpy/issues
Project-URL: Source, https://github.com/denvrdata/denvrpy
Author-email: rofinn <rory@denvrdata.com>
License: MIT
Classifier: Development Status :: 4 - Beta
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Requires-Python: >=3.8
Requires-Dist: requests
Requires-Dist: toml
Description-Content-Type: text/markdown

# denvr

A Python SDK for interacting with Denvr Cloud.

[![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/denvrdata/denvrpy/CI.yml)](https://github.com/denvrdata/denvrpy/actions/workflows/CI.yml)
[![Coveralls](https://img.shields.io/coverallsCoverage/github/denvrdata/denvrpy)](https://coveralls.io/github/denvrdata/denvrpy?branch=main)
[![Swagger Validator](https://img.shields.io/swagger/valid/3.0?specUrl=https%3A%2F%2Fapi.cloud.denvrdata.com%2Fswagger%2Fv1%2Fswagger.json)](https://api.cloud.denvrdata.com/swagger/index.html)
[![Denvrpy Docs](https://img.shields.io/badge/denvrpy-docs-%234493c5?style=flat)](https://denvrdata.github.io/denvrpy/)
[![Denvr Dataworks Docs](https://img.shields.io/badge/denvr_cloud-docs-%234493c5?style=flat)](https://docs.denvrdata.com/docs)
[![Denvr Dataworks Registration](https://img.shields.io/badge/denvr_cloud-registration-%234493c5?style=flat)](https://console.cloud.denvrdata.com/account/register-tenant)

-----

This package is largely autogenerated from our [Denvr Cloud API Spec](https://api.cloud.denvrdata.com/swagger/v1/swagger.json)

## Installation

```console
pip install -e git+https://github.com/denvrdata/denvrpy.git#egg=denvr
```

## Quickstart

Getting started with the `denvr` python sdk just involves loading and calling the `client` builder function, which returns a `Client` object for each denvr service (e.g., `clusters`, `vpcs`, `servers/virtual`).

```python
>>> import json
>>> from denvr.client import client
>>> virtual = client('servers/virtual')
```

Lets start by fetching some of Denvr's VM configurations.
We'll use `json.dumps` to make the output a bit easier to read.
```python
>>> print(json.dumps(virtual.get_configurations(), indent=2))
{
  "items": [
    {
      "id": 5,
      "user_friendly_name": "A100_40GB_PCIe_1x",
      "name": "A100_40GB_PCIe_1x",
      "description": null,
      "os_version": "20.04",
      "os_type": "Ubuntu",
      "storage": 1700,
      "gpu_type": "nvidia.com/A100PCIE40GB",
      "gpu_family": "NVIDIA A100",
      "gpu_brand": "Nvidia",
      "gpu_name": "A100 40GB PCIe",
      "type": "nvidia.com/A100PCIE40GB",
      "brand_family": "NVIDIA A100",
      "brand": "Nvidia",
      "text_name": "A100 40GB PCIe",
      "gpus": 1,
      "vcpus": 14,
      "memory": 112,
      "price": 2.05,
      "compute_network": null,
      "is_gpu_platform": true,
      "clusters": [
        "Hou1",
        "Msc1"
      ]
    },
    {
      "id": 6,
      "user_friendly_name": "A100_40GB_PCIe_2x",
      "name": "A100_40GB_PCIe_2x",
      "description": null,
      "os_version": "20.04",
      "os_type": "Ubuntu",
      "storage": 3400,
      "gpu_type": "nvidia.com/A100PCIE40GB",
      "gpu_family": "NVIDIA A100",
      "gpu_brand": "Nvidia",
      "gpu_name": "A100 40GB PCIe",
      "type": "nvidia.com/A100PCIE40GB",
      "brand_family": "NVIDIA A100",
      "brand": "Nvidia",
      "text_name": "A100 40GB PCIe",
      "gpus": 2,
      "vcpus": 28,
      "memory": 224,
      "price": 4.1,
      "compute_network": null,
      "is_gpu_platform": true,
      "clusters": [
        "Hou1",
        "Msc1"
      ]
    },
    ...
```
Next we'll try Creating a new virtual machine:
```python
>>> print(json.dumps(
    virtual.create_server(
        name="api-test",
        rpool="on-demand",
        vpc="denvr",
        configuration="H100_80GB_SXM_8x",
        cluster="Hou1",
        ssh_keys=["ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAA..."],
        operating_system_image="Ubuntu 22.04.4 LTS",
        root_disk_size=500,
    ),
    indent=2
))
{
  "username": "rory@denvrdata.com",
  "tenancy_name": "denvr",
  "rpool": "on-demand",
  "direct_attached_storage_persisted": false,
  "id": "api-test",
  "namespace": "denvr",
  "configuration": "H100_80GB_SXM_8x",
  "storage": 20000,
  "gpu_type": "nvidia.com/H100SXM480GB",
  "gpus": 8,
  "vcpus": 200,
  "memory": 940,
  "ip": "",
  "private_ip": "172.16.0.84",
  "image": "Ubuntu_22.04.4_LTS",
  "cluster": "Hou1",
  "status": "na",
  "storage_type": "na"
}
```

Similarly, we can also fetch info about a specific vm.
```python
>>> print(json.dumps(virtual.get_server(id='rofinn-intel-dev', namespace='denvr', cluster='Hou1'), indent=2))
{
  "username": "rory@denvrdata.com",
  "tenancy_name": "denvr",
  "rpool": "reserved-denvr",
  "direct_attached_storage_persisted": false,
  "id": "rofinn-intel-dev",
  "namespace": "denvr",
  "configuration": "15",
  "storage": 27000,
  "gpu_type": "intel/GAUDI2",
  "gpus": 8,
  "vcpus": 152,
  "memory": 940,
  ...
  "image": "habana-1.16.2",
  "cluster": "Hou1",
  "status": "ONLINE",
  "storage_type": "na"
}
```
