Deterministic
Same inputs always produce same outputs. No randomness, no timestamps.
Starlark is a configuration language designed by Google, originally for Bazel. It features Python-like syntax with deterministic evaluation, making it ideal for build systems and configuration.
Deterministic
Same inputs always produce same outputs. No randomness, no timestamps.
Hermetic
No filesystem, network, or system access. Safe for untrusted code.
Parallel
Modules load concurrently. Immutable data ensures thread safety.
Python-like
Familiar syntax reduces learning curve for Python developers.
# Define datapeople = { "Alice": 22, "Bob": 40, "Charlie": 14,}
# Define a functiondef greet(name): """Return a greeting.""" return "Hello, {}!".format(name)
# List comprehensionadults = [name for name, age in people.items() if age >= 18]
print(greet(", ".join(adults))) # Hello, Alice, Bob!| Use Case | Benefit |
|---|---|
| Build systems | Reproducible builds via determinism |
| Configuration | Type-safe, programmable configs |
| Sandboxed scripting | Safe execution of user code |
| CI/CD pipelines | Consistent behavior across runs |
While Starlark looks like Python, key differences ensure determinism:
| Feature | Python | Starlark |
|---|---|---|
| Mutation | Allowed | Frozen after creation |
| Global state | Yes | No |
| Recursion | Yes | No (prevents infinite loops) |
while loops | Yes | No (use for with ranges) |
import | Yes | Use load() instead |
| Classes | Yes | No (use structs) |