A Python dialect designed as a configuration language, made for Bazel
open sourceApache-2.0free
Starlark (formerly Skylark) is a small configuration language, a dialect of Python, designed at Google for the Bazel build system, where it's the language of BUILD files and of the macros and rules that extend Bazel. Like Python it's dynamically typed, with high-level data types, first-class functions and garbage collection, but evaluation is deterministic and hermetic (code can't reach the file system, network or clock, so untrusted code is safe to run) and modules load in parallel, with shared data made immutable. An interpreter is usually embedded in a larger application that adds its own functions and types. This listing covers the language and its specification, maintained in the bazelbuild/starlark repository; implementations include Bazel's own in Java, starlark-go (Go) and starlark-rust (Rust, used by Buck2). Apache-2.0 licensed.
Libraries for Starlark
Talira doesn't list any yet.
Problems it solves
- a safe scripting language to embed in my application for user configuration
- let users write config with functions and loops but no file or network access
- a Python-like language for build files
- which embeddable config language should my tool use
Features
- Python-like syntax
- deterministic evaluation
- hermetic execution, safe for untrusted code
- parallel module loading with immutable shared data
- designed for embedding: the host adds its own functions and types
- a written specification with several implementations (Java, Go, Rust)
Alternatives
The same job
These do what Starlark does.
- Lua A powerful, efficient, lightweight, embeddable scripting language
- Pkl A configuration-as-code language with rich validation and tooling
- CUE Validate, define, and use dynamic and text-based data
- Jsonnet A configuration language for app and tool developers
- HCL The HashiCorp configuration language
- Yaegi Go interpreter in pure Go for scripts, plugins and embedded shells