Example configs and testing guide for the Python processor (PR #621).
| Requirement | Version | Check Command |
|---|---|---|
| Go | 1.24+ | go version |
| wget | any | which wget |
macOS: brew install wget if needed.
# From repo root:
cd /path/to/bento
# 1. Download the Python WASM runtime (~50MB)
bash internal/impl/python/scripts/install.sh
# 2. Run an example
go run -tags "x_wasm" ./cmd/bento/main.go -c internal/impl/python/examples/hello.yamlExpected: "Hello, World!"
First run: ~30-60 seconds (Go compilation). Subsequent runs: ~1 second.
All examples use generate input so they run without piping.
| File | Description |
|---|---|
hello.yaml |
Simple greeting |
test1.yaml |
JSON transformation |
test2.yaml |
Array processing (sum, count, double) |
test3.yaml |
Message filtering (active passes) |
test3b.yaml |
Message filtering (inactive → null) |
test4.yaml |
Standard library imports (math, json, re) |
test5.yaml |
E-commerce order transformation |
test6.yaml |
Error handling (KeyError demo) |
perf.yaml |
Cold start test (10 messages) |
throughput.yaml |
Throughput test (1000 messages) |
cd /path/to/bento
for f in internal/impl/python/examples/test{1..6}.yaml; do
echo "=== $(basename $f) ==="
go run -tags "x_wasm" ./cmd/bento/main.go -c "$f" 2>&1 | head -5
donetime go run -tags "x_wasm" ./cmd/bento/main.go -c internal/impl/python/examples/perf.yaml
time go run -tags "x_wasm" ./cmd/bento/main.go -c internal/impl/python/examples/throughput.yamlThe -tags "x_wasm" flag is required. Without it, the processor panics.
# Fails:
go run ./cmd/bento/main.go -c examples/hello.yaml
# Works:
go run -tags "x_wasm" ./cmd/bento/main.go -c examples/hello.yamlgo test -tags "x_wasm" -v ./internal/impl/python/...Run bash internal/impl/python/scripts/install.sh first.
Set logger.level: debug in config to see Python stderr.
You're using stdin input without piping. Use generate input or pipe data.
Use Python when:
- Complex string manipulation (regex, f-strings)
- Mathematical operations beyond basic arithmetic
- Your team knows Python better than Bloblang
Use Bloblang when:
- Simple field mappings
- Performance-critical paths
- Zero cold-start overhead needed