DefaultConfigFetcher (autotransform.config.default)

A ConfigFetcher that uses config files for configuration.

class autotransform.config.default.DefaultConfigFetcher

Bases: ConfigFetcher

The default configuration fetcher that pulls from the config files. Three possible files are used:

  • a file within the AutoTransform package itself, located at autotransform-config/config.json

  • a file within the repo, located at {repo_root}/autotransform/config.json

  • a file relative to the current working directory, located at {cwd}/autotransform/config.json

Settings from files later in the list will override settings from files earlier in the list. CWD configs will have the greatest priority, followed by repo configs, then the overall config.

FILE_NAME

The name of the file that stores the Config.

Type

ClassVar[str]

FILE_NAME: ClassVar[str] = 'config.json'
get_config() Config

Fetch the Config.

Returns

The Config for AutoTransform.

Return type

Config

static get_cwd_config_dir() str

Gets the directory where an AutoTransform config file would be located relative to the current working directory. The environment variable AUTO_TRANSFORM_CWD_CONFIG_PATH can be used to set the relative path to the config.json file for CWD configs.

Returns

The directory of the cwd config file.

Return type

str

static get_repo_config_dir() Optional[str]

Gets the directory where a repo-specific AutoTransform config file would be located. None if git fails. The environment variable AUTO_TRANSFORM_REPO_CONFIG_PATH can be used to set the relative path to the config.json file for repo configs.

Returns

The directory of the repo config file. None if git fails.

Return type

Optional[str]

static get_repo_config_relative_path() str

Gets the relative path used for the repo config directory.

Returns

The relative path to the config.

Return type

str