quickie.Namespace

class quickie.Namespace(mapping=None, path: str = '', separator: str = ':', factory: Callable[[], Any] | None = None)

Used to group tasks and modules under a shared path prefix.

A Namespace can be populated eagerly (via mapping or add()) or lazily (via factory). When a factory is provided the function is not called until the first time items() is accessed, which lets you defer expensive imports:

@namespace
def ci():
    from . import heavy  # imported only when ci tasks are needed
    return [heavy]

The factory may return:

  • a dict mapping path strings to tasks/modules/iterables

  • a list (or any iterable) of tasks/modules — shorthand for {"": [...]}

  • a single task or module — shorthand for {"": [obj]}

Pass mapping or factory, not both.

__init__(mapping=None, path: str = '', separator: str = ':', factory: Callable[[], Any] | None = None)

Methods

__init__([mapping, path, separator, factory])

add(obj[, path])

Add an object (task, module, or list thereof) under a path.

items()

Return the internal (full_path, objects) pairs, resolving lazily.

update(mapping)

Add all entries from mapping into this namespace.