Skip to content
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

Feature request: Make Pkg load automatically in the REPL #33043

Open
DilumAluthge opened this issue Aug 23, 2019 · 8 comments
Open

Feature request: Make Pkg load automatically in the REPL #33043

DilumAluthge opened this issue Aug 23, 2019 · 8 comments

Comments

@DilumAluthge
Copy link
Member

From a Slack conversation with @KristofferC:

We should make Pkg load automatically in the REPL
Same as InteractiveUtils

@fredrikekre
Copy link
Member

See #28206

@JeffBezanson
Copy link
Member

You can put this in your juliarc if you want.

@StefanKarpinski
Copy link
Member

StefanKarpinski commented Aug 23, 2019

You can, but the problem that one wants to address is the awkwardness of giving people instructions for running Pkg commands. The instructions always have to say:

To fix whatever, run `import Pkg; Pkg.add("Foo")`

The fact that people can add import Pkg to their startup.jl file doesn't solve that because we can't assume that they've done that. If it was available by default then we could write

To fix whatever, run `Pkg.add("Foo")`

@Keno
Copy link
Member

Keno commented Aug 23, 2019

Maybe exporting it from InteractiveUtils would be a non-offensive way to get this done? That way people could still add local bindings to main to use a different Pkg, but if it's not there it'll pick up the export.

@StefanKarpinski
Copy link
Member

StefanKarpinski commented Aug 23, 2019

Ah, that's smart. Edit: wait, does that work?

@Keno
Copy link
Member

Keno commented Aug 23, 2019

Edit: wait, does that work?

It works as any other binding does:

julia> using Pkg

julia> const Pkg = Base
ERROR: invalid redefinition of constant Pkg
Stacktrace:
 [1] top-level scope at REPL[2]:1
julia> module Foo; using Pkg; export Pkg; end
Main.Foo

julia> using .Foo

julia> const Pkg = Base
Base
julia> module Foo; using Pkg; export Pkg; end
Main.Foo

julia> using .Foo

julia> Pkg.add("WAT?!")
ERROR: WAT?! is not a valid packagename.

Not sure that's the issue you were worried about.

@Keno
Copy link
Member

Keno commented Aug 23, 2019

Welp, I just realized that that's what we did before fbc30cd.

@Keno
Copy link
Member

Keno commented Aug 23, 2019

Perhaps we can figure out another way to break that cycle, perhaps by splitting up InteractiveUtils into two modules.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants