Module ds.parsers.ds_toml

ds.toml parser.

Global variables

var PROPERTY_ALIASES

Aliased property names.

Functions

def loads(s: str, /, *, parse_float: ParseFloat = builtins.float) ‑> dict[str, typing.Any]

Parse TOML from a string.

def parse_workspace(config: Config, key: str = 'workspace') ‑> Dict[pathlib.Path, bool]

Workspaces are in workspace (ds.toml) or tool.ds.workspace (pyproject.toml).

def parse_tasks(config: Config, key: str = 'scripts') ‑> Dict[str, Task]

Tasks in scripts (ds.toml) or tool.ds.scripts (pyproject.toml).

Features: - Supported: disabled task - Supported: task.help - task description - Supported: task.cmd - basic task - Supported: task.args - argument interpolation - Supported: task.cwd - working directory - Supported: task.depends - composite task - Supported: task.env - environments - Supported: task.keep_going - error suppression

def rename_aliases(item: Dict[str, Any], renames: Dict[str, str], overwrite: bool = False) ‑> Dict[str, Any]

Rename items in a dict.

>>> rename_aliases({'old': 'value'}, {'old': 'new'})
{'new': 'value'}
>>> rename_aliases({'old': 'value', 'new': 'other'}, {'old': 'new'}, overwrite=True)
{'new': 'value'}
>>> rename_aliases({'old': 'value', 'new': 'other'}, {'old': 'new'})
Traceback (most recent call last):
 ...
KeyError: ('old', 'new')
def parse_composite(task: Task, item: List[str]) ‑> Task

Parse composite task.

def parse_task(item: Any, name: str = '', path: Optional[pathlib.Path] = None, key: str = '') ‑> Task

Parse a task.