Proper JULIA_DEPOT_PATH#335
Conversation
| ENV \ | ||
| PATH=/opt/julia/bin:$PATH \ | ||
| JULIA_DEPOT_PATH=/pc/julia_depot | ||
| JULIA_DEPOT_PATH=/pc/julia_depot: |
There was a problem hiding this comment.
so I missed this in the first review but nothing should use /pc for writable space -- it's intended to be only for the hook installs themselves (and everything else there is ephemeral / blown away)
There was a problem hiding this comment.
@asottile Okay, I think this actually points to an upstream problem with pre-commit itself, which is that the packages used by julia hooks get installed into the global depot, not a hook-specific environment.
As I understand it, the default JULIA_DEPOT_PATH (~/.julia) does not persist across the hook installation and the run phase in pre-commit.ci. This is why I could not leave JULIA_DEPOT_PATH unset in my initial PR.
As a workaround, I set the JULIA_DEPOT_PATH inside of /pc which does persist. As you say, this is not quite what the /pc directory is for.
I think the right fix is to set JULIA_DEPOT_PATH in get_env_patch to a depot inside the hook env dir that's already used for JULIA_LOAD_PATH, e.g. os.path.join(target_dir, 'depot') + os.pathsep. The trailing separator maintains the speedup I intended to implement in this PR.
Does that sound right to you?
There was a problem hiding this comment.
@asottile I opened pre-commit/pre-commit#3711 and committed 117f36e (this PR) in anticipation.
This should fix the speed issues mentioned in #332 (comment).
The explanation is in the julia docs:
We had inadvertently been "not load[ing] any bundled resources", requiring us to instantiate
Pkgat hook install time, which took > 1.5 min. Now it is already instantiated and can be used instantaneously.Tagging @asottile for review.