JuliaLang / Pkg.jl

Pkg - Package manager for the Julia programming language
https://pkgdocs.julialang.org
Other
621 stars 269 forks source link

idea: make Pkg.precompile happen when exiting Pkg REPL #2221

Open vtjnash opened 3 years ago

vtjnash commented 3 years ago

I'm not sure I prefer that the mode is sticky, but since it is, it'd be really nice to be able to queue a sequence of operations, and have them all applied when I switch back to the main REPL. (ignore the version number in the prompt, I'm on master, but I like the name v1.1)

For example:

julia> ]

(@v1.1) pkg> up
    Updating registry at `~/.julia/registries/General`
    Updating git-repo `https://github.com/JuliaRegistries/General.git`
    Updating git-repo `https://github.com/chriselrod/VectorizationBase.jl.git`
   Installed FastGaussQuadrature ─ v0.4.4
   Installed StatsFuns ─────────── v0.9.6
   Installed DualNumbers ───────── v0.6.3
   Installed DiffRules ─────────── v1.0.2
   Installed Coverage ──────────── v1.2.0
   Installed NaNMath ───────────── v0.3.5
   Installed LoweredCodeUtils ──── v1.2.6
   Installed Requires ──────────── v1.1.1
   Installed DoubleFloats ──────── v1.1.15
   Installed Revise ────────────── v3.1.9
   Installed TimeZones ─────────── v1.5.1
   Installed DSP ───────────────── v0.6.9
   Installed Documenter ────────── v0.25.4
Updating `~/.julia/environments/v1.1/Project.toml`
  [a2441757] ↑ Coverage v1.1.1 ⇒ v1.2.0
  [e30172f5] ↑ Documenter v0.25.3 ⇒ v0.25.4
  [fa6b7ba4] ↑ DualNumbers v0.6.2 ⇒ v0.6.3
  [295af30f] ↑ Revise v3.1.7 ⇒ v3.1.9
Updating `~/.julia/environments/v1.1/Manifest.toml`
  [082447d4] + ChainRules v0.6.5
  [d360d2e6] ↓ ChainRulesCore v0.9.17 ⇒ v0.8.1
  [a2441757] ↑ Coverage v1.1.1 ⇒ v1.2.0
  [717857b8] ↑ DSP v0.6.8 ⇒ v0.6.9
  [b552c78f] ↑ DiffRules v1.0.1 ⇒ v1.0.2
  [e30172f5] ↑ Documenter v0.25.3 ⇒ v0.25.4
  [497a8b3b] ↑ DoubleFloats v1.1.13 ⇒ v1.1.15
  [fa6b7ba4] ↑ DualNumbers v0.6.2 ⇒ v0.6.3
  [442a2c76] ↑ FastGaussQuadrature v0.4.3 ⇒ v0.4.4
  [7869d1d1] ↑ IRTools v0.3.3 ⇒ v0.4.1
  [6f1432cf] ↑ LoweredCodeUtils v1.2.5 ⇒ v1.2.6
  [77ba4419] ↑ NaNMath v0.3.4 ⇒ v0.3.5
  [ae029012] ↑ Requires v1.0.3 ⇒ v1.1.1
  [295af30f] ↑ Revise v3.1.7 ⇒ v3.1.9
  [4c63d2b9] ↑ StatsFuns v0.9.5 ⇒ v0.9.6
  [f269a46b] ↑ TimeZones v1.5.0 ⇒ v1.5.1
  [e88e6eb3] ↑ Zygote v0.4.8 ⇒ v0.4.22
    Building TimeZones → `~/.julia/scratchspaces/44cfe95a-1eb2-52ea-b672-e2afdf69b78f/69f312cdb1b3145761d4e5866034efde4608735d/build.log`

(@v1.1) pkg> up
    Updating registry at `~/.julia/registries/General`
    Updating git-repo `https://github.com/JuliaRegistries/General.git`
    Updating git-repo `https://github.com/chriselrod/VectorizationBase.jl.git`
No Changes to `~/.julia/environments/v1.1/Project.toml`
No Changes to `~/.julia/environments/v1.1/Manifest.toml`

(@v1.1) pkg> dev RBNF
     Cloning git-repo `https://github.com/thautwarm/RBNF.jl.git`
   Resolving package versions...
Updating `~/.julia/environments/v1.1/Project.toml`
  [83ef0002] ~ RBNF v0.2.2 ⇒ v0.2.2 `~/.julia/dev/RBNF`
Updating `~/.julia/environments/v1.1/Manifest.toml`
  [83ef0002] ~ RBNF v0.2.2 ⇒ v0.2.2 `~/.julia/dev/RBNF`

(@v1.1) pkg> ^H
Precompiling project...
  Progress [=>                                       ]  1/49
  ◐ IRTools
  ◐ StaticLint
  ◐ ChainRules
  ◐ Documenter
  ◐ RBNF
  ◐ DiffEqJump
  ◐ Revise
  ◐ PlotUtils
  ◐ DualNumbers
  ◐ BugReporting
  ◐ Tracker
  ◐ TransformVariables
  ◐ NLPModels
  ◐ LineSearches
  ◐ MCMCChains
  ◐ DiffEqNoiseProcess
  ◐ Bijectors
  ◐ KernelDensity
  ◐ HypothesisTests
  ◐ AdvancedMH
  ◐ EllipticalSliceSampling
  ◐ DSP
  ◐ DoubleFloats
^C Interrupted: Exiting precompilation...

julia> 
KristofferC commented 3 years ago

It will already have precompiled everything by then? Or do you mean when you have turned off auto precompilation.

vtjnash commented 3 years ago

I mean instead of. Otherwise simple workflows like above can end up recompiling several times, and I've got hundreds of packages installed, so it leads to several minute delays between steps (that I end up skipping with ^C).

IanButterworth commented 3 years ago

I do think there's an elegance to this, lumping everything together does seem beneficial

But on the other hand it seems like it could be a little jarring from a UX perspective that exiting Pkg REPL would become complicated and slow whereas currently its simple and fast. Feelings of being trapped in Pkg REPL?

Of course this can be almost achieved with turning auto-precomp off, and just writing pkg> precompile before exiting. (Maybe there should be a short form too?? pkg> pc?)

Or perhaps if the user knows they want to do a series of things in Pkg REPL we could support concatenation of pkg commands?

pkg> up
     add Foo
     dev Bar
     build Bar
... # do all the stuff
Precompiling...

But that could get tedious when errors occur.

IanButterworth commented 3 years ago

One proposal over in https://github.com/JuliaLang/Pkg.jl/pull/2248

vtjnash commented 3 years ago

Is this still possible? I see the referenced PR got rejected. It is very annoying to have to wait a minute between consecutive package operations.

IanButterworth commented 3 years ago

I often think about this too. I don't really see #2248 as being rejected, just postponed. Perhaps I shouldn't have closed it. Stefan's suggestion in there to make it customizable seems like a good way to go.