Implement --prune flag for mamba env update #1343
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This fixes #688 and the similar issue for conda conda/conda#7279.
The prune flag is implemented by running the solver as if it was given
an empty prefix and then computing the diff between the current prefix
and the newly solved target and executing those resulting links and
unlinks.
This assumes that it is always possible to transform a given prefix to
any other consistent set of packages, since the solver never sees the
list of currently installed packages.
Furthermore a small fix for leaking temporary files is included.
This pull request is not compatible with the current conda implementation but instead implements the feature as documented in
conda env update --help
and as requested in the related conda issue (as far as I understand it). As it was suggested in #688 it might thus be preferred to implement this as a separate argument to mamba env update but with my very limited understanding of conda internals it seems a much greater task.