aries_cloudagent.config package

Submodules

aries_cloudagent.config.argparse module

aries_cloudagent.config.banner module

Module to contain logic to generate the banner for ACA-py.

aries_cloudagent.config.banner.Banner(border: str, length: int, file: Optional[TextIO] = None)[source]

Context manager to generate a banner for ACA-py.

aries_cloudagent.config.base module

Configuration base classes.

class aries_cloudagent.config.base.BaseInjector[source]

Bases: ABC

Base injector class.

abstract copy() BaseInjector[source]

Produce a copy of the injector instance.

abstract inject(base_cls: Type[InjectType], settings: Optional[Mapping[str, Any]] = None) InjectType[source]

Get the provided instance of a given class identifier.

Parameters
  • cls – The base class to retrieve an instance of

  • settings – An optional mapping providing configuration to the provider

Returns

An instance of the base class, or None

abstract inject_or(base_cls: Type[InjectType], settings: Optional[Mapping[str, Any]] = None, default: Optional[InjectType] = None) Optional[InjectType][source]

Get the provided instance of a given class identifier or default if not found.

Parameters
  • base_cls – The base class to retrieve an instance of

  • settings – An optional dict providing configuration to the provider

  • default – default return value if no instance is found

Returns

An instance of the base class, or None

class aries_cloudagent.config.base.BaseProvider[source]

Bases: ABC

Base provider class.

provide(settings: BaseSettings, injector: BaseInjector) Any[source]

Provide the object instance given a config and injector.

class aries_cloudagent.config.base.BaseSettings[source]

Bases: Mapping[str, Any]

Base settings class.

abstract copy() BaseSettings[source]

Produce a copy of the settings instance.

abstract extend(other: Mapping[str, Any]) BaseSettings[source]

Merge another mapping to produce a new settings instance.

get_bool(*var_names, default: Optional[bool] = None) Optional[bool][source]

Fetch a setting as a boolean value.

Parameters
  • var_names – A list of variable name alternatives

  • default – The default value to return if none are defined

get_int(*var_names, default: Optional[int] = None) Optional[int][source]

Fetch a setting as an integer value.

Parameters
  • var_names – A list of variable name alternatives

  • default – The default value to return if none are defined

get_str(*var_names, default: Optional[str] = None) Optional[str][source]

Fetch a setting as a string value.

Parameters
  • var_names – A list of variable name alternatives

  • default – The default value to return if none are defined

abstract get_value(*var_names, default: Optional[Any] = None) Any[source]

Fetch a setting.

Parameters
  • var_names – A list of variable name alternatives

  • default – The default value to return if none are defined

Returns

The setting value, if defined, otherwise the default value

abstract to_dict() dict[source]

Return a dict of the settings instance.

exception aries_cloudagent.config.base.ConfigError(*args, error_code: Optional[str] = None, **kwargs)[source]

Bases: BaseError

A base exception for all configuration errors.

exception aries_cloudagent.config.base.InjectionError(*args, error_code: Optional[str] = None, **kwargs)[source]

Bases: ConfigError

The base exception raised by Injector and Provider implementations.

exception aries_cloudagent.config.base.SettingsError(*args, error_code: Optional[str] = None, **kwargs)[source]

Bases: ConfigError

The base exception raised by BaseSettings implementations.

aries_cloudagent.config.base_context module

Base injection context builder classes.

class aries_cloudagent.config.base_context.ContextBuilder(settings: Optional[Mapping[str, Any]] = None)[source]

Bases: ABC

Base injection context builder class.

abstract async build_context() InjectionContext[source]

Build the base injection context.

update_settings(settings: Mapping[str, object])[source]

Update the context builder with additional settings.

aries_cloudagent.config.default_context module

Classes for configuring the default injection context.

class aries_cloudagent.config.default_context.DefaultContextBuilder(settings: Optional[Mapping[str, Any]] = None)[source]

Bases: ContextBuilder

Default context builder.

async bind_providers(context: InjectionContext)[source]

Bind various class providers.

async build_context() InjectionContext[source]

Build the base injection context; set DIDComm prefix to emit.

async load_plugins(context: InjectionContext)[source]

Set up plugin registry and load plugins.

aries_cloudagent.config.error module

Errors for config modules.

exception aries_cloudagent.config.error.ArgsParseError(*args, error_code: Optional[str] = None, **kwargs)[source]

