Starlark is a minimal programming language, halfway between a configuration language and a general-purpose programming language. It was developed by Google to do configurations for the Bazel build tool, and has since been adopted by Facebook for the Buck build system as well. Starlark's syntax is a minimal subset of of Python, with a focus on readability. This page lists the differences between Starlark and Python.
Kurtosis uses Starlark as the way for users to express manipulations to enclave. Users submit Starlark scripts to Kurtosis, the Starlark is interpreted, and the instructions in the script are executed.
To read more about why we chose Starlark, see this page.
How is Starlark implemented at Kurtosis?
Starlark itself is very basic; Google designed it to be extended to fulfill a given usecase. For example, the Bazel language is actually an extension built on top of Starlark.
We extended basic Starlark with our own DSL so that it could fulfill the properties of reusable environment definitions. This gave us:
- A list of Kurtosis-specific functions for working with an environment
- The ability to accept parameters
- Dependencies, so Kurtosis scripts can import other scripts
- A GitHub-based packaging system, so environment definitions can be shared with each other
Additionally, we built a multi-phase engine around the Starlark interpreter, to provide users with benefits not normally available in a scripting language.
We've released an official Kurtosis Starlark VS Code extension to enrich the developer experience when writing packages with Starlark. Features include: syntax highlighting, method signature suggestions, hover preview for functions, and auto-completion for Kurtosis custom types.