doot.control.overlord

Type Aliases

Logger

Classes

StartupController

PluginsController

DootOverlord

The main control point of Doot

OverlordFacade

A Facade for the overlord, to be used as the module class

Module Contents

doot.control.overlord.Logger: TypeAlias = logmod.Logger
class doot.control.overlord.StartupController[source]
DO: TypeAlias = DootOverlord
null_setup(obj: DO) None[source]

Doesn’t load anything but constants, Used for initialising Doot when testing. Doesn’t set the is_setup flag.

Parameters:

obj (DO)

Return type:

None

setup(
obj: DO,
*,
targets: jgdv.Maybe[list[Loadable]] = None,
prefix: jgdv.Maybe[str] = None,
) None[source]

The core requirement to call before any other doot code is run. loads the config files, so everything else can retrieve values when imported.

prefix removes a prefix from the loaded data. eg: ‘tool.doot’ for if putting doot settings in a pyproject.toml

targets=False is for loading nothing, for testing

Parameters:
  • obj (DO)

  • targets (jgdv.Maybe[list[Loadable]])

  • prefix (jgdv.Maybe[str])

Return type:

None

_load_config(
obj: DO,
*,
targets: jgdv.Maybe[list[Loadable]],
prefix: jgdv.Maybe[str],
) None[source]

Load a specified config, or one of the defaults if it exists

Parameters:
  • obj (DO)

  • targets (jgdv.Maybe[list[Loadable]])

  • prefix (jgdv.Maybe[str])

Return type:

None

_load_constants(
obj: DO,
*,
target: jgdv.Maybe[Loadable] = None,
) None[source]

Load the override constants if the loaded base config specifies one Modifies the global doot.constants

Parameters:
  • obj (DO)

  • target (jgdv.Maybe[Loadable])

Return type:

None

_load_aliases(
obj: DO,
*,
target: jgdv.Maybe[Loadable] = None,
force: bool = False,
) None[source]

Load plugin aliases from a toml file

if forced, will append additional aliases on top of existing

Parameters:
  • obj (DO)

  • target (jgdv.Maybe[Loadable])

  • force (bool)

Return type:

None

_load_locations(obj: DO) None[source]

Load and update the JGDVLocator db

Parameters:

obj (DO)

Return type:

None

class doot.control.overlord.PluginsController[source]
DO: TypeAlias = DootOverlord
load(obj: DO) None[source]
Parameters:

obj (DO)

Return type:

None

_load_plugins(obj: DootOverlord) None[source]

Use the plugin loader to find all applicable `importlib.EntryPoint`s

Parameters:

obj (DootOverlord)

Return type:

None

_load_commands(
obj: DootOverlord,
*,
loader: str = 'default',
) None[source]

Select Commands from the discovered loaded_plugins, using the preferred cmd loader or the default

Parameters:
Return type:

None

_load_tasks(
obj: DootOverlord,
*,
loader: str = 'default',
) None[source]

Load task entry points, using the preferred task loader, or the default

Parameters:
Return type:

None

class doot.control.overlord.DootOverlord(*args: Any, **kwargs: Any)[source]

The main control point of Doot The setup logic of doot.

As Doot uses loaded config data throughout, using the doot.config.on_fail… pattern, the top-level package ‘doot’, uses a module getattr to offload attribute access to this class.

Adapted from https://stackoverflow.com/questions/880530

Parameters:
  • args (Any)

  • kwargs (Any)

_startup: ClassVar[StartupController]
_plugin: ClassVar[PluginsController]
global_task_state: dict[str, Any]
path_ext: list[str]
configs_loaded_from: list[str | pathlib.Path]
is_setup: bool
config
constants
aliases
loaded_plugins
loaded_cmds
loaded_tasks
cmd_aliases
args
locs
property report: doot.reporters._interface.Reporter_p[source]
Return type:

doot.reporters._interface.Reporter_p

_set_reporter(rep: Any) None[source]
Parameters:

rep (Any)

Return type:

None

setup(
*,
targets: jgdv.Maybe[list[Loadable]] = None,
prefix: jgdv.Maybe[str] = None,
) None[source]
Parameters:
  • targets (jgdv.Maybe[list[Loadable]])

  • prefix (jgdv.Maybe[str])

Return type:

None

load() None[source]
Return type:

None

load_reporter(target: str = 'default') None[source]
Parameters:

target (str)

Return type:

None

verify_config_version(
ver: jgdv.Maybe[str],
source: jgdv.Maybe[str | pathlib.Path],
*,
override: jgdv.Maybe[str] = None,
) None[source]

Ensure the config file is compatible with doot

Compatibility is based on MAJOR.MINOR and discards PATCH

Raises a VersionMismatchError otherwise if they aren’t compatible

Parameters:
Return type:

None

update_aliases(
*,
data: dict | jgdv.structs.chainguard.ChainGuard,
) None[source]

Update aliases with a dict-like of loaded mappings

Parameters:

data (dict | jgdv.structs.chainguard.ChainGuard)

Return type:

None

update_global_task_state(
data: jgdv.structs.chainguard.ChainGuard,
*,
source: jgdv.Maybe[str] = None,
) None[source]

Try to Update the shared global state. Will try to get data[doot._interface.GLOBAL_STATE_KEY] data and add it to the global task state

toml in [[state]] segments is merged here

Parameters:
  • data (jgdv.structs.chainguard.ChainGuard)

  • source (jgdv.Maybe[str])

Return type:

None

update_import_path(*paths: pathlib.Path) None[source]

Add locations to the python path for task local code importing Modifies the global sys.path

Parameters:

paths (pathlib.Path)

Return type:

None

update_cmd_args(
data: jgdv.cli._interface.ParseReport_d | dict,
*,
override: bool = False,
) None[source]

update global args that cmd’s use for control flow

Parameters:
  • data (jgdv.cli._interface.ParseReport_d | dict)

  • override (bool)

Return type:

None

class doot.control.overlord.OverlordFacade(*args, **kwargs)[source]

Bases: types.ModuleType

A Facade for the overlord, to be used as the module class of the root package ‘doot’.

_overlord: doot.control._interface.Overlord_i