Provide a Pkl renderer #290

Open
opened 2025-12-30 01:23:12 +01:00 by adam · 1 comment
Owner

Originally created by @bioball on GitHub (Feb 27, 2025).

There should be a renderer that renders Pkl output.

Use-cases:

Imagined usage:

output {
  renderer = new PklRenderer {}
  value = someValue
}

Rendered module should be importable in Pkl, and be logically equivalent to someValue.

Output would not retain programming constructs like for/when/amends chains.

Originally created by @bioball on GitHub (Feb 27, 2025). There should be a renderer that renders Pkl output. Use-cases: * Eschew the need to create converter modules like https://pkl-lang.org/package-docs/pkg.pkl-lang.org/pkl-pantry/k8s.contrib/current/convert/index.html * Ability to programmatically rewrite Pkl using Pkl itself Imagined usage: ```pkl output { renderer = new PklRenderer {} value = someValue } ``` Rendered module should be importable in Pkl, and be logically equivalent to `someValue`. Output would not retain programming constructs like for/when/amends chains.
Author
Owner

@bsideup commented on GitHub (Jul 9, 2025):

I hope the PKL renderer would also allow to "compile" it (e.g. resolve and inline all imports) into a single PKL file for "offline" distribution of it.

I am aware of #994 which potentially could solve that too, but wanted to explicitly point out the use case 👍

PCF was considered as an alternative but it does not support functions and other constructs, making it "too constant"

@bsideup commented on GitHub (Jul 9, 2025): I hope the PKL renderer would also allow to "compile" it (e.g. resolve and inline all imports) into a single PKL file for "offline" distribution of it. I am aware of #994 which potentially could solve that too, but wanted to explicitly point out the use case 👍 PCF was considered as an alternative but it does not support functions and other constructs, making it "too constant"
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/pkl#290