Add adoption-focused examples, contract docs, and CLI polish
This commit is contained in:
parent
227983a877
commit
0aa5e25dc1
18 changed files with 560 additions and 2 deletions
30
examples/python_lifecycle.py
Normal file
30
examples/python_lifecycle.py
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
"""Manage VM lifecycle directly through the public Python SDK."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
|
||||
from pyro_mcp import Pyro
|
||||
|
||||
|
||||
def main() -> None:
|
||||
pyro = Pyro()
|
||||
created = pyro.create_vm(
|
||||
profile="debian-git",
|
||||
vcpu_count=1,
|
||||
mem_mib=1024,
|
||||
ttl_seconds=600,
|
||||
network=False,
|
||||
)
|
||||
vm_id = str(created["vm_id"])
|
||||
|
||||
try:
|
||||
pyro.start_vm(vm_id)
|
||||
result = pyro.exec_vm(vm_id, command="git --version", timeout_seconds=30)
|
||||
print(json.dumps(result, indent=2, sort_keys=True))
|
||||
finally:
|
||||
pyro.delete_vm(vm_id)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Loading…
Add table
Add a link
Reference in a new issue