Config (autotransform.config.config)

The Config represents settings that control how AutoTransform operates.

class autotransform.config.config.Config(*, component_directory: str | None = None, github_token: str | None = None, github_base_url: str | None = None, jenkins_user: str | None = None, jenkins_token: str | None = None, jenkins_base_url: str | None = None, local_runner: Runner | None = None, anthropic_api_key: str | None = None, open_ai_api_key: str | None = None, remote_runner: Runner | None = None, repo_override: Repo | None = None, event_notifiers: List[Dict[str, Any]] = [{'name': EventNotifierName.CONSOLE}])

Bases: ComponentModel

A collection of settings for configuring the functionality of AutoTransform.

component_directory

The directory where custom component JSON files are located. If not provided, autotransform/ will be used. Defaults to None.

Type:

Optional[str], optional

github_token

The Github token to use for authentication. Defaults to None.

Type:

Optional[str], optional

github_base_url

The base URL for API requests to Github. Used for Github Enterprise. Defaults to None.

Type:

Optional[str], optional

jenkins_user

The Jenkins username for authentication. Defaults to None.

Type:

Optional[str], optional

jenkins_token

The Jenkins token to use for authentication. Defaults to None.

Type:

Optional[str], optional

jenkins_base_url

The base URL for requests to Jenkins. Defaults to None.

Type:

Optional[str], optional

local_runner

The Runner to use for local runs. Defaults to None.

Type:

Optional[Runner], optional

anthropic_api_key

The API key to use for Anthropic completitions. Defaults to None.

Type:

Optional[str], optional

open_ai_api_key

The API key to use for OpenAI completitions. Defaults to None.

Type:

Optional[str], optional

remote_runner

The runner to use for remote runs. Defaults to None.

Type:

Optional[Runner], optional

repo_override

A repo to use in place of any schema repos. Defaults to None.

Type:

Optional[Repo], optional

event_notifiers

The EventNotifiers to use. Defaults to a list containing just the ConsoleEventNotifier bundle.

Type:

List[Dict[str, Any]], optional

anthropic_api_key: str | None
component_directory: str | None
event_notifiers: List[Dict[str, Any]]
static from_console(prev_config: Config | None = None, simple: bool = False, use_github: bool | None = None, use_jenkins: bool | None = None, user_config: bool = False) Tuple[Config, bool, bool]

Gets a Config using console inputs.

Parameters:
  • prev_config (Optional[Config], optional) – Previously input Config. Defaults to None.

  • simple (bool, optional) – Whether to use the simple setup. Defaults to False.

  • use_github (bool, optional) – Whether to use Github or not. Defaults to None.

  • use_jenkins (bool, optional) – Whether to use Jenkins or not. Defaults to None.

  • user_config (bool, optional) – Whether this configuration is for a user level Config. Defaults to False.

Returns:

The input Config and whether it uses Github and Jenkins.

Return type:

Tuple[Config, bool, bool]

static from_data(data: Dict[str, Any]) Config

Produces an instance of the Config from decoded data.

Parameters:

data (Mapping[str, Any]) – The JSON decoded data.

Returns:

An instance of the Config.

Return type:

Config

static from_json(config_json: str) Config

Builds a Config from JSON encoded values.

Parameters:

config_json (str) – The JSON encoded Config.

Returns:

The Config from the JSON.

Return type:

Config

static get_anthropic_api_key_from_console(prev_config: Config | None = None, simple: bool = False, user_config: bool = False) str | None

Gets the Anthropic API key using console inputs.

Parameters:
  • prev_config (Optional[Config], optional) – Previously input Config. Defaults to None.

  • simple (bool, optional) – Whether to use the simple setup. Defaults to False.

  • user_config (bool, optional) – Whether this configuration is for a user level Config. Defaults to False.

Returns:

The Anthropic API key.

Return type:

Optional[str]

static get_component_directory_from_console(prev_config: Config | None = None, simple: bool = False) str | None

Gets the component directory using console inputs.

Parameters:
  • prev_config (Optional[Config], optional) – Previously input Config. Defaults to None.

  • simple (bool, optional) – Whether to use the simple setup. Defaults to False.

Returns:

The component directory.

Return type:

Optional[str]

get_event_notifiers() List[EventNotifier]

Gets the EventNotifier objects.

Returns:

The list of EventNotifier objects.

Return type:

List[EventNotifier]

static get_github_base_url_from_console(prev_config: Config | None = None, simple: bool = False) str | None

Gets the Github base URL using console inputs.

