New feature request: It would be nice to be able to save an environment with only its user requested packages and without also listing their dependencies. This would lead to simpler environment files which are easier to read and edit, and would also often make the environment file more portable across platforms. The information in '$PREFIX/conda-meta/history' might suffice, or conda might need to tag each package with a boolean variable indicating whether it was requested by a user or installed as a dependency of a package requested by a user.
Thanks for this report!
Has there been any progress with this?
And, if not, what is the current recommended best-practice? Manually maintaining a separate environment.yml file for each platform?
I've contacted the devs about a way to use conda to create a "request list" with only the packages that a user requested, and not the packages that were pulled in as dependencies of those. I'll reply here and at conda issue 1033 sometime this week when they get back to me.
Without a request list, you could either have an automatically generated file for each platform, or one hand edited file for all platforms. I usually use an automatically generated file for each platform, because it's quite fast and easy to generate without hand editing, it's more specific, and it makes the results a little more reproducible, but in some cases the convenience of using a single file for all platforms may outweigh that.
A request list will only be helpful for some environments. For any environment, we can ask if all its user requested packages are cross platform, and if all its other packages are cross platform. The answers to these two questions divide environments into four categories: no/no, no/yes, yes/no, and yes/yes. A request list would help in the yes/no category but not the other three.
Here's an example of a hand edited file. On OS X I ran:
conda create -n env1 scipy
source activate env1
conda env export > environment.yml
This was the output:
I simplified it to this environment.yml file: