Repository: conda/conda

Issue:
deprecate 'conda info package_name'
Add deprecation warning for `conda info package_name`. Instead, direct users to `conda search package_name --info`, where they can also use `--channel` or a full MatchSpec.


Discussion:

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
@@ -301,12 +301,11 @@ def configure_parser_info(sub_parsers):
         help='Display list of channels with tokens exposed.',
     )
 
-    # TODO: deprecate 'conda info <PACKAGE>'
     p.add_argument(
         'packages',
         action="store",
         nargs='*',
-        help="Display information about packages.",
+        help=SUPPRESS,
     )
 
     p.set_defaults(func='.main_info.execute')
diff --git a/conda/cli/main_info.py b/conda/cli/main_info.py
--- a/conda/cli/main_info.py
+++ b/conda/cli/main_info.py
@@ -96,6 +96,10 @@ def print_package_info(packages):
             for prec in result:
                 pretty_package(prec)
 
+    print("WARNING: 'conda info package_name' is deprecated.\n"
+          "          Use 'conda search package_name --info'.",
+          file=sys.stderr)
+
 
 def get_info_dict(system=False):
     try:


Test patch:
diff --git a/tests/helpers.py b/tests/helpers.py
--- a/tests/helpers.py
+++ b/tests/helpers.py
@@ -62,13 +62,13 @@ def captured(disallow_stderr=True):
             raise Exception("Got stderr output: %s" % c.stderr)
 
 
-def capture_json_with_argv(command, **kwargs):
-    stdout, stderr, exit_code = run_inprocess_conda_command(command)
+def capture_json_with_argv(command, disallow_stderr=True, ignore_stderr=False, **kwargs):
+    stdout, stderr, exit_code = run_inprocess_conda_command(command, disallow_stderr)
     if kwargs.get('relaxed'):
         match = re.match('\A.*?({.*})', stdout, re.DOTALL)
         if match:
             stdout = match.groups()[0]
-    elif stderr:
+    elif stderr and not ignore_stderr:
         # TODO should be exception
         return stderr
     try:
@@ -90,10 +90,10 @@ def assert_in(a, b, output=""):
     assert a.lower() in b.lower(), "%s %r cannot be found in %r" % (output, a.lower(), b.lower())
 
 
-def run_inprocess_conda_command(command):
+def run_inprocess_conda_command(command, disallow_stderr=True):
     # anything that uses this function is an integration test
     reset_context(())
-    with argv(split(command)), captured() as c:
+    with argv(split(command)), captured(disallow_stderr) as c:
         initialize_logging()
         try:
             exit_code = cli.main()
diff --git a/tests/test_cli.py b/tests/test_cli.py
--- a/tests/test_cli.py
+++ b/tests/test_cli.py
@@ -52,7 +52,8 @@ def test_info(self):
         for key in keys:
             assert key in res
 
-        res = capture_json_with_argv('conda info conda --json')
+        res = capture_json_with_argv('conda info conda --json', disallow_stderr=False,
+                                     ignore_stderr=True)
         self.assertIsInstance(res, dict)
         self.assertIn('conda', res)
         self.assertIsInstance(res['conda'], list)
diff --git a/tests/test_info.py b/tests/test_info.py
--- a/tests/test_info.py
+++ b/tests/test_info.py
@@ -44,7 +44,6 @@ def test_info():
 @pytest.mark.integration
 def test_info_package_json():
     out, err, rc = run_command(Commands.INFO, "--json", "numpy=1.11.0=py35_0")
-    assert err == ""
 
     out = json.loads(out)
     assert set(out.keys()) == {"numpy=1.11.0=py35_0"}
@@ -52,7 +51,6 @@ def test_info_package_json():
     assert isinstance(out["numpy=1.11.0=py35_0"], list)
 
     out, err, rc = run_command(Commands.INFO, "--json", "numpy")
-    assert err == ""
 
     out = json.loads(out)
     assert set(out.keys()) == {"numpy"}