Bases: ConfigError

Error raised when there is a problem parsing the command-line arguments.

aries_cloudagent.config.injection_context module

Injection context implementation.

class aries_cloudagent.config.injection_context.InjectionContext(*, settings: Optional[Mapping[str, object]] = None, enforce_typing: bool = True)[source]

Bases: BaseInjector

Manager for configuration settings and class providers.

ROOT_SCOPE = 'application'
copy() InjectionContext[source]

Produce a copy of the injector instance.

inject(base_cls: Type[InjectType], settings: Optional[Mapping[str, object]] = None) InjectType[source]

Get the provided instance of a given class identifier.

Parameters
  • cls – The base class to retrieve an instance of

  • settings – An optional mapping providing configuration to the provider

Returns

An instance of the base class, or None

inject_or(base_cls: Type[InjectType], settings: Optional[Mapping[str, object]] = None, default: Optional[InjectType] = None) Optional[InjectType][source]

Get the provided instance of a given class identifier or default if not found.

Parameters
  • base_cls – The base class to retrieve an instance of

  • settings – An optional dict providing configuration to the provider

  • default – default return value if no instance is found

Returns

An instance of the base class, or None

property injector: Injector

Accessor for scope-specific injector.

injector_for_scope(scope_name: str) Injector[source]

Fetch the injector for a specific scope.

Parameters

scope_name – The unique scope identifier

property scope_name: str

Accessor for the current scope name.

property settings: Settings

Accessor for scope-specific settings.

start_scope(scope_name: str, settings: Optional[Mapping[str, object]] = None) InjectionContext[source]

Begin a new named scope.

Parameters
  • scope_name – The unique name for the scope being entered

  • settings – An optional mapping of additional settings to apply

Returns

A new injection context representing the scope

update_settings(settings: Mapping[str, object])[source]

Update the scope with additional settings.

exception aries_cloudagent.config.injection_context.InjectionContextError(*args, error_code: Optional[str] = None, **kwargs)[source]

Bases: InjectionError

Base class for issues in the injection context.

class aries_cloudagent.config.injection_context.Scope(name, injector)

Bases: tuple

injector

Alias for field number 1

name

Alias for field number 0

aries_cloudagent.config.injector module

Standard Injector implementation.

class aries_cloudagent.config.injector.Injector(settings: Optional[Mapping[str, object]] = None, *, enforce_typing: bool = True)[source]

Bases: BaseInjector

Injector implementation with static and dynamic bindings.

bind_instance(base_cls: Type[InjectType], instance: InjectType)[source]

Add a static instance as a class binding.

bind_provider(base_cls: Type[InjectType], provider: BaseProvider, *, cache: bool = False)[source]

Add a dynamic instance resolver as a class binding.

clear_binding(base_cls: Type[InjectType])[source]

Remove a previously-added binding.

copy() BaseInjector[source]

Produce a copy of the injector instance.

get_provider(base_cls: Type[InjectType])[source]

Find the provider associated with a class binding.

inject(base_cls: Type[InjectType], settings: Optional[Mapping[str, object]] = None) InjectType[source]

Get the provided instance of a given class identifier.

Parameters
  • cls – The base class to retrieve an instance of

  • params – An optional dict providing configuration to the provider

Returns

An instance of the base class, or None

inject_or(base_cls: Type[InjectType], settings: Optional[Mapping[str, object]] = None, default: Optional[InjectType] = None) Optional[InjectType][source]

Get the provided instance of a given class identifier or default if not found.

Parameters
  • base_cls – The base class to retrieve an instance of

  • settings – An optional dict providing configuration to the provider

  • default – default return value if no instance is found

Returns

An instance of the base class, or None

property settings: Settings

Accessor for scope-specific settings.

aries_cloudagent.config.ledger module

Ledger configuration.

async aries_cloudagent.config.ledger.accept_taa(ledger: BaseLedger, profile: Profile, taa_info, provision: bool = False) bool[source]

Perform TAA acceptance.

async aries_cloudagent.config.ledger.fetch_genesis_transactions(genesis_url: str) str[source]

Get genesis transactions.

async aries_cloudagent.config.ledger.get_genesis_transactions(settings: Settings) str[source]

Fetch genesis transactions if necessary.

