A lot of Buck2 is driven by Starlark APIs. While there is a Starlark specification, for most purposes it can be considered a subset of Python. There are three main places you can write Starlark in Buck2:
BUCKfiles, where you can define the rules. The most interesting functions are the rules themselves, but you will often use the builtin Starlark functions (most of which are the same as in Python), and a few of the build functions (e.g.
- In rule definitions, where you can use the same Starlark standard functions, but will heavily be using the build functions (e.g.
- In BXL, where the context type is one of the more important ones.