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

Introduce env command to manage environments #621

Open
carstenbauer opened this issue Aug 11, 2018 · 19 comments
Open

Introduce env command to manage environments #621

carstenbauer opened this issue Aug 11, 2018 · 19 comments

Comments

@carstenbauer
Copy link
Member

carstenbauer commented Aug 11, 2018

It would be nice to have a command for listing all environments. Currently the best one can do is gc, which will output a list at the top. Also, autocompletion for environment names when doing activate would be nice.

@00vareladavid
Copy link
Contributor

At the very least: adding tab completion for pkg> activate --shared should be straightforward.

@carstenbauer
Copy link
Member Author

It feels strange to me that julia manages environments in a somewhat hidden manner. It keeps a list of all active manifests (environments), as can be seen by gc, but doesn't let me see the list easily (this issue), doesn't have autocompletion (this issue), and also doesn't let me remove environments without deleting them on disk.

Why not make this more transparent?

activate could add an environment to the list, listenvs could list all known environments, and rmenv could remove an environment. The user would have more control over what julia tracks.

@fredrikekre
Copy link
Member

It seems iffy that Pkg should be able to remove environments. What should be deleted? The Project.toml and Manifest.toml files?

@carstenbauer
Copy link
Member Author

carstenbauer commented Sep 11, 2018

Nothing should actually be deleted. Julia should just stop keeping track of that particular environment (manifest). I.e. the manifest should be removed from the list that I see when I do gc.

@carstenbauer
Copy link
Member Author

I have this use case in mind: My collaborator sends me a project folder. I wanna check it out so I do activate . and instantiate. However, from that point on I have the projects dependencies installed and can't free them up without deleting the whole project folder.

Why can't the user tell Julia to ignore this environment again? I mean it also didn't track it automatically when I created it on my disk. Only when I did activate it at some point.

@fredrikekre
Copy link
Member

How about

(v1) pkg> listenv
[1] `/home/fredrik/.julia/environments/v0.7/Manifest.toml`
[2] `/home/fredrik/.julia/environments/v1.0/Manifest.toml`
[3] `/home/fredrik/TestProject/Manifest.toml`

(v1) pkg> activate 3

(TestProject) pkg>

@carstenbauer
Copy link
Member Author

Looks great!

@carstenbauer
Copy link
Member Author

It seems iffy that Pkg should be able to remove environments. What should be deleted? The Project.toml and Manifest.toml files?

Maybe, to avoid the confusion, the command to remove an environment from the list should be called untrack or similar rather than rmenv.

@StefanKarpinski
Copy link
Member

What about an env command and an env list subcommand?

@carstenbauer
Copy link
Member Author

What about an env command and an env list subcommand?

And env untrack? Sounds great to me.

Although I'd love to make a PR to get this merged soonish, I feel I'm not the right person for this. So hopefully someone else will give it a shot soon. I'd appreciate it!

@00vareladavid 00vareladavid changed the title List all my environments and autocompletion for activate Introduce env command to manage environments Oct 21, 2018
@00vareladavid
Copy link
Contributor

I renamed the issue to focus on env. #834 exists for tab completion on activate (which should be made a lot simpler by #839).

@carstenbauer
Copy link
Member Author

Is someone working on this? I'd love to see this in 1.1 and I heard feature freeze is mid Nov.

@carstenbauer
Copy link
Member Author

carstenbauer commented Jul 24, 2019

@fredrikekre talk at juliacon yesterday reminded me of this feature request. Someone from the audience basically wanted the env untrack functionality.

To add to the list of features that go under env, it would be cool to make stacking/unstacking environments (i.e modifying the load path) easier, such that one could use autocomplete for this as well. Something like env stack --shared SomeEnv. What do you think?

@Datseris
Copy link
Contributor

Datseris commented Oct 30, 2019

I'm just adding an argument about why all of this is very useful. Just asked on Slack if there is some command exactly like env untrack described here. There isn't one yet.

Here is a reason why deleting the Manifest.toml or renaming it does not work. Scientists (at least in my workplace) are required to keep an archive of the code and data base they used in a scientific project, for several years after the project has been published. I have such bases, which are currently tracked by the package manager, thereby keeping installations of old packages (without much use). I do not want to (and legally, I also cannot) alter these archived code bases by removing or renaming any file, much less so such an important file as a Manifest.toml.

This is the currently best standing workaround by @fredrikekre

$ mv Project.toml _Project.toml
$ mv Manifest.toml _Manifest.toml
$ pkg gc
$ mv _Project.toml Project.toml
$ mv _Manifest.toml Manifest.toml

@carstenbauer
Copy link
Member Author

FWIW, came up on slack again (someone was looking for env untrack functionality).

@KristofferC
Copy link
Member

I think something like described here makes sense.

@carstenbauer
Copy link
Member Author

@StefanKarpinski
Copy link
Member

env untrack --old might work nicely with gc to allow reclaiming stuff that's rooted by environments that haven't been used in a long time. cf #2685

@halleysfifthinc
Copy link

I just bumped into needing/wanting this (I had 72Gb of artifacts) and making do with PkgCleanup from @giordano (removed 60Gb of artifacts after "untracking" old manifests). The default behavior of Pkg to never forget an manifest is somewhat inconsistent with the officially(?) blessed workflow recommendation to limit use of the default environment and use local env's for everything. How does that not lead to an enormous group of artifacts only kept around for old environments?

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

No branches or pull requests

7 participants