toml.bzl 0.5.0Latest published <1h ago
MODULE.bazel
bazel_dep(name = "toml.bzl", version = "0.5.0")
README

toml.bzl

A pure Starlark TOML 1.1.0 encoder and decoder.

Usage

For full API documentation, see the API Reference.

For installation instructions, see Releases.

In a .bzl file

load("@toml.bzl", "toml")

content = """
[database]
server = "192.168.1.1"
ports = [ 8000, 8001, 8002 ]
"""

# Decode
config = toml.decode(content)
print(config["database"]["server"])

# Encode
encoded = toml.encode(config)
print(encoded)

Performance

toml.bzl is highly optimized for the Starlark interpreter, leveraging native string operations to achieve high throughput while maintaining 100% compliance with TOML 1.1.0.

Benchmarks

Time per decode() call on an Apple M3 Pro MacBook Pro (Bazel 8.5.0, warm server):

Document Size Time per parse Throughput
Cargo.lock 735 KB 61 ms ~12 MB/s
channel-rust-1.81.0.toml 824 KB 61 ms ~13 MB/s
uv.lock (apache/airflow) 3.3 MB 216 ms ~15 MB/s

To reproduce, build //toml/tests/benchmarks:benchmark_prof, //toml/tests/benchmarks:channel_rust_benchmark_prof, or //toml/tests/benchmarks:uv_lock_benchmark_prof (each parses its document 5 times during analysis) with --nobuild --starlark_cpu_profile=<file>, and inspect decode in the profile.

Compliance

The implementation is verified against the toml-test suite, passing all compliance tests (decoding and encoding).

About

Pure-Starlark TOML library

@jvolkman/toml.bzl@jvolkman
Homepage
13stars
12:40 AM (7 minutes ago)
@jvolkman#10745 toml.bzl@0.5.0 (#10745)

Languages

Maintainers

@jvolkman

Versions

0.5.0 +4.3mo2026-09-27
0.4.1 +2d81% 212026-05-20
0.4.0 +4.4mo2026-05-17
0.3.0 +6d19% 52026-01-05
0.2.1 +8h2025-12-30
0.2.0 +1d2025-12-29
0.1.1 +6h2025-12-28
0.1.02025-12-28