Skip to main content
Version: 1.5.0 (latest)

common.configuration.providers.toml

SettingsTomlProvider Objects

class SettingsTomlProvider(CustomLoaderDocProvider)

[view_source]

__init__

def __init__(name: str,
supports_secrets: bool,
file_name: str,
settings_dir: str,
global_dir: str = None) -> None

[view_source]

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 context
  • supports_secrets(bool) - allows to store secret values in this provider
  • file_name str - The name of toml file to load
  • settings_dir str, optional - The location of file_name. If not specified, defaults to $cwd/.dlt
  • global_dir bool, optional - Looks for file_name in global_dir (defaults to dlt home directory which in most cases is $HOME/.dlt)

Raises:

  • TomlProviderReadException - File could not be read, most probably toml parsing error

This demo works on codespaces. Codespaces is a development environment available for free to anyone with a Github account. You'll be asked to fork the demo repository and from there the README guides you with further steps.
The demo uses the Continue VSCode extension.

Off to codespaces!

DHelp

Ask a question

Welcome to "Codex Central", your next-gen help center, driven by OpenAI's GPT-4 model. It's more than just a forum or a FAQ hub – it's a dynamic knowledge base where coders can find AI-assisted solutions to their pressing problems. With GPT-4's powerful comprehension and predictive abilities, Codex Central provides instantaneous issue resolution, insightful debugging, and personalized guidance. Get your code running smoothly with the unparalleled support at Codex Central - coding help reimagined with AI prowess.