Repository: iterative/dvc

Issue:
api: support config for params_show/exp_show/metrics_show
Related 
https://github.com/iterative/dvc/issues/9154
https://github.com/iterative/dvc/issues/9610


Discussion:
@efiop Do you plan to work on it or just noting it as a possible follow up? Doesn't feel like a priority unless I'm missing something.
@dberenbaum It is a few oneliners with the most complications in the docstrings. I have it around already, will cleanup docstrings in the morning and will send it off. Just for the sake of completeness in api department.

Resolving patch:
diff --git a/dvc/api/experiments.py b/dvc/api/experiments.py
--- a/dvc/api/experiments.py
+++ b/dvc/api/experiments.py
@@ -65,6 +65,7 @@ def exp_show(
     num: int = 1,
     param_deps: bool = False,
     force: bool = False,
+    config: Optional[Dict] = None,
 ) -> List[Dict]:
     """Get DVC experiments tracked in `repo`.
 
@@ -99,13 +100,15 @@ def exp_show(
             When `force` is specified, DVC will reload all experiment data and
             ignore any previously cached results.
             Defaults to `False`.
+        config (dict, optional): config to be passed through to DVC project.
+            Defaults to `None`.
 
     Returns:
         List[Dict]: Each item in the list will contain a dictionary with
             the info for an individual experiment.
             See Examples below.
     """
-    with Repo.open(repo) as _repo:
+    with Repo.open(repo, config=config) as _repo:
         experiments = _repo.experiments.show(
             revs=revs,
             num=num,
diff --git a/dvc/api/show.py b/dvc/api/show.py
--- a/dvc/api/show.py
+++ b/dvc/api/show.py
@@ -41,6 +41,7 @@ def metrics_show(
     *targets: str,
     repo: Optional[str] = None,
     rev: Optional[str] = None,
+    config: Optional[Dict] = None,
 ) -> Dict:
     """Get metrics tracked in `repo`.
 
@@ -69,6 +70,8 @@ def metrics_show(
             hash or a dvc experiment name.
             If `repo` is not a Git repo, this option is ignored.
             If `None`, the current working tree will be used.
+        config (dict, optional): config to be passed through to DVC project.
+            Defaults to `None`.
 
     Returns:
         Dict: See Examples below.
@@ -136,7 +139,7 @@ def metrics_show(
         https://git-scm.com/docs/revisions
     """
 
-    with Repo.open(repo) as _repo:
+    with Repo.open(repo, config=config) as _repo:
         metrics = _repo.metrics.show(
             targets=targets,
             revs=rev if rev is None else [rev],
@@ -157,6 +160,7 @@ def params_show(
     stages: Optional[Union[str, Iterable[str]]] = None,
     rev: Optional[str] = None,
     deps: bool = False,
+    config: Optional[Dict] = None,
 ) -> Dict:
     """Get parameters tracked in `repo`.
 
@@ -195,6 +199,8 @@ def params_show(
         deps (bool, optional): Whether to retrieve only parameters that are
             stage dependencies or not.
             Defaults to `False`.
+        config (dict, optional): config to be passed through to DVC project.
+            Defaults to `None`.
 
     Returns:
         Dict: See Examples below.
@@ -379,7 +385,7 @@ def params_show(
     if isinstance(stages, str):
         stages = [stages]
 
-    with Repo.open(repo) as _repo:
+    with Repo.open(repo, config=config) as _repo:
         params = _repo.params.show(
             revs=rev if rev is None else [rev],
             targets=targets,


Test patch: