Configuration

ddp-utils does not impose one global application configuration. Projects may load an INI manifest, apply a project-specific environment prefix, construct browser configuration from mappings, or use individual service environment variables.

INI and environment overlays

load_project_manifest reads manifest.cfg from a supplied directory. cnf_apply_env mutates a configuration mapping with case-insensitive environment overrides and parses values into common Python scalar and collection types.

from ddp_utils.config import cnf_apply_env, load_project_manifest

manifest = load_project_manifest("lib")
if manifest is not None:
    effective = cnf_apply_env(manifest["options"], prefix="APP")

With the default separator, APP__DATABASE__HOST updates effective["database"]["host"]. Use a nonempty prefix in application code; an empty prefix processes every environment variable.

Persistent environment values

PythonEnvStore scopes values by interpreter executable, Python major and minor version, prefix, base prefix, and virtual environment. Process environment values take precedence by default.

Variable

Default

Meaning

DDP_UTILS_ENV_STORE_HOME

DDP per-user runtime directory

Overrides the root used by the persistent Python environment store.

NO_COLOR

Unset

Disables colored terminal output when set to any nonempty value.

The environment store uses atomic JSON and restrictive permissions where supported, but its values are not encrypted and it is not a replacement for an operating-system credential vault.

Mail services

SMTP and IMAP constructors accept explicit arguments. When those arguments are omitted, the mail helpers can read these environment variables:

Variable

Default

SMTP_SERVER

Empty

SMTP_PORT

587

SMTP_USERNAME

Unset

SMTP_PASSWORD

Unset

SMTP_TLS_CA_FILE

Unset

SMTP_TIMEOUT

30 seconds

IMAP_SERVER

Empty

IMAP_PORT

993

IMAP_USERNAME

SMTP_USERNAME when unset

IMAP_PASSWORD

SMTP_PASSWORD when unset

IMAP_MAILBOX

INBOX

IMAP_TIMEOUT

30 seconds