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

REPL mode gives different behavior when activating with @ #2983

Closed
MilesCranmer opened this issue Feb 13, 2022 · 9 comments
Closed

REPL mode gives different behavior when activating with @ #2983

MilesCranmer opened this issue Feb 13, 2022 · 9 comments

Comments

@MilesCranmer
Copy link
Sponsor Member

MilesCranmer commented Feb 13, 2022

There is different behavior when activating an environment with "@" as the first character, between REPL mode and functional mode:

julia> pkg"activate @test"
  Activating new project at `~/.julia/environments/test`

julia> Pkg.activate("@test")
  Activating new project at `~/Documents/@test`

If this is intended behavior, what is the correct way to activate an env in the Julia depot using Pkg's functional mode?
(Nevermind, it's just shared = true)

@MilesCranmer MilesCranmer changed the title REPL mode gives different behaviour when activating with @ REPL mode gives different behavior when activating with @ Feb 13, 2022
@mkitti
Copy link
Contributor

mkitti commented Feb 13, 2022

I actually think this is a bug. The alternative version is pkg"activate @test", but that is still meant for interactive use.

@MilesCranmer MilesCranmer reopened this Feb 13, 2022
@DilumAluthge
Copy link
Member

Duplicate of #2367?

@DilumAluthge
Copy link
Member

I'm inclined to agree with @fredrikekre's comment here: #2367 (comment)

@MilesCranmer
Copy link
Sponsor Member Author

This does make sense in theory, but it's tripped up a few people now (enough for two GH issues) so it might be good to at least add a warning to activate("@... that the user should use shared instead.

Also, regarding this:

Pkg.pkg"activate @global_env"

Is there a way to pass an IOStream here? This is the reason I am using the functional API rather than REPL.

@fredrikekre
Copy link
Member

Use the shared argument.

@MilesCranmer
Copy link
Sponsor Member Author

I would just add that it does still feel like unexpected behavior that an identical string passed to the REPL version and the functional version should give entirely different paths, (keeping in mind that "@" is a valid character in filenames). At the very least passing "@" to the functional API should raise an error or warning.

@mkitti
Copy link
Contributor

mkitti commented Feb 13, 2022

it might be good to at least add a warning to activate("@... that the user should use shared instead.

I think this is a reasonable consideration. You could suppress the warning with shared = false since that would be explicit.

@DilumAluthge
Copy link
Member

#2984

@MilesCranmer
Copy link
Sponsor Member Author

Beat me to the PR by 1 minute @DilumAluthge :) Thanks!

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

4 participants