async aries_cloudagent.config.ledger.ledger_config(profile: Profile, public_did: str, provision: bool = False) bool[source]

Perform Indy ledger configuration.

async aries_cloudagent.config.ledger.load_multiple_genesis_transactions_from_config(settings: Settings)[source]

Fetch genesis transactions for multiple ledger configuration.

async aries_cloudagent.config.ledger.select_aml_tty(taa_info, provision: bool = False) Optional[str][source]

Select acceptance mechanism from AML.

aries_cloudagent.config.logging module

aries_cloudagent.config.plugin_settings module

Settings implementation for plugins.

class aries_cloudagent.config.plugin_settings.PluginSettings(values: Optional[Mapping[str, Any]] = None)[source]

Bases: BaseSettings

Retrieve immutable settings for plugins.

Plugin settings should be retrieved by calling:

PluginSettings.for_plugin(settings, “my_plugin”, {“default”: “values”})

This will extract the PLUGIN_CONFIG_KEY in “settings” and return a new PluginSettings instance.

copy() BaseSettings[source]

Produce a copy of the settings instance.

extend(other: Mapping[str, Any]) BaseSettings[source]

Merge another settings instance to produce a new instance.

classmethod for_plugin(settings: BaseSettings, plugin: str, default: Optional[Mapping[str, Any]] = None) PluginSettings[source]

Construct a PluginSettings object from another settings object.

PLUGIN_CONFIG_KEY is read from settings.

get_value(*var_names: str, default: Optional[Any] = None)[source]

Fetch a setting.

Parameters
  • var_names – A list of variable name alternatives

  • default – The default value to return if none are defined

to_dict() dict[source]

Return a dict of the settings instance.

aries_cloudagent.config.provider module

Service provider implementations.

class aries_cloudagent.config.provider.CachedProvider(provider: BaseProvider, unique_settings_keys: tuple = ())[source]

Bases: BaseProvider

Cache the result of another provider.

provide(config: BaseSettings, injector: BaseInjector)[source]

Provide the object instance given a config and injector.

Instances are cached keyed on a SHA256 digest of the relevant subset of settings.

class aries_cloudagent.config.provider.ClassProvider(instance_cls: Union[str, type], *ctor_args, init_method: Optional[str] = None, **ctor_kwargs)[source]

Bases: BaseProvider

Provider for a particular class.

class Inject(base_cls: type)[source]

Bases: object

A class for passing injected arguments to the constructor.

provide(config: BaseSettings, injector: BaseInjector)[source]

Provide the object instance given a config and injector.

class aries_cloudagent.config.provider.InstanceProvider(instance)[source]

Bases: BaseProvider

Provider for a previously-created instance.

provide(config: BaseSettings, injector: BaseInjector)[source]

Provide the object instance given a config and injector.

class aries_cloudagent.config.provider.StatsProvider(provider: BaseProvider, methods: Sequence[str], *, ignore_missing: bool = True)[source]

Bases: BaseProvider

Add statistics to the results of another provider.

provide(config: BaseSettings, injector: BaseInjector)[source]

Provide the object instance given a config and injector.

aries_cloudagent.config.settings module

Settings implementation.

class aries_cloudagent.config.settings.Settings(values: Optional[Mapping[str, Any]] = None)[source]

Bases: BaseSettings, MutableMapping[str, Any]

Mutable settings implementation.

clear_value(var_name: str)[source]

Remove a setting.

Parameters

var_name – The name of the setting

copy() BaseSettings[source]

Produce a copy of the settings instance.

extend(other: Mapping[str, Any]) BaseSettings[source]

Merge another settings instance to produce a new instance.

for_plugin(plugin: str, default: Optional[Mapping[str, Any]] = None)[source]

Retrieve settings for plugin.

get_value(*var_names, default=None)[source]

Fetch a setting.

Parameters
  • var_names – A list of variable name alternatives

  • default – The default value to return if none are defined

set_default(var_name: str, value)[source]

Add a setting if not currently defined.

Parameters
  • var_name – The name of the setting

  • value – The value to assign

set_value(var_name: str, value)[source]

Add a setting.

Parameters
  • var_name – The name of the setting

  • value – The value to assign

to_dict() dict[source]

Return a dict of the settings instance.

update(other: Mapping[str, Any])[source]

Update the settings in place.

aries_cloudagent.config.util module

aries_cloudagent.config.wallet module