Region and environment
Every client takes two top-level kwargs that pick the backend:| Kwarg | Values | Default |
|---|---|---|
region | "ontario", "us" (pending) | — (required) |
env | "production", "staging", "dev", "qa", "demo" | "staging" if env var STX_ENV is unset |
US region hosts are not live yet. Pass
region="ontario" for all current environments.Precedence
env resolves in this order (highest wins):
- Keyword argument —
STX(env="production") - Environment variable —
STX_ENV=production - Profile file —
env = productionin~/.stx/credentials - Default —
"staging"
STXException at construction time.
Custom hosts
For local development against a custom host — a branch-deployed preview, orlocalhost:
host= bypasses the region/env table entirely — the SDK won’t try to look up a hostname. Useful for testing, not recommended in production code.
Environment variables
The SDK reads these at client-construction time:| Variable | Purpose |
|---|---|
STX_EMAIL | Email for login (see Authentication) |
STX_PASSWORD | Password for login |
STX_ENV | Default env if kwarg is not set |
STX_REGION | Default region if kwarg is not set |
STX_PROFILE | Default profile name for ~/.stx/credentials |
STX_HOST | Overrides region/env — useful for local dev |
STX_SCHEMA_SOURCE | "bundled" (default), "latest", or a URL |
False / "" — so STX_EMAIL= in an unset env file won’t shadow a profile value.
Profile files
~/.stx/credentials uses the same INI format as ~/.aws/credentials:
Schema pinning
The SDK’s fieldSelections are validated against a GraphQL schema. You control where that schema comes from.
- Bundled (default)
- Latest
- Custom URL
The schema ships with the SDK — byte-for-byte what was on staging at release time. Predictable, testable, no network dependency at client init.If the server is running a newer schema, the SDK logs a one-time warning pointing you at
pip install --upgrade stx-python. Existing calls keep working — only calls to fields that don’t exist in the bundled schema will raise.Default field selection
By default every GraphQL call returns all scalar fields — the SDK walks the return type and requests them for you. Override the default for every call on a given client:Retry policy
All GraphQL calls are wrapped in aRetryPolicy with exponential backoff + decorrelated jitter. Override per-client:
Logging
The SDK uses the standardlogging module under the stx logger:
INFO: login, token refresh, WS reconnect events.DEBUG: every GraphQL operation name, WS frame direction, retry attempts.WARNING: schema version skew, backoff exhaustion.

