duck.cli.commands.sync.config

Loads and validates the [dependencies]/[development] sections of duck.toml.

Module Contents

Classes

DependencyGroup

A named collection of python and system dependencies.

DuckSyncConfig

Fully parsed representation of a project’s duck.toml file.

Functions

find_config

Walks upward from start looking for duck.toml.

load_config

Reads and validates a duck.toml file into a DuckSyncConfig.

parse_dependency_group

Builds a DependencyGroup from a [dependencies] or [development] table.

Data

CONFIG_FILENAME

API

duck.cli.commands.sync.config.CONFIG_FILENAME

‘duck.toml’

class duck.cli.commands.sync.config.DependencyGroup[source]

A named collection of python and system dependencies.

Parameters:
  • python – Python packages installable via pip/uv.

  • system – System level packages resolved through the OS package manager.

  • requirements – Path to a requirements.txt, relative to duck.toml. Installed alongside the python list rather than replacing it.

  • python_args – Extra CLI args appended to every python install command in this group, e.g. [“–no-cache-dir”].

  • python_package_args – Per-package extra args, keyed by package name, merged in after python_args.

  • system_args – Extra CLI args appended to every system install command in this group, e.g. [“–no-install-recommends”].

  • system_package_args – Per-package extra args for system installs, keyed by the generic name written in the system list.

python: list[str]

‘field(…)’

python_args: list[str]

‘field(…)’

python_package_args: dict[str, list[str]]

‘field(…)’

requirements: str = <Multiline-String>
system: list[str]

‘field(…)’

system_args: list[str]

‘field(…)’

system_package_args: dict[str, list[str]]

‘field(…)’

class duck.cli.commands.sync.config.DuckSyncConfig[source]

Fully parsed representation of a project’s duck.toml file.

Parameters:
  • dependencies – Required runtime dependencies.

  • development – Optional dependencies only needed for local development.

  • overrides – Per package name overrides for system package names, keyed by backend name (apt, brew, dnf, pacman, choco).

  • base_dir – Directory duck.toml lives in, used to resolve relative paths such as requirements.

  • use_sudo – Whether system installs should be prefixed with sudo. None means auto-detect: skip sudo when already running as root.

base_dir: pathlib.Path

‘field(…)’

dependencies: duck.cli.commands.sync.config.DependencyGroup

‘field(…)’

development: duck.cli.commands.sync.config.DependencyGroup

‘field(…)’

overrides: dict[str, dict[str, str]]

‘field(…)’

use_sudo: bool | None

None

duck.cli.commands.sync.config.find_config(start: pathlib.Path | None = None) pathlib.Path[source]

Walks upward from start looking for duck.toml.

Parameters:

start – Directory to begin searching from. Defaults to the cwd.

Returns:

Path to the discovered duck.toml file.

Raises:

ConfigNotFoundError – If no duck.toml is found up to the filesystem root.

duck.cli.commands.sync.config.load_config(path: pathlib.Path | None = None) duck.cli.commands.sync.config.DuckSyncConfig[source]

Reads and validates a duck.toml file into a DuckSyncConfig.

Parameters:

path – Explicit path to a duck.toml file. Auto discovered when omitted.

Returns:

The parsed configuration.

Raises:

ConfigParseError – If the file exists but is malformed.

duck.cli.commands.sync.config.parse_dependency_group(raw: dict) duck.cli.commands.sync.config.DependencyGroup[source]

Builds a DependencyGroup from a [dependencies] or [development] table.

Parameters:

raw – The raw dict for that TOML table.

Returns:

The parsed DependencyGroup.