Config (autotransform.config.config)

The Config represents settings that control how AutoTransform operates.

class autotransform.config.config.Config(*, component_directory: str = None, github_token: str = None, github_base_url: str = None, local_runner: Runner = None, remote_runner: Runner = None)

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

local_runner

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

Type

Optional[Runner], optional

remote_runner

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

Type

Optional[Runner], optional

component_directory: Optional[str]
static from_console(prev_config: Optional[Config] = None, simple: bool = False, use_github: Optional[bool] = None, user_config: bool = False) Tuple[Config, 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.

  • 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.

Return type

Tuple[Config, 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_component_directory_from_console(prev_config: Optional[Config] = None, simple: bool = False) Optional[str]

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]

static get_github_base_url_from_console(prev_config: Optional[Config] = None, simple: bool = False) Optional[str]

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: Optional[Config] = None, simple: bool = False, user_config: bool = False) Optional[str]

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_local_runner_from_console(prev_config: Optional[Config] = None, simple: bool = False) Optional[Runner]

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_remote_runner_from_console(prev_config: Optional[Config] = None, use_github: bool = False, simple: bool = False) Optional[Runner]

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 None.

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

Returns

The local runner.

Return type

Optional[Runner]

github_base_url: Optional[str]
github_token: Optional[str]
local_runner: Optional[Runner]
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

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: Optional[Runner]
write(file_path: str) None

Writes the Config to a file as JSON.

Parameters

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