-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sub-packages aren't well supported (julia 1.10 feature setting manifest=
in Project.toml): precompiling more than needed
#89
Comments
A discovery I've made: Even though julia> using Pkg
julia> Pkg.activate("packages/RAI_Metrics/")
Activating project at `~/work/raicode2/packages/RAI_Metrics`
julia> using RAI_Metrics
Precompiling RAI_Metrics
1 dependency successfully precompiled in 2 seconds. 46 already precompiled.
julia> Pkg.instantiate()
Precompiling project...
Progress [============> ] 12/43 So i think the issue actually comes from this TestEnv.jl/src/julia-1.9/common.jl Lines 21 to 27 in 25d9afb
Removing it does make this go away, but then no precompilation happens. |
Actually, changing that line to Pkg.instantiate(ctx; allow_autoprecomp = false) # do precomp later within sandbox seems like a good idea. Copied that from here: But we still need to find what to change to precompile the sandbox_ctx |
😊 Aha, it makes sense: i think we just need this line at the end: # Now that we have set up the sandbox environment, precompile all its packages:
# (Reconnect the `io` back to the original context so the caller can see the
# precompilation progress.)
Pkg.precompile(temp_ctx; io=ctx.io) I'll start a PR! |
It seems like TestEnv doesn’t know about sub-packages, so if you edit a small package, and then restart the repl, the first time your run
TestEnv.activate("SubPackage")
, TestEnv will attempt to build the whole top-level project.Our codebase is organized as a monorepo, with lots of subpackages in the same repository. Those subpackages all share the top-level Manifest, which is the recommended way to do subpackages starting in julia 1.10. To do that, they set this field in their Project.toml:
manifest = "../../Manifest.toml"
.For example (abbreviated):
In this example, RAI_Metrics is also a subpackage.
The issue here is that
TestEnv.activate("RelationalAIBase")
ends up precompiling the whole top-level Project.toml and Manifest.toml, which can take 2-3 minutes.This is particularly annoying if you are editing a leaf package that most of the codebase depends on, because such a package should have the best cycle-times (since it has no deps), yet you have to build all of the top-level project just to test it.
Note that Pkg already handles these correctly: If you do
using SubPackage
, it only precompiles that package and its dependencies.Similarly, if you do
Pkg.test("SubPackage")
it only precompiles only:So we need to apply that same fix to TestEnv to replicate this.
Links:
The text was updated successfully, but these errors were encountered: