For what it’s worth, there is an activate and a deactivate command in Conda/Python.
I find it better from a discoverability point of view, as most commands tends to have an opposite one (apt install/remove, Pkg.add/Pkg.rm, …).
If you think the documentation is can be improved, please open an issue or (ideally) make a PR. It is undeed true that the documentation does not give an example for pkg> activate without arguments, so that could be remedied. Somewhat related:
I don’t know how the status was when this was written but now
If no argument is given to activate, then activate the home project. The home project is specified by either the --project command line option to the julia executable, or the
JULIA_PROJECT environment variable.
(v1.3) pkg> ?activate
activate [--shared] path
Activate the environment at the given path, or the home project environment if no path is specified.
While true I think our documentation is still not as good as it could be. I think the relevant sentence
If no argument is given to activate , then activate the home project. The home project is specified by either the --project command line option to the julia executable, or the JULIA_PROJECT environment variable.
could be confusing for a beginner. What if I neither started Julia with --project nor set the JULIA_PROJECT environment variable and do ] activate? It’s not clear from the docstring what will happen in this case.
Also, note the use of the term “home project”. I reckon the difference between “home project” and “default project” (v1.x) is subtle to a beginner who, again, likely hasn’t specified a “home project”. In this context, let me also mention that the “default project” (v1.x) - which by default is equal to the “home project” - is special in the sense that it is (by another default) also the “global project”. A fact which is also not as clear from the documentation as it could be (you have to read about the LOAD_PATH to understand this, an advanced concept in my opinion).
As has been discussed on Slack at some point (@davidanthoff) I personally think that the “default project” shouldn’t be equal to the “global environment” (the one which automatically is in the LOAD_PATH) to begin with. I’d like extra syntax like ] add --global MyPackage for adding a package to a separate global environment. This way, confusions like this one, which came up just yesterday, could be easily avoided.
In any case, I think that the Pkg documentation in its entirety explains almost all features/mechanisms, but individual sections can be pretty confusing without reading the rest of the docs. I think we can do better and I hope to find the time to make a few PRs soon.
After reading this thread and the docs, I do have a question, which I hope I will be forgiven for asking here: Does starting up Julia necessarily activate a default environment?
And if that’s the case, then to “deactivate” it, I can just activate some/any other environment? I’m not trying to be pedantic about the wording, it’s just that I want to make sure that Pkg.activate(; temp=true) will safely take me out of the previous environment once and for all. Thanks.