rjurney
09/13/2025, 3:58 AMblack / isort on all the Python code you generate? Maybe even later flake8 and mypy? These are the most common libraries for format, lint and type checking and when I ever open baml_client/ code VSCode reformats it which is undesirable.Antonio Sarosi (BAML 🐑)
09/13/2025, 1:56 PMon_generate option for generators. Though I see it's not very well documented. But this is how we use it for Go in our integ tests:
generator lang_go {
output_type go
output_dir "../go"
version "0.207.0"
client_package_name "example.com/integ-tests"
on_generate "gofmt -w . && goimports -w . && go mod tidy"
}
Can be applied to Python as well. Formatters and import sorting won't run into any issues but linters probably will, and generation fails if on_generate fails so I woldn't add linters yet.prrao
09/13/2025, 7:16 PMprrao
09/13/2025, 7:16 PMprrao
09/13/2025, 7:18 PMprrao
09/13/2025, 7:19 PMrjurney
09/13/2025, 9:09 PMrjurney
09/13/2025, 9:32 PMon_generate "black . && isort ."
Or if you're a cool kit:
on_generate: "ruff ."Matt
10/15/2025, 2:49 AMtouch py.typed then the generator breaks because there's an extra file there
or am I in the dark ages 😅rjurney
11/14/2025, 8:10 PM