You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Julia's stacked environments are very cool because they let you quickly jump between multiple active projects in the same session, but they have the downside that they interact quite poorly with Pkg.precompile and pkgimages in general since Pkg often cannot predict loading behavior with them.
I love the new [workspaces] feature, because it solves a ton of problems associated with this workflow:
developers can still quickly hop between projects without a restart
(this is even faster than with stacked environments, since precompilation is shared!)
[compat] is not violated since the loaded environment actually went through a ] resolve
] precompile works equally well for tests and the main project (and overall compiles much less!)
Pkg.test() failures are easily reproduced and have a clear environment (no need for TestEnv.jl!)
but there are still a few gaps:
Dynamic environment changes are still an issue. The warning improved in precompilation: improve warn_loaded messaging for transitive deps julia#61293 is nice, but the end-to-end Pkg workflow encourages you to do the "easy" thing and attempt a using only to immediately hit a ton of unexpected pre-compilation. The problem is that the environment was "torn" since it now has packages of a different version loaded which do not match your environment (or what will load next session). Since your environment is now "torn", this is completely one-off, never-to-be-reused-again work. Furthermore, since you are running in a potentially non-[compat] (and non-reproducible environment), so you may hit bugs and choose to back out anyway.
Loading is still affected by ] activate if you hop between stacked environments instead of between [workspace] projects. That leads to the same "torn environment" issues alluded to above when you intersperse using with activate changes. (i.e. moving between stacked environments is much worse than moving between workspace projects)
The problem is that these dynamic / implicit environment changes (1) lead to many "unique" environments that require one-off pre-compilation work and are often broken anyway due to [compat] issues, and (2) prevent Pkg.precompile from being able to predict which packages your project(s) will actually need / want to load at run time.
As a developer, it'd be useful to me to have a "strict" Pkg workflow which:
doesn't allow me to ] activate anything that would "tear" my environment
after any package changes / upgrades that "tear" the environment, "disconnects" the updated Manifest and loads based on only the "old" environment
(i.e. require a restart if you want to use the new packages, or keep running with the old one)
disables problematic features such as package directories / implicit environments
That the environment is explicit and static (rather than torn dynamically) means that Pkg.precompile() can actually work and guarantee that it precompiles the packages relevant for your project(s). It also means that we could make it an error to end up in precompilation in tests, etc. and that "serial precompilation" never happens in this mode (i.e. #4632 could be disabled if you are in "strict" Pkg mode)
Julia's stacked environments are very cool because they let you quickly jump between multiple active projects in the same session, but they have the downside that they interact quite poorly with Pkg.precompile and pkgimages in general since Pkg often cannot predict loading behavior with them.
I love the new
[workspaces]feature, because it solves a ton of problems associated with this workflow:(this is even faster than with stacked environments, since precompilation is shared!)
[compat]is not violated since the loaded environment actually went through a] resolve] precompileworks equally well for tests and the main project (and overall compiles much less!)Pkg.test()failures are easily reproduced and have a clear environment (no need for TestEnv.jl!)but there are still a few gaps:
usingonly to immediately hit a ton of unexpected pre-compilation. The problem is that the environment was "torn" since it now has packages of a different version loaded which do not match your environment (or what will load next session). Since your environment is now "torn", this is completely one-off, never-to-be-reused-again work. Furthermore, since you are running in a potentially non-[compat](and non-reproducible environment), so you may hit bugs and choose to back out anyway.] activateif you hop between stacked environments instead of between[workspace]projects. That leads to the same "torn environment" issues alluded to above when you intersperseusingwithactivatechanges. (i.e. moving between stacked environments is much worse than moving between workspace projects)The problem is that these dynamic / implicit environment changes (1) lead to many "unique" environments that require one-off pre-compilation work and are often broken anyway due to
[compat]issues, and (2) preventPkg.precompilefrom being able to predict which packages your project(s) will actually need / want to load at run time.As a developer, it'd be useful to me to have a "strict" Pkg workflow which:
] activateanything that would "tear" my environment(i.e. require a restart if you want to use the new packages, or keep running with the old one)
That the environment is explicit and static (rather than torn dynamically) means that
Pkg.precompile()can actually work and guarantee that it precompiles the packages relevant for your project(s). It also means that we could make it an error to end up in precompilation in tests, etc. and that "serial precompilation" never happens in this mode (i.e. #4632 could be disabled if you are in "strict" Pkg mode)