A configuration-as-code language with rich validation and tooling
open sourceApache-2.0free
Pkl (pronounced "pickle") is Apple's configuration-as-code language, a blend of a static configuration format and a general-purpose programming language. You define data once in Pkl, with classes, type annotations and constraints that validate it, and generate JSON, YAML, property lists, Java properties and other formats from it. It can also be embedded in applications for runtime configuration, with code generators for Java, Kotlin, Swift and Go, and a Spring Boot integration. Modules are shared as packages published to any web host and imported by package:// URI. It ships as a CLI (native executables for macOS, Linux and Windows, or a Java build), a library and a Gradle plugin, with a language server and editor plugins for IntelliJ, VS Code and Neovim. Apache-2.0 licensed.
Libraries for Pkl
Talira doesn't list any yet.
Problems it solves
- generate my Kubernetes YAML from one typed source instead of copying files
- validate configuration values before they reach production
- a typed configuration language that catches mistakes in my YAML
- which config language should we use instead of templated YAML
- share configuration templates between teams as versioned packages
- load typed configuration into a Java, Kotlin, Swift or Go application
- write CI workflow config with checking and reuse instead of raw YAML
Features
- generate JSON, YAML, property lists and Java properties from one source
- classes, type annotations and constraints that validate configuration
- code generation for Java, Kotlin, Swift and Go
- embed in applications for runtime configuration (JVM, Swift, Go)
- packages published to any host and imported by package:// URI
- pkldoc documentation generator
- language server and IntelliJ, VS Code and Neovim plugins
- native CLI executables that start instantly
Limitations
- No 1.0 release yet: the latest release is 0.33.1, and release notes for each 0.x version list breaking changes
Capabilities
| Has a command line tool | plan not known |
|---|---|
| Has official SDKs | plan not known |
Alternatives
The same job
These do what Pkl does.
- CUE Validate, define, and use dynamic and text-based data
- Nickel Better configuration for less
- KCL An open-source constraint-based record and functional language for configuration and policy
- HCL The HashiCorp configuration language
- Jsonnet A configuration language for app and tool developers
- Starlark A Python dialect designed as a configuration language, made for Bazel
