From 091d5645cbbd0d7c99c0142df00f691265b7d662 Mon Sep 17 00:00:00 2001 From: Ruslan Kuprieiev Date: Thu, 21 May 2020 04:41:00 +0300 Subject: [PATCH 1/2] 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. --- dvc/command/plots.py | 21 --------------------- tests/unit/command/test_plots.py | 8 -------- 2 files changed, 29 deletions(-) diff --git a/dvc/command/plots.py b/dvc/command/plots.py index 2de075cd19..c5aa6e424b 100644 --- a/dvc/command/plots.py +++ b/dvc/command/plots.py @@ -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, @@ -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." ) @@ -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." ) diff --git a/tests/unit/command/test_plots.py b/tests/unit/command/test_plots.py index 405492eff2..05b115a026 100644 --- a/tests/unit/command/test_plots.py +++ b/tests/unit/command/test_plots.py @@ -13,8 +13,6 @@ def test_metrics_diff(dvc, mocker): "template", "--targets", "datafile", - "--select", - "column1,column2", "--show-json", "-x", "x_field", @@ -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, @@ -63,8 +59,6 @@ def test_metrics_show(dvc, mocker): "result.extension", "-t", "template", - "-s", - "$.data", "--show-json", "--no-csv-header", "datafile", @@ -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, From c7d4594294b3cc7097c9cd553378391330da2183 Mon Sep 17 00:00:00 2001 From: Ruslan Kuprieiev Date: Thu, 21 May 2020 04:43:05 +0300 Subject: [PATCH 2/2] completion: update plots --- scripts/completion/dvc.bash | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/completion/dvc.bash b/scripts/completion/dvc.bash index 061b13ebdf..cc12e982a6 100644 --- a/scripts/completion/dvc.bash +++ b/scripts/completion/dvc.bash @@ -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'