Skip to content

Commit fd73b38

Browse files
committed
api: show/exp: add config option
Fixes #9613
1 parent 0433565 commit fd73b38

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

dvc/api/experiments.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ def exp_show(
6565
num: int = 1,
6666
param_deps: bool = False,
6767
force: bool = False,
68+
config: Optional[Dict] = None,
6869
) -> List[Dict]:
6970
"""Get DVC experiments tracked in `repo`.
7071
@@ -99,13 +100,15 @@ def exp_show(
99100
When `force` is specified, DVC will reload all experiment data and
100101
ignore any previously cached results.
101102
Defaults to `False`.
103+
config (dict, optional): config to be passed through to DVC project.
104+
Defaults to `None`.
102105
103106
Returns:
104107
List[Dict]: Each item in the list will contain a dictionary with
105108
the info for an individual experiment.
106109
See Examples below.
107110
"""
108-
with Repo.open(repo) as _repo:
111+
with Repo.open(repo, config=config) as _repo:
109112
experiments = _repo.experiments.show(
110113
revs=revs,
111114
num=num,

dvc/api/show.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ def metrics_show(
4141
*targets: str,
4242
repo: Optional[str] = None,
4343
rev: Optional[str] = None,
44+
config: Optional[Dict] = None,
4445
) -> Dict:
4546
"""Get metrics tracked in `repo`.
4647
@@ -69,6 +70,8 @@ def metrics_show(
6970
hash or a dvc experiment name.
7071
If `repo` is not a Git repo, this option is ignored.
7172
If `None`, the current working tree will be used.
73+
config (dict, optional): config to be passed through to DVC project.
74+
Defaults to `None`.
7275
7376
Returns:
7477
Dict: See Examples below.
@@ -136,7 +139,7 @@ def metrics_show(
136139
https://git-scm.com/docs/revisions
137140
"""
138141

139-
with Repo.open(repo) as _repo:
142+
with Repo.open(repo, config=config) as _repo:
140143
metrics = _repo.metrics.show(
141144
targets=targets,
142145
revs=rev if rev is None else [rev],
@@ -157,6 +160,7 @@ def params_show(
157160
stages: Optional[Union[str, Iterable[str]]] = None,
158161
rev: Optional[str] = None,
159162
deps: bool = False,
163+
config: Optional[Dict] = None,
160164
) -> Dict:
161165
"""Get parameters tracked in `repo`.
162166
@@ -195,6 +199,8 @@ def params_show(
195199
deps (bool, optional): Whether to retrieve only parameters that are
196200
stage dependencies or not.
197201
Defaults to `False`.
202+
config (dict, optional): config to be passed through to DVC project.
203+
Defaults to `None`.
198204
199205
Returns:
200206
Dict: See Examples below.
@@ -379,7 +385,7 @@ def params_show(
379385
if isinstance(stages, str):
380386
stages = [stages]
381387

382-
with Repo.open(repo) as _repo:
388+
with Repo.open(repo, config=config) as _repo:
383389
params = _repo.params.show(
384390
revs=rev if rev is None else [rev],
385391
targets=targets,

0 commit comments

Comments
 (0)