diff --git a/README.md b/README.md index 69c8245..9124211 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/example/example.py b/examples/example.py similarity index 82% rename from example/example.py rename to examples/example.py index 0ee98b0..d5c58fd 100644 --- a/example/example.py +++ b/examples/example.py @@ -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 @@ -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: diff --git a/helpers/cudo_api.py b/helpers/cudo_api.py index 9784c48..9f4ee71 100644 --- a/helpers/cudo_api.py +++ b/helpers/cudo_api.py @@ -42,8 +42,9 @@ def project_id(): return p return '' + # APIs -def apikeys(): +def api_keys(): c, err = client() if err: raise Exception(err) @@ -64,7 +65,7 @@ def networks(): return cudo.NetworksApi(c) -def objectstorage(): +def object_storage(): c, err = client() if err: raise Exception(err) @@ -85,7 +86,7 @@ def projects(): return cudo.ProjectsApi(c) -def sshkeys(): +def ssh_keys(): c, err = client() if err: raise Exception(err) @@ -106,7 +107,7 @@ def user(): return cudo.UserApi(c) -def virtualmachines(): +def virtual_machines(): c, err = client() if err: raise Exception(err) diff --git a/pyproject.toml b/pyproject.toml index 6b5c945..672c9e4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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 = "dev@cudoventures.com" }, ]