Framework for Python

Workflow

settings()

A settings value by dot-notation key, such as "directories.notebooks".

A one-part key is looked up in directories first, so settings("notebooks") returns the notebooks folder. With no key, the whole settings dict is returned. A missing key returns default.

Usage

settings(
    key: str | None = None,
    default: Any = None,
    settings_file: str | Path | None = None,
) -> Any

Arguments

Name Type Default Description
key str | None None

A dot-notation key. A one-part key is looked up in directories, then as <key>_dir in options, then at the top level. Default: the whole settings dict.

default Any None

The value returned when the key is missing.

settings_file str | Path | None None

The settings file. Default: settings.yml (or config.yml) in the current folder or the nearest parent folder that has one.

Value

The value, the whole settings dict, or default.

Raises

  • SettingsError: When the settings file is not found or cannot be parsed.