Developer APIs

Config Option

class idom._option.Option(name, default, mutable=True, validator=<function Option.<lambda>>)[source]

Bases: Generic[idom._option._O]

An option that can be set using an environment variable of the same name

property name: str

The name of this option (used to load environment variables)

property mutable: bool

Whether this option can be modified after being loaded

property default: idom._option._O

This option’s default value

is_set()[source]

Whether this option has a value other than its default.

Return type

bool

set_current(new)[source]

Set the value of this option

Raises a TypeError if this option is not Option.mutable.

Parameters

new (Any) –

Return type

None

set_default(new)[source]

Set the value of this option if not Option.is_set()

Returns the current value (a la dict.set_default())

Parameters

new (idom._option._O) –

Return type

idom._option._O

reload()[source]

Reload this option from its environment variable

Return type

None

unset()[source]

Remove the current value, the default will be used until it is set again.

Return type

None