Julia is missing the deactivate command

#1

When using julia on my enviroment /home/johnsmith/julia

If I want to start a new project say ProjectA, I would create the directory

/home/johnsmith/julia/project/projectA

then active it using the command

julia>]
(v1.0) pkg> activate /home/johnsmith/julia/project/projectA

Now after I finished with projectA for the time being, and want to get back to normal, the following command does not work

(v1.0) pkg>  deactivate /home/johnsmith/julia/project/projectA

So how do I get back to the state I was in before I activate projectA?

0 Likes

#2

Just use activate with no argument

pkg> activate

What made you think there was a deactivate command?

4 Likes

#3

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, …).

0 Likes

#4

Think of activate in Julia as cd in the terminal. Just like cd takes you back to your home directory, activate takes you to your home project.

7 Likes

#5

Would it not be better if julia has a deactivate command which does not take any argument or ignores any arguments and all it does is an alias for activate with no arguments?

This would make it simple for learners to grasp the concept.

If you go through the documentation of Julia in the eyes of a newbie, see if you can figure out that the command activate with no argument is the same as deactivate.

3 Likes

#6

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:

0 Likes