Support disabling the pkl cache for sandboxed/hermetic builds
Looks like by default the codegen tries to use the "global" pkl cache at ~/.pkl.
This breaks builds that use strict sandboxing (ex. bazel) that disallow write access outside of the build directory.
To address this, would it be possible to support ex. --no-cache args similar to the "core" pkl CLI tools?
https://pkl-lang.org/main/current/pkl-cli/index.html#common-options
–– Pkl Error ––
I/O error loading module `package://github.com/jw-y/pkl-python/releases/download/v0.1.16/[email protected]#/Generator.pkl`.
FileSystemException: /home/user/.pkl: Read-only file system
1 | amends "package://github.com/jw-y/pkl-python/releases/download/v0.1.16/[email protected]#/Generator.pkl"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
at tmpn_frdii6 (file:///tmp/tmpn_frdii6.pkl)
warnings.warn(str(e))
Is there a use case that i can reproduce?
Not sure if it will work,
but try putting the Generator.pkl file into the build directory and pass the file path to --generator-settings flag.
The core pkl binary by default uses cache for remote files and you probably would want that too.
If it is local, it won't use the cache.
Probably hard to reproduce :P this is a non-trivial private codebase.
We're running https://bazel.build/ which sandboxes all build steps (ex. no access to system-wide filesystem, no network access) except for explicitly declared dependencies, so when pkl-python tries to "externally" download the pkl binary and supporting files, it gets blocked (as per error message above).
In our case bazel handles all the caching etc. for intermediates.
Have you tried inserting Generator.pkl into the project before build?
If you don't have that file there is no way of generating python code anyways.