Changelog
All notable changes to this project are documented in this file.
The format is based on Keep a Changelog, and this project uses Semantic Versioning.
Unreleased
0.1.1 - 2026-10-25
Security
- Code generation rejects a
@zig.Field.typethat is not exactly one Zig type expression, such as text that closes the field and declares functions or other fields, or that contains comments, blocks, or declarations. Before, the text was written into the bindings verbatim. - Control characters in module names and doc comments are written as
?in generated comments, so a line break in a name or a carriage return in a doc comment can no longer end the comment and add code to the bindings.
Fixed
project.loadrejects atimeoutof 2^63 seconds witherror.Overflowinstead of converting it to an out-of-rangei64.- Generated
IntandBooleandefaults are written from the parsed value instead of the text Pkl reported, so a default such as1_000becomes1000and an unexpected text has no Zig default. msgpack.Decoder.skipdiscards string and binary payloads without allocating or charging them to the allocation limit.
0.1.0 - 2026-10-24
First release. It needs Zig 0.17.0 and Pkl 0.25.3 or newer; code generation needs Pkl 0.32.2.
Evaluation
Managerruns onepkl serverprocess and shares it between evaluators on any thread.Evaluator.evaluateWithOptionstakes a timeout and aCancellation.Optionscovers the evaluator settings of the Message Passing API: module and resource allow lists, environment variables and properties, module paths, root and cache directories, timeouts, output format, HTTP proxy, certificates, rewrites, and headers, external readers, trace mode, and projects.Options.restricted()andOptions.preconfigured()are starting points, andBuilderadds readers.createEvaluatorrefuses settings the running Pkl release does not support witherror.UnsupportedVersion, and options without allowed modules witherror.NoAllowedModules. The server version is probed only when options need a release newer than 0.25.3.Evaluator.evaluateSourcereturns avalue.Tree;Evaluator.evaluateIntoconverts the result into a Zig type.convertmaps Pkl values to structs, tagged unions, enums, optionals, slices, pointers, and theconvert.Map,convert.Pair,convert.Duration,convert.DataSize,convert.Regex,convert.Bytes,convert.IntSeq,convert.Reference, andconvert.Dynamictypes, withpkl_names,pkl_class, andpkl_subclassesdeclarations.- Module and resource readers implemented as Zig callbacks, including glob listing, and
ExternalClientfor running a program as an external reader that Pkl starts. - Per-evaluator loggers for
trace()output and warnings. project.loadreadsPklProjectsettings and dependencies. Relative paths resolve against the project directory on every supported release, matching whatresolvedEvaluatorSettingsreturns on Pkl 0.32.- pkl-binary decoding and encoding with
value.decodeSlice,value.decodeReader,value.encode, andvalue.clone, including values from Pkl releases before 0.30 that carry no class name. uri.fromFilereturns thefile:URI of an existing file.
Code generation
zig-pkl-genand thezig_pkl.codegenAPI write Zig types for Pkl modules: primitives, optionals, collections, maps, pairs, durations, data sizes, regexes, bytes, integer sequences, classes and inheritance, type aliases, recursive and cross-module types,localclasses,pkl:refreferences, and unions as tagged unions or enums, including unions of unrelated types.- Generation type-checks the bindings before writing them, records the files it owns in a manifest, and does not overwrite or delete other files without
--force.--checkreports stale bindings. - Defaults are evaluated with resource reads denied. Hidden properties are omitted, and so are defaults that depend on
pkl:platform. - The
@zigannotations are published as the Pkl packagepackage://pkg.pkl-lang.org/github.com/guanchzhou/zig-pkl/zig@0.1.0.
Verification
- CI runs the unit, integration, conformance, and code generation tests and every example on Linux x86_64 and aarch64, macOS aarch64, and Windows x86_64, and the conformance and integration tests and the examples against Pkl 0.25.3, 0.26.3, 0.27.2, 0.28.2, 0.29.1, 0.30.2, 0.31.1, and 0.32.2.
zig build conformancecompares each decoded value with Pkl's own description of it.zig build fuzzruns on every push, and longer every week.bench/compare.shruns zig-pkl and pkl-zig in the same job. On an Apple M5 with Pkl 0.32.2, zig-pkl decodes pkl-binary 2.75 times faster (geometric mean of three cases) with 86% to 99.6% fewer allocations, is 7.7% faster to start a server, evaluate, and shut down, and 18.9% faster per evaluation on a running evaluator.
Documentation
- Guides for installation, evaluation, projects, security, readers, external readers, logging, concurrency, errors, memory ownership, version compatibility, and migration from pkl-zig.
- Ten runnable examples in
examples/, run byzig build examples, and a code generation consumer inexamples/codegen. - The website at https://guanchzhou.github.io/zig-pkl/, built by
zig build site, with the API reference under/api/.