A task-centric build system with simple declarative recipes specified in Python
Project description
🧑🍳 Cook

Cook is a task-centric build system with simple declarative recipes specified in Python.
Getting Started
Tasks are declared in a recipe.py file using the cook.manager.create_task function. Each task must have a unique name, may depend on files or other tasks, and can execute an action, typically a shell command. The simple example below creates a C source file, compiles it, and executes the binary.
>>> from cook import create_task
>>> create_task("src", targets=["hello.c"],
... action="echo 'int main() { return 0; }' > hello.c")
>>> create_task("cc", dependencies=["hello.c"], targets=["hello"],
... action="cc -o hello hello.c")
>>> create_task("hello", dependencies=["hello"], action="./hello")
Running cook ls from the command line lists all known tasks, e.g.,
$ cook ls
<task `src` @ /.../recipe.py:3>
<task `cc` @ /.../recipe.py:6>
<task `hello` @ /.../recipe.py:9>
Running cook exec hello creates the source file, compiles it, and executes the binary (using --log-level=debug can provide additional information).
$ cook exec hello
INFO: executing <task `src` @ /.../recipe.py:3> ...
INFO: completed <task `src` @ /.../recipe.py:3> in 0:00:...
INFO: executing <task `cc` @ /.../recipe.py:6> ...
INFO: completed <task `cc` @ /.../recipe.py:6> in 0:00:...
INFO: executing <task `hello` @ /.../recipe.py:9> ...
INFO: completed <task `hello` @ /.../recipe.py:9> in 0:00:...
To rerun a task, tell Cook to reset it.
$ cook reset cc
INFO: reset 1 task
The full set of available commands can be explored using cook --help as shown below.
$ cook --help
usage: cook [-h] [--recipe RECIPE] [--module MODULE] [--db DB]
[--log-level {warning,error,info,debug}]
{exec,ls,info,reset} ...
positional arguments:
{exec,ls,info,reset}
exec Execute one or more tasks.
ls List tasks.
info Display information about one or more tasks.
reset Reset the status of one or more tasks.
options:
-h, --help show this help message and exit
--recipe RECIPE file containing declarative recipe for tasks
--module, -m MODULE module containing declarative recipe for tasks
--db DB database for keeping track of assets
--log-level {warning,error,info,debug}
log level
Tasks Are Dumb; Contexts Are Smart
cook.task.Tasks do not provide any functionality beyond storing metadata, including
targets, the files generated by the task,dependencies, the files the task depends on,action, thecook.actions.Actionto execute when the task is run,task_dependencies, other tasks that should be executed first,location, filename and line number where the task was defined.
All logic is handled by cook.contexts.Contexts which are applied to each task when it is created. For example, cook.contexts.create_group adds all tasks created within the context to a group. This group can be executed to execute all child tasks.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cook_build-0.7.6.tar.gz.
File metadata
- Download URL: cook_build-0.7.6.tar.gz
- Upload date:
- Size: 29.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fde40538e2bb6a57f26c13f352a48874aafa1790eb5463a1dbbbf2d547ef9585
|
|
| MD5 |
ecc02d1d82c525815a5d952e55b4af06
|
|
| BLAKE2b-256 |
f0b6cc8e801b39218887a0a5fedcc721294db0e6609c9b0019de70dee248ed6b
|
Provenance
The following attestation bundles were made for cook_build-0.7.6.tar.gz:
Publisher:
main.yaml on tillahoffmann/cook-build
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cook_build-0.7.6.tar.gz -
Subject digest:
fde40538e2bb6a57f26c13f352a48874aafa1790eb5463a1dbbbf2d547ef9585 - Sigstore transparency entry: 996377871
- Sigstore integration time:
-
Permalink:
tillahoffmann/cook-build@e9416440befe3aff62a467f09ead81a66049da93 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/tillahoffmann
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
main.yaml@e9416440befe3aff62a467f09ead81a66049da93 -
Trigger Event:
push
-
Statement type:
File details
Details for the file cook_build-0.7.6-py3-none-any.whl.
File metadata
- Download URL: cook_build-0.7.6-py3-none-any.whl
- Upload date:
- Size: 22.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
20309aec5a1bd776da1738d9681236472ede3b1bb3ab6c26eee5f8da1f11f26f
|
|
| MD5 |
d49408ddf2bc10014d8d8a1ca81b6f6d
|
|
| BLAKE2b-256 |
5d74f40148b4ba7e9b7380385411296717af76a7eb30358cb52c665a8f9b8259
|
Provenance
The following attestation bundles were made for cook_build-0.7.6-py3-none-any.whl:
Publisher:
main.yaml on tillahoffmann/cook-build
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cook_build-0.7.6-py3-none-any.whl -
Subject digest:
20309aec5a1bd776da1738d9681236472ede3b1bb3ab6c26eee5f8da1f11f26f - Sigstore transparency entry: 996377894
- Sigstore integration time:
-
Permalink:
tillahoffmann/cook-build@e9416440befe3aff62a467f09ead81a66049da93 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/tillahoffmann
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
main.yaml@e9416440befe3aff62a467f09ead81a66049da93 -
Trigger Event:
push
-
Statement type: