I find this a bit annoying
shell> mkdir Test & cd Test
(v0.7) pkg> init # or generate
Initialized project at /home/.../Test/Project.toml
(Test) pkg>
Now if I move on the directory tree, the environment for Pkg is still Test
julia> cd()
(Test) pkg>
Is this intended or is it a bug?
Version info:
Julia Version 0.7.0-beta.7
Commit 0978251 (2018-06-25 01:11 UTC)
Platform Info:
OS: Linux (x86_64-redhat-linux)
CPU: Intel(R) Core(TM) i7-7500U CPU @ 2.70GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-6.0.0 (ORCJIT, skylake)
In case it is a bug, Iāll just copy paste this into GitHub. Thanks
On newest master init will activate the new environment but cd ing into a new environment will not activate it. It requires an explicit pkg> activate command. The reason for this is that it was deemed dangerous to change what code was being loaded based on the mere existence of a file.
It will be possbile to opt into the old cd ā activate behavior.
1 Like
May I ask, why it is dangerous? Was the file meant Project.toml? Is it similar to the Python case of __init__.py?
How could I activate the v0.7 āglobalā environment without going exactly to where v0.7 project file is?
Thanks
That one is active by default. If you pkg> activate you can pkg> deactivate to go back to the 0.7 one.
See discussion in e.g. https://github.com/JuliaLang/julia/pull/27633
2 Likes
Not sure if this is 100% relevant to the discussion ā I was about to post a new topic, but was directed here. Iām probably just confused, but when I start Pkg interactively (having deleted ~/.julia), I get, say, (foo) pkg> if I have . in my load path (Iāve seen some discussion about that), but if I donāt, I seem to just get pkg> ā I donāt see (v0.7) pkg>. And activate doesnāt seem to change anything. (And deactivate doesnāt see to existā¦?)
See also Is there a replacement for ādeactivateā? Ā· Issue #464 Ā· JuliaLang/Pkg.jl Ā· GitHub
I wonder if it would be useful to have the stdlibs added as topics under development on discourse.
Thanks. Doesnāt seem to solve my issue, though.
What Iād your LOAD_PATH and what does Base. active_project() say?
Aah, thatās the issue. The LOAD_PATH contains some directories I added myself (by setting JULIA_LOAD_PATH), and Base.active_project() was empty. If I donāt set JULIA_LOAD_PATH in my shell, all is well, it seems, with LOAD_PATH containing @, @v#.# and @stdlib.
I guess thereās some magic here I havenāt picked up yet. The docs still say that LOAD_PATH can be āextendedā by defining JULIA_LOAD_PATH, but it seems itās simply overwritten. I guess this is part of the simplification.
Now, I had no idea that such things as described there were possible (i.e., inserting $JULIA_LOAD_PATH in the shell actually inserting it in Julia, even if $JULIA_LOAD_PATH is empty), so I hadnāt bothered including it. Adding it fixed everything ā I should have read #27633 more carefully! (Or ⦠is it just that the path ends with :? That seems to work, too, and is less of a magical explanation.)
Anyway, thanks! 
Sorry, I need to write docs. This design was finalized and implemented last week and I havenāt gotten a chance to document it yet.