Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
JungleCatSW committed Nov 24, 2023
1 parent a9dd6c9 commit 18012a1
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ pip install cudo-compute
```

```python
import cudo_compute as cudo
from cudo_compute import cudo_api

client, e = cudo.CudoClient.get_client()
api = cudo.VirtualMachinesApi(client)
api = cudo_api.virtual_machines()
vms = api.list_vms(cudo_api.project_id())
```

A more complete example of various api calls can be seen in the example in ``examples/example.py`` demonstrates how to use it.
Expand Down
7 changes: 3 additions & 4 deletions example/example.py → examples/example.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
from cudo_compute import cudo_api
import cudo_compute


def machine_types(gpu_model, mem_gib, vcpu_count, gpu_count):
try:
api = cudo_api.virtualmachines()
api = cudo_api.virtual_machines()
types = api.list_vm_machine_types(mem_gib, vcpu_count, gpu=gpu_count, gpu_model=gpu_model)
types_dict = types.to_dict()
return types_dict
Expand All @@ -16,11 +15,11 @@ def machine_types(gpu_model, mem_gib, vcpu_count, gpu_count):

print(cudo_api.project_id())


def list_instances():
try:
api = cudo_api.virtualmachines()
api = cudo_api.virtual_machines()
vms = api.list_vms(cudo_api.project_id())
instances = {}
vms_dict = vms.to_dict()
return vms_dict
except Exception as e:
Expand Down
9 changes: 5 additions & 4 deletions helpers/cudo_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ def project_id():
return p
return ''


# APIs
def apikeys():
def api_keys():
c, err = client()
if err:
raise Exception(err)
Expand All @@ -64,7 +65,7 @@ def networks():
return cudo.NetworksApi(c)


def objectstorage():
def object_storage():
c, err = client()
if err:
raise Exception(err)
Expand All @@ -85,7 +86,7 @@ def projects():
return cudo.ProjectsApi(c)


def sshkeys():
def ssh_keys():
c, err = client()
if err:
raise Exception(err)
Expand All @@ -106,7 +107,7 @@ def user():
return cudo.UserApi(c)


def virtualmachines():
def virtual_machines():
c, err = client()
if err:
raise Exception(err)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "hatchling.build"

[project]
name = "cudo-compute"
version = "0.1.2"
version = "0.1.3"
authors = [
{ name = "Cudo Ventures", email = "[email protected]" },
]
Expand Down

0 comments on commit 18012a1

Please sign in to comment.