Skip to content

Commit

Permalink
plots: remove --select CLI option (#3840)
Browse files Browse the repository at this point in the history
* plots: remove --select from CLI

It needs reconsideration, we can't release it as is right now. E.g. it
expects xpath to start with `$`, but that will get interpreted by your
shell, which is bad.

* completion: update plots
  • Loading branch information
efiop authored May 21, 2020
1 parent 040458a commit 130b76c
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 31 deletions.
21 changes: 0 additions & 21 deletions dvc/command/plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,12 @@ def _func(self, *args, **kwargs):
raise NotImplementedError

def run(self):
fields = None
jsonpath = None
if self.args.select:
if self.args.select.startswith("$"):
jsonpath = self.args.select
else:
fields = set(self.args.select.split(","))
try:
plots = self._func(
targets=self.args.targets,
template=self.args.template,
fields=fields,
x_field=self.args.x,
y_field=self.args.y,
path=jsonpath,
csv_header=not self.args.no_csv_header,
title=self.args.title,
x_title=self.args.xlab,
Expand Down Expand Up @@ -128,12 +119,6 @@ def add_parser(subparsers, parent_parser):
plots_show_parser.add_argument(
"-o", "--out", default=None, help="Destination path to save plots to.",
)
plots_show_parser.add_argument(
"-s",
"--select",
default=None,
help="Choose which field(s) or JSONPath to include in the plots.",
)
plots_show_parser.add_argument(
"-x", default=None, help="Field name for x axis."
)
Expand Down Expand Up @@ -192,12 +177,6 @@ def add_parser(subparsers, parent_parser):
plots_diff_parser.add_argument(
"-o", "--out", default=None, help="Destination path to save plots to.",
)
plots_diff_parser.add_argument(
"-s",
"--select",
default=None,
help="Choose which field(s) or JSONPath to include in the plot.",
)
plots_diff_parser.add_argument(
"-x", default=None, help="Field name for x axis."
)
Expand Down
4 changes: 2 additions & 2 deletions scripts/completion/dvc.bash
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ _dvc_pipeline_list=''
_dvc_pipeline_show='-c --commands -o --outs --ascii --dot --tree -l --locked'
_dvc_pipeline_show_COMPGEN=_dvc_compgen_DVCFiles
_dvc_plots='show diff'
_dvc_plots_show='-t --template -f --file -s --select -x -y --stdout --no-csv-header --no-html --title --xlab --ylab'
_dvc_plots_diff='-t --template -d --datafile -f --file -s --select -x -y --stdout --no-csv-header --no-html --title --xlab --ylab'
_dvc_plots_show='-t --template -o --out -x -y --show-json --no-csv-header --title --xlab --ylab'
_dvc_plots_diff='-t --template --targets -o --out -x -y --show-json --no-csv-header --title --xlab --ylab'
_dvc_pull='-j --jobs -r --remote -a --all-branches -T --all-tags -f --force -d --with-deps -R --recursive'
_dvc_pull_COMPGEN=_dvc_compgen_DVCFiles
_dvc_push='-j --jobs -r --remote -a --all-branches -T --all-tags -d --with-deps -R --recursive'
Expand Down
8 changes: 0 additions & 8 deletions tests/unit/command/test_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ def test_metrics_diff(dvc, mocker):
"template",
"--targets",
"datafile",
"--select",
"column1,column2",
"--show-json",
"-x",
"x_field",
Expand Down Expand Up @@ -43,8 +41,6 @@ def test_metrics_diff(dvc, mocker):
targets=["datafile"],
template="template",
revs=["HEAD", "tag1", "tag2"],
fields={"column1", "column2"},
path=None,
x_field="x_field",
y_field="y_field",
csv_header=True,
Expand All @@ -63,8 +59,6 @@ def test_metrics_show(dvc, mocker):
"result.extension",
"-t",
"template",
"-s",
"$.data",
"--show-json",
"--no-csv-header",
"datafile",
Expand All @@ -82,8 +76,6 @@ def test_metrics_show(dvc, mocker):
cmd.repo,
targets=["datafile"],
template="template",
fields=None,
path="$.data",
x_field=None,
y_field=None,
csv_header=False,
Expand Down

0 comments on commit 130b76c

Please sign in to comment.