Parameters:
  • prev_config (Optional[Config], optional) – Previously input Config. Defaults to None.

  • simple (bool, optional) – Whether to use the simple setup. Defaults to False.

Returns:

The Github base URL.

Return type:

Optional[str]

static get_github_token_from_console(prev_config: Config | None = None, simple: bool = False, user_config: bool = False) str | None

Gets the Github token using console inputs.

Parameters:
  • prev_config (Optional[Config], optional) – Previously input Config. Defaults to None.

  • simple (bool, optional) – Whether to use the simple setup. Defaults to False.

  • user_config (bool, optional) – Whether this configuration is for a user level Config. Defaults to False.

Returns:

The Github token.

Return type:

Optional[str]

static get_jenkins_base_url_from_console(prev_config: Config | None = None, simple: bool = False) str | None

Gets the Jenkins base URL using console inputs.

Parameters:
  • prev_config (Optional[Config], optional) – Previously input Config. Defaults to None.

  • simple (bool, optional) – Whether to use the simple setup. Defaults to False.

Returns:

The Jenkins base URL.

Return type:

Optional[str]

static get_jenkins_token_from_console(prev_config: Config | None = None, simple: bool = False, user_config: bool = False) str | None

Gets the Jenkins token using console inputs.

Parameters:
  • prev_config (Optional[Config], optional) – Previously input Config. Defaults to None.

  • simple (bool, optional) – Whether to use the simple setup. Defaults to False.

  • user_config (bool, optional) – Whether this configuration is for a user level Config. Defaults to False.

Returns:

The Jenkins token.

Return type:

Optional[str]

static get_jenkins_user_from_console(prev_config: Config | None = None, simple: bool = False) str | None

Gets the Jenkins user using console inputs.

Parameters:
  • prev_config (Optional[Config], optional) – Previously input Config. Defaults to None.

  • simple (bool, optional) – Whether to use the simple setup. Defaults to False.

Returns:

The Jenkins user.

Return type:

Optional[str]

static get_local_runner_from_console(prev_config: Config | None = None, simple: bool = False) Runner | None

Gets the local runner using console inputs.

Parameters:
  • prev_config (Optional[Config], optional) – Previously input Config. Defaults to None.

  • simple (bool, optional) – Whether to use the simple setup. Defaults to False.

Returns:

The local runner.

Return type:

Optional[Runner]

static get_open_ai_api_key_from_console(prev_config: Config | None = None, simple: bool = False, user_config: bool = False) str | None

Gets the OpenAI API key using console inputs.

Parameters:
  • prev_config (Optional[Config], optional) – Previously input Config. Defaults to None.

  • simple (bool, optional) – Whether to use the simple setup. Defaults to False.

  • user_config (bool, optional) – Whether this configuration is for a user level Config. Defaults to False.

Returns:

The OpenAI API key.

Return type:

Optional[str]

static get_remote_runner_from_console(prev_config: Config | None = None, use_github: bool = False, use_jenkins: bool = False, simple: bool = False) Runner | None

Gets the remote runner using console inputs.

Parameters:
  • prev_config (Optional[Config], optional) – Previously input Config. Defaults to None.

  • use_github (bool, optional) – Whether to use Github or not. Defaults to False.

  • use_jenkins (bool, optional) – Whether to use Jenkins or not. Defaults to False.

  • simple (bool, optional) – Whether to use the simple setup. Defaults to False.

Returns:

The local runner.

Return type:

Optional[Runner]

static get_repo_override_from_console(prev_config: Config | None = None, simple: bool = False) Repo | None

Gets the repo override using console inputs.

Parameters:
  • prev_config (Optional[Config], optional) – Previously input Config. Defaults to None.

  • simple (bool, optional) – Whether to use the simple setup. Defaults to False.

Returns:

The repo override.

Return type:

Optional[Repo]

github_base_url: str | None
github_token: str | None
jenkins_base_url: str | None
jenkins_token: str | None
jenkins_user: str | None
local_runner: Runner | None
merge(other: Config) Config

Merges the Config with another Config. Settings in the other Config will override those in this Config.

Parameters:

other (Config) – The Config to be merged with.

Returns:

The merged Config.

Return type:

Config

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

open_ai_api_key: str | None
static read(file_path: str) Config

Reads the Config from a JSON encoded file.

Parameters:

file_path (str) – The path where the JSON for the Config is located.

Returns:

The Config from the file.

Return type:

Config

remote_runner: Runner | None
repo_override: Repo | None
write(file_path: str) None

Writes the Config to a file as JSON.

Parameters:

file_path (str) – The file to write the Config to.