Create a file named bakefile.py:
Or generate one automatically:
Run your tasks:
What just happened
MyBakebook subclasses Bakebook, so its methods become tasks. Tasks defined before instantiating use the @command() decorator on class methods.
- Standalone functions work too. Attach them after instantiating with
@bakebook.command().
- Task arguments become typed CLI options.
name: str = "world" gives you --name with a default, and --help documents itself.
self.ctx.run() executes real CLI commands through Python’s subprocess. console.echo() prints your task’s output.
Where to go next
- Bakebook - classes, configuration, and the
@command decorator
- Commands - typed arguments, custom flags, and decorator options
- Context -
ctx.run() and everything it accepts
- Examples - complete bakefiles to copy, from a standalone single file to a full Python package
- Common errors and fixes - exact error messages and how to fix them
Last modified on September 6, 2026