common.configuration.providers.toml
SettingsTomlProvider Objects
class SettingsTomlProvider(CustomLoaderDocProvider)
__init__
def __init__(name: str,
supports_secrets: bool,
file_name: str,
settings_dir: str,
global_dir: str = None) -> None
Creates config provider from a toml
file
The provider loads the toml
file with specified name and from specified folder. If global_dir
is specified,
it will additionally look for file_name
in dlt
global dir (home dir by default) and merge the content.
The "settings" (settings_dir
) values overwrite the "global" values.
If toml file under settings_dir
is not found it will look into Google Colab userdata object for a value
with name file_name
and load toml file from it.
If that one is not found, it will try to load Streamlit secrets.toml
file.
If none of the files exist, an empty provider is created.
Arguments:
name(str)
- name of the provider when registering in contextsupports_secrets(bool)
- allows to store secret values in this providerfile_name
str - The name oftoml
file to loadsettings_dir
str, optional - The location offile_name
. If not specified, defaults to $cwd/.dltglobal_dir
bool, optional - Looks forfile_name
in global_dir (defaults todlt
home directory which in most cases is $HOME/.dlt)
Raises:
TomlProviderReadException
- File could not be read, most probablytoml
parsing error