Skip to content

api: show/exp: add config option #9617

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion dvc/api/experiments.py
Original file line number Diff line number Diff line change
Expand Up @@ -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`.

Expand Down Expand Up @@ -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,
Expand Down
10 changes: 8 additions & 2 deletions dvc/api/show.py
Original file line number Diff line number Diff line change
Expand Up @@ -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`.

Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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],
Expand All @@ -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`.

Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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,
Expand Down