API¶
Targets¶
-
picard.
rule
(*args, **kwargs) → Callable[Callable[[picard.context.Context, Any], Awaitable[Any]], picard.typing.Target]¶ Turn a recipe function into a target.
The parameters are the prerequisites, which will be passed, evaluated, to the recipe.
Example
from pathlib import Path import picard @picard.rule() async def gitdir(context): path = Path('.git') if not path.is_dir(): picard.sh('git', 'init', '.') return path
-
picard.
pattern
() → Callable[Any, Callable[..., picard.typing.Target]]¶ Turn a recipe function into a target constructor.
The constructor’s parameters are the prerequisites, which will be passed, evaluated, to the recipe.
Example
import picard @picard.pattern() async def object_file(target, context, source): await picard.sh('gcc', '-c', source, '-o', target.name) hello_o = object_file('hello.o', 'hello.c') example_o = object_file('example.o', source='example.c')
Drivers¶
-
picard.
sync
(target: Any, context: picard.context.Context = None)¶ Swiss-army function to synchronize one or more targets.
Parameters: - targets – One or more targets. This function will recurse into functors like sequences and mappings. (Remember that mappings are functors over their values, not their keys.)
- context – An optional context. If
None
is passed (the default), an empty one will be created for you.
Returns: The value(s) of the targets in the same functor.
Return type: Traversable[Any]
-
picard.
make
(target: Any, config: Mapping[str, Any] = None, rules: Mapping[str, picard.typing.Target] = None)¶ Parse targets and configuration from the command line.