Repository: conda/conda

Issue:
Pin all packages in a conda environment without listing them all
<!--
Hi!  Read this; it's important.

This is an issue tracker for conda -- the package manager.  File feature requests
for conda here, as well as bug reports about something conda has messed up.

If your issue is a bug report or feature request for:
  * a specific conda package from Anaconda ('defaults' channel):
      ==> file at https://github.com/ContinuumIO/anaconda-issues
  * a specific conda package from conda-forge:
      ==> file at the corresponding feedstock under https://github.com/conda-forge
  * repo.anaconda.com access and service:
      ==> file at https://github.com/ContinuumIO/anaconda-issues
  * anaconda.org access and service:
      ==> file at https://anaconda.org/contact/report
  * commands under 'conda build':
      ==> file at https://github.com/conda/conda-build
  * commands under 'conda env':
      ==> please file it here!
  * all other conda commands that start with 'conda':
      ==> please file it here!

If you continue on, and especially if you are submitting a bug report,

   **please include all requested information below.**

If a maintainer determines the information is required to understand 
your issue, and if it is not provided, your issue may be
closed automatically.

-->

**I'm submitting a...**
  - [ ] bug report
  - [X] feature request


## Current Behavior
<!-- What actually happens?
     If you want to include console output, please use "Steps to Reproduce" below. -->

According to the [docs](https://conda.io/docs/user-guide/tasks/manage-pkgs.html#preventing-packages-from-updating-pinning) it is possible to pin a list of packages in a conda environment by adding a file named `pinned` to the `conda-meta` directory with a list of the packages that you do not want updated.

### Steps to Reproduce
<!-- If the current behavior is a bug, please provide specific, minimal steps to independently reproduce.
     Include the exact conda commands that reproduce the issue and their output between the ticks below. -->
```
N/A
```

## Expected Behavior
<!-- What do you think should happen? -->

Is it possible to pin all packages in a conda environment without explicitly mentioning all of them?  i.e. just use a keyword like `all` in the `pinned` file inside the `conda-meta` directory.




Discussion:
There's a `--freeze-installed` flag.  It's for sure there in the master branch, and might also be available in the latest 4.5 (I don't remember).  Does that cover your use case?
If it's not available in conda 4.5, you can get conda 4.6.0a2 from the `conda-canary` channel to try it out.

Is `--freze-installed` equivalent to `--no-update-deps`?
https://github.com/conda/conda/blob/master/conda/cli/conda_argparse.py#L1377


Just to add to my previous comments:
* `--no-update-deps` (and presumably `--freeze-installed`) helps when you are installing new packages into an existing environment. However, you need to use `--no-update-deps` every time that you want to install new packages.
* regarding my use case: once the environment has been created or updated, I would like to have the option of running a command after which all the dependencies are frozen and you don't have to use `--no-update-deps` every time you want to install a new package into that environment. I guess that's what you currently achieve with the `pinned` file inside the `conda-meta` directory. However, that's only suitable when you only want to pin a small number of packages. For environments where you have a large number of packages and you want to pin them all, it is a bit of a problem. 

Resolving patch:
diff --git a/conda/cli/conda_argparse.py b/conda/cli/conda_argparse.py
--- a/conda/cli/conda_argparse.py
+++ b/conda/cli/conda_argparse.py
@@ -687,7 +687,7 @@ def configure_parser_install(sub_parsers):
     Conda attempts to install the newest versions of the requested packages. To
     accomplish this, it may update some packages that are already installed, or
     install additional packages. To prevent existing packages from updating,
-    use the --no-update-deps option. This may force conda to install older
+    use the --freeze-installed option. This may force conda to install older
     versions of the requested packages, and it does not prevent additional
     dependency packages from being installed.
 
diff --git a/conda/cli/main_config.py b/conda/cli/main_config.py
--- a/conda/cli/main_config.py
+++ b/conda/cli/main_config.py
@@ -12,7 +12,7 @@
 
 from .. import CondaError
 from .._vendor.auxlib.entity import EntityEncoder
-from ..base.constants import PathConflict, SafetyChecks
+from ..base.constants import PathConflict, SafetyChecks, DepsModifier, UpdateModifier
 from ..base.context import context, sys_rc_path, user_rc_path
 from ..common.compat import isiterable, iteritems, itervalues, string_types
 from ..common.configuration import pretty_list, pretty_map
@@ -349,6 +349,8 @@ def enum_representer(dumper, data):
 
         yaml.representer.RoundTripRepresenter.add_representer(SafetyChecks, enum_representer)
         yaml.representer.RoundTripRepresenter.add_representer(PathConflict, enum_representer)
+        yaml.representer.RoundTripRepresenter.add_representer(DepsModifier, enum_representer)
+        yaml.representer.RoundTripRepresenter.add_representer(UpdateModifier, enum_representer)
 
         try:
             with open(rc_path, 'w') as rc:


Test patch: