Initial Python SDK implementation: client, models, resources, and tests#1
Merged
Initial Python SDK implementation: client, models, resources, and tests#1
Conversation
This was referenced Mar 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
First-party Python SDK for the Convox API. Enables customers to interact with Convox racks programmatically from Python without shelling out to the CLI binary. Supports both direct rack connections and console-managed racks via RBAC routing.
Motivation
The Convox CLI is the primary interface for rack management, but CI/CD pipelines, automation scripts, and custom tooling benefit from a native SDK with type safety, structured error handling, and programmatic access without shelling out to a binary. Python is widely used in DevOps and infrastructure automation, making it a natural fit for a first-party SDK.
What's included
Client
ConvoxClientwith three initialization paths: explicit (host+api_key), environment variables (CONVOX_HOST+CONVOX_PASSWORD+ optionalCONVOX_RACK), or CLI config (~/.convox/auth)User-Agent,Rack,Version)client.api.get(),client.api.post(), etc.) for endpoints not yet covered by resource modulesResource modules (11)
All passing. ruff and mypy clean with zero warnings/errors.
Notable design decisions
promote=Falseto opt out. The server does full env replacement, not merge, so the SDK handles client-side merge (read current, merge changes, send full env).stream()does not raise exceptions on error status codes. This is intentional for streaming endpoints (logs, build output) where partial data may already have been sent. Documented in README and docstring. The caller must checkresponse.status_codeand close the response.User-Agent: convox.go/<version>to route through console RBAC. Verified against console3 routing code as the intended integration pattern (same mechanism the Go CLI uses).src/convox/_version.pyas single source of truth, imported by__init__.pyand_http.py.pyproject.tomlversion must be kept in sync manually at release time.Not included (future work)
AsyncConvoxClient) -- httpx supports async but the transport layer would need reworklimitparams, not cursor-based pagination, so no SDK-level abstraction needed currentlyRelated
update/router) -- adds JSON content negotiation that this SDK depends onfix/api-error-handling) -- fixes API status codes that this SDK's exception mapping depends on. The SDK includes backward-compatible heuristics for racks without this fix.