Repository navigation
julia: keep the package depot inside the hook env - #113
Merged
Merged
Conversation
blairham
force-pushed
the
julia-depot-104
branch
from
October 15, 2026 14:03
3dd1312 to
8bc53ff
Compare
Upstream 4.6.1 (pre-commit/pre-commit#3711) sets JULIA_DEPOT_PATH to <envdir>/depot plus a trailing path separator in julia's env patch. Without it, every julia hook installs packages and precompile caches into the user's shared ~/.julia, so hook envs are not self-contained and `pre-commit clean` leaves them behind. The trailing separator keeps julia's default depots after ours, so the bundled stdlib caches stay usable and hooks don't recompile from scratch. RunCommand had no way to pass env, so Run goes through a new RunCommandEnv; RunCommand delegates to it unchanged.
blairham
force-pushed
the
julia-depot-104
branch
from
October 15, 2026 14:05
8bc53ff to
ec04586
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #104
Upstream 4.6.1 (pre-commit/pre-commit#3711) added
JULIA_DEPOT_PATH=<envdir>/depot+os.pathsepto julia'sget_env_patch. Without it, every julia hook installs packages and precompile caches into the user's shared~/.julia. The trailing separator leaves an empty entry, which julia expands to its default depots, so the bundled stdlib caches stay usable.juliaEnv(envDir)builds the override. Julia'sInstallEnvironmentandRunboth pass it to the child.RunCommandcouldn't take env, so a newRunCommandEnvdoes;RunCommanddelegates to it unchanged.juliaon PATH, with a conflictingJULIA_DEPOT_PATHalready in the environment, and checks that install and run both hand the hook's depot to the child (skipped on Windows). Both fail if the env isn't passed to install and run, and both fail if the trailing separator is dropped.Further divergence from upstream julia.py (not fixed here)
JULIA_LOAD_PATH/JULIA_PROJECT: upstream setsJULIA_LOAD_PATH=<envdir>and unsetsJULIA_PROJECT. We set neither; we pass--project=<envDir>instead.juliaenv; ours isjulia_env. That breaks cache-layout compatibility.Runlooks like it drops the script: it runsjulia --startup-file=no --project=<env> parts[1:]..., which dropsparts[0](the hook's.jlfile). Upstream runsjulia --startup-file=no <prefix>/<script> ...(left unprefixed for local hooks) through xargs. This comes from reading the code; I haven't run it against a real julia.(Julia)Project.tomland(Julia)Manifest.tomlinto the env, or creates an emptyProject.toml, then runsPkg.instantiatewith@stdlibadded temporarily and adds extra deps viapkg"add ...". Ours runsPkg.activate/Pkg.develop(path=prefix)/Pkg.addper dep, with paths spliced into Julia source unescaped.These are probably worth a follow-up issue.