pkl icon indicating copy to clipboard operation
pkl copied to clipboard

Support Projects loaded from arbitrary URIs

Open HT154 opened this issue 11 months ago • 0 comments

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 with URI 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 for file: 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 in List*Responses

HT154 avatar Feb 26 '24 22:02 HT154