Skip to main content
The bakefile command (short: bf) manages your bakefile.py:

init

Create a new bakefile.py:
See PEP 723 Support.

add-inline

Add PEP 723 inline metadata to an existing bakefile:

lint

Lint bakefile.py (or the entire project) with ruff format, ruff check, and ty. Disable any with --no-ruff-format, --no-ruff-check, or --no-ty:

uv-based commands (PEP 723 bakefile.py only)

Convenience wrappers around uv commands with --script bakefile.py added. For PEP 723 bakefile.py files only. For normal Python projects, use your preferred dependency manager (pip, poetry, uv, etc.):
Extra args pass through to uv (e.g. bakefile sync --frozen, bakefile lock --no-build).

venv

Ensure a .venv exists in the repo root. For PEP 723 standalone bakefiles, symlinks .venv to the uv-managed environment. For standard Python projects (pyproject.toml), it just runs uv sync, so prefer uv directly there:

find-python

Print the Python path used by bake, bakefile env, bakefile export, bakefile run, and bakefile lint (the bakefile’s Python):

which

Diagnose which Python each command uses. bake, bakefile env, and bakefile export reinvoke under the bakefile’s Python (they re-run themselves and load the bakebook). bakefile run and bakefile lint spawn that Python directly to run your code (no self-reinvoke, no bakebook). All other subcommands use the invoked Python:

run

Run a script or module under the bakefile’s Python (like uv run for the bakefile’s environment). If the first argument is an existing file, it runs as python script.py. Otherwise it runs as python -m module:

env

Print or inject bakebook variables. Given this bakefile.py:
Print a value (output is shell-quoted):
Inject variables into a command’s environment with -- (printenv reads the injected value):

export

Export bakebook variables to shell, dotenv, JSON, or YAML. By default it exports every field, including bake’s internal settings, so use -i to focus on your own. Using the same bakefile.py as env above:
Formats: sh (default), dotenv, json, yaml. Secrets stay masked unless you pass -s. Write to a file with -o:
See Settings for how these variables are defined on the bakebook.