Skip to Content

Installation

TL;DR

Install the Cmdop Python SDK with pip install cmdop (or poetry/pipenv). Requires Python 3.10+ with asyncio. Dependencies include grpcio, pydantic, and httpx. Authenticate with an API key from the Dashboard or via CMDOP_API_KEY environment variable.

How do I install with pip?

# Install the cmdop SDK from PyPI using pip pip install cmdop

How do I install with Poetry?

# Add cmdop as a dependency using Poetry poetry add cmdop

How do I install with pipenv?

# Install cmdop into your Pipenv virtual environment pipenv install cmdop

What are the requirements?

  • Python 3.10 or later
  • asyncio support

What dependencies are included?

The SDK includes:

  • grpcio - gRPC communication
  • pydantic - Data validation and schemas
  • httpx - HTTP client

How do I set up my API key?

Get your API key from dashboard settings .

Environment Variable

# Set your CMDOP API key as an environment variable export CMDOP_API_KEY=cmd_xxx
import os from cmdop import AsyncCMDOPClient # Read the API key from the environment and create a remote client client = AsyncCMDOPClient.remote(api_key=os.environ["CMDOP_API_KEY"])

In Code

from cmdop import AsyncCMDOPClient # Pass the API key directly when creating the client client = AsyncCMDOPClient.remote(api_key="cmd_xxx")

How do I verify the installation?

import asyncio from cmdop import AsyncCMDOPClient async def main(): # Open an authenticated session to the CMDOP cloud async with AsyncCMDOPClient.remote(api_key="cmd_xxx") as client: # List all registered machines and their statuses machines = await client.machines.list() for machine in machines: print(f"{machine.hostname}: {machine.status}") # Run the async verification function asyncio.run(main())

How do I enable type checking?

For IDE support with type hints:

# Install the SDK with optional type stub extras pip install cmdop[types]

Or with mypy:

# Install mypy and gRPC type stubs for static analysis pip install mypy types-grpcio

How do I install for development?

For contributing:

# Clone the repository and install in editable mode with dev dependencies git clone https://github.com/commandoperator/cmdop-sdk cd cmdop-sdk pip install -e ".[dev]"

Troubleshooting

ImportError

# Ensure pip is up to date pip install --upgrade pip # Reinstall the SDK cleanly pip uninstall cmdop pip install cmdop

gRPC Issues

# Install gRPC tools to resolve protobuf compilation issues pip install grpcio-tools

SSL Errors

# Update the certificate bundle to fix SSL verification failures pip install certifi --upgrade

Next

Last updated on