Skip to main content
Thin convenience over os.environ with .env file loading and automatic JSON parsing for structured values. Not a proprietary config system; ci.env(key) is functionally os.environ.get(key) plus two ergonomic additions.

Signature

Parameters

NameTypeDefaultPurpose
keystr-Environment variable name
defaultanyNoneReturned when the key is absent

Behavior

  • .env loading: on first call, loads a .env file from the current working directory via python-dotenv if that package is installed. If python-dotenv isn’t installed, .env loading is silently skipped; os.environ is read directly.
  • JSON auto-parsing: values whose first non-whitespace character is { or [ are parsed with json.loads(). Scalars (numbers, "true", "false", plain strings) stay as strings; cast them yourself. This avoids surprises like "123" becoming an int you didn’t expect.

Examples

Plain env vars

Structured config

Platform context

The Cirron runtime injects these automatically inside pipelines and deployments:
VariablePurpose
CIRRON_RUN_IDRun this process belongs to
CIRRON_PIPELINE_IDPipeline this run executed as (if any)
CIRRON_DEPLOYMENT_IDDeployment this process is part of (if any)
CIRRON_WORKSPACE_IDOwning workspace
CIRRON_DATA_DIRBase directory for data staged by a Load Data step (/data); read your dataset from a subpath like /data/input
CIRRON_DATASET_URIStorage URI of the staged dataset, used to read directly from storage when staging is off
ci.env() reads them like any other variable. ci.profile() reads them internally to set span attribution and pick the transport.

Updating values on the deployment

On the deployment config panel in the Cirron platform dashboard, edit an env var and hit apply. The platform triggers a rolling restart of the deployment’s containers with the new values. There is a brief pause per replica, not zero-downtime. The next call to ci.env() after restart returns the updated value; the SDK doesn’t cache env values, so no additional invalidation step is needed.

Alternatives

ci.env() is a convenience, not a requirement. os.environ.get(), python-decouple, and pydantic-settings all work fine with the SDK.

ci.secret

For credentials. Never pass a secret through ci.env.

Configuration guide

Full resolution order: explicit → env → config.toml → defaults.