pkl
pkl copied to clipboard
Support Projects loaded from arbitrary URIs
Currently, Pkl assumes that a PklProject file and any declared local dependencies are accessible on the filesystem (i.e. via file:
URIs. For usage of the pkl
CLI this is sufficient, but for usage of language bindings this presents an obstacle for evaluating Pkl code using projects from sources that are not the filesystem. One compelling use case would be consuming Pkl code using project dependencies from a git repository; using go-git
and its go-billy
filesystem abstraction, it should be possible to do this completely in-memory. With this change and https://github.com/apple/pkl-go/pull/21 this now works end-to-end.
Brief summary of the changes here:
- Replace usage of
Path projectDir
withURI projectBaseUri
throughout - Switch reading of
PklProject.deps.json
to use resource readers - Update
pkl:Project
to accept local dependencies when the scheme and authority are the same, rather than checking forfile:
URIs specifically - Add a test in
pkl-core
for custom-defined module and resource readers - Fix NPE in pkl-server's handling of empty/absent
pathElements
inList*Response
s