Config
invoke_tasklib.config ¶
Config resolution for invoke-tasklib tasks.
Consuming projects set project-specific values under a tasklib key in
their invoke.yaml, e.g.::
tasklib:
package:
name: coola
paths:
docs_config: docs/mkdocs.yml
Only package.name is required; everything else has a default derived
from it.
invoke_tasklib.config.GroupsConfig ¶
Bases: TypedDict
Resolved groups config section.
invoke_tasklib.config.PackageConfig ¶
Bases: TypedDict
Resolved package config section.
invoke_tasklib.config.PathsConfig ¶
Bases: TypedDict
Resolved paths config section.
invoke_tasklib.config.TasklibConfig ¶
Bases: TypedDict
Resolved tasklib config.
invoke_tasklib.config.get_config ¶
get_config(c: Context) -> TasklibConfig
Return the effective tasklib config, merging user overrides from
invoke.yaml (under the tasklib key) on top of the defaults.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
c
|
Context
|
The invoke context. |
required |
Returns:
| Type | Description |
|---|---|
TasklibConfig
|
A dict with resolved |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Example usage:
>>> from invoke.config import Config
>>> from invoke.context import Context
>>> from invoke_tasklib.config import get_config
>>> c = Context(config=Config(overrides={"tasklib": {"package": {"name": "mypkg"}}}))
>>> cfg = get_config(c)
>>> cfg["package"]
{'name': 'mypkg', 'python_version': '3.14'}
>>> cfg["paths"]["src"]
'src/mypkg'
>>> cfg["groups"]
{'install': 'dev', 'update': 'dev,docs'}