yera.cli.context

CLI application context passed to every command.

Symbols

class AppContext — Container passed to every CLI command as ``ctx``.

AppContext

Container passed to every CLI command as ctx.

settings is always populated (may be None when validation failed and the command tolerates it). hub_config and pyproject_hub are only populated when the command declares @requires(AppResource.HUB_CONFIG); accessing them without that declaration raises :class:RuntimeError.

credential_store and active_credential_group are only populated when the command declares @requires(AppResource.CREDENTIALS); accessing them without that declaration raises :class:RuntimeError.

Methods

set_hub_data — Populate hub config and the pyproject hub override atomically.
set_credentials_data — Populate credential store and active credential group atomically.
require_active_credential_group — Return the resolved active credential group or raise ``CredentialGroupNotSpecifiedError``.
set_provider_data — Populate provider config.
set_profile_data — Set the profile data in context.
set_models_universe — Set the model data in context.

AppContext.set_hub_data

set_hub_data(
    hub_config: HubConfig,
    pyproject_hub: str | None,
) → None

Populate hub config and the pyproject hub override atomically.

AppContext.set_credentials_data

set_credentials_data(
    credential_store: CredentialStore,
    active_credential_group: ResolvedCredentialGroup | None,
) → None

Populate credential store and active credential group atomically.

AppContext.require_active_credential_group

require_active_credential_group() → ResolvedCredentialGroup

Return the resolved active credential group or raise CredentialGroupNotSpecifiedError.

AppContext.set_provider_data

set_provider_data(
    providers: Providers,
) → None

Populate provider config.

AppContext.set_profile_data

set_profile_data(
    profiles: Profiles | None,
) → None

Set the profile data in context.

AppContext.set_models_universe

set_models_universe(
    models: ModelsUniverse | None,
) → None

Set the model data in context.