-
Notifications
You must be signed in to change notification settings - Fork 343
SPICE-0021 Implement Pkl binary renderer and parser #1203
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
b7285fb to
bee69cc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR extracts String-specific functionality to a new AbstractStringRenderer subclass so that binary renderers can still benefit from the converter logic here in AbstractRenderer. This is a breaking change for any out-of-tree inheritors from AbstractRenderer but the fix is as simple as s/AbstractRenderer/AbstractStringRenderer/g.
pkl-core/src/main/java/org/pkl/core/stdlib/encoding/PklBinaryEncodingParserNodes.java
Outdated
Show resolved
Hide resolved
3a9b196 to
9b4415b
Compare
|
Tested this out, and hit an edge case where if the moduleUri for a Typed binary-encoded value is the empty string, the following exception is thrown: |
|
@sin-ack How did you produce the encoded data with the empty module URI string? Was that something you edited by hand? |
|
@HT154 It's from outside Pkl itself. We have a custom Pkl binary encoder/Pkl types representation in the host language that previously encoded |
|
Gotcha! Both |
616ccd1 to
fb54506
Compare
bioball
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did a first pass!
pkl-core/src/main/java/org/pkl/core/util/pklbinary/AbstractPklBinaryDecoder.java
Show resolved
Hide resolved
pkl-core/src/main/java/org/pkl/core/util/pklbinary/AbstractPklBinaryDecoder.java
Show resolved
Hide resolved
pkl-core/src/main/java/org/pkl/core/util/pklbinary/AbstractPklBinaryDecoder.java
Outdated
Show resolved
Hide resolved
pkl-core/src/main/java/org/pkl/core/util/pklbinary/AbstractPklBinaryDecoder.java
Outdated
Show resolved
Hide resolved
pkl-core/src/main/java/org/pkl/core/runtime/VmPklBinaryDecoder.java
Outdated
Show resolved
Hide resolved
pkl-commons-test/src/main/kotlin/org/pkl/commons/test/MessagePackDebugRenderer.kt
Show resolved
Hide resolved
pkl-config-java/src/main/java/org/pkl/config/java/ConfigPklBinaryDecoder.java
Outdated
Show resolved
Hide resolved
pkl-config-java/src/main/java/org/pkl/config/java/ConfigPklBinaryDecoder.java
Outdated
Show resolved
Hide resolved
135ceff to
b50d453
Compare
25fbab1 to
f3b2ad6
Compare
bioball
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is getting pretty close! Made another pass.
pkl-core/src/main/java/org/pkl/core/util/pklbinary/PklBinaryTypes.java
Outdated
Show resolved
Hide resolved
pkl-server/src/test/kotlin/org/pkl/server/BinaryEvaluatorSnippetTests.kt
Outdated
Show resolved
Hide resolved
f3b2ad6 to
6d1ec14
Compare
b997b65 to
494f6b1
Compare
bioball
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some minor comments. LGTM to merge after they're addressed!
pkl-core/src/main/java/org/pkl/core/runtime/VmPklBinaryEncoder.java
Outdated
Show resolved
Hide resolved
pkl-core/src/main/java/org/pkl/core/stdlib/AbstractRenderer.java
Outdated
Show resolved
Hide resolved
5f07d28 to
c260192
Compare
|
Merging this now, any additional feedback or issues will be addressed in a follow-up PR |
c260192 to
f08fc1f
Compare
|
@sin-ack FYI: we've moved the in-language parser out of this PR because it executes imports. This goes against the principle that module imports should be statically analyzable (which you can get with We're considering introducing a new language operator instead to load binary data; something like: data = load("path/to/bytes.msgpack")Where |
|
That's kind of unfortunate, because having it helped with a use-case we had where we were able to preserve type information for user configuration passed with Pkl binary encoding into the module. Without this, I guess an alternative could be to have a client resource reader expose the data at a relative path and use the relative |
This PR is composed of two commits: the first adds the new functionality and the second regenerates all changed snippet outputs. Please review just the first commit.
Implements SPICE-0021
Resolves #994