Repository: iterative/dvc

Issue:
plots modify: change --no-csv-header to --no-header?
> Extracted from https://github.com/iterative/dvc.org/pull/1382#pullrequestreview-425769472

> should it be just --no-header? - @shcheklein

> or --no-table-header since TSV is also supported. This way it remains obvious that it only applies to tabular metric files. But I could also support --no-header — cleaner.
- me

> I like the --no-table-header - @pared 

### Please provide information about your setup

DVC 1.0


Discussion:
Guys, so maybe `--no-header` after all? Or do you see a different usecase for `--no-header` that will force us to create `--no-table-header` in the future to differentiate the use cases? @pared 
+1 for `--no-header`, at least `--no-csv-header` feels wrong since it's not CSV only
Hi, Can I work on this issue?
I don't see a future use case for `--no-header` as of today, let's do it. I guess if there would be more important and viable use case for that option, we would know by now.

Patch:
diff --git a/dvc/command/plots.py b/dvc/command/plots.py
--- a/dvc/command/plots.py
+++ b/dvc/command/plots.py
@@ -193,11 +193,11 @@ def _add_props_arguments(parser):
     parser.add_argument("-x", default=None, help="Field name for x axis.")
     parser.add_argument("-y", default=None, help="Field name for y axis.")
     parser.add_argument(
-        "--no-csv-header",
+        "--no-header",
         action="store_false",
-        dest="csv_header",
+        dest="header",
         default=None,  # Use default None to distinguish when it's not used
-        help="Provided CSV ot TSV datafile does not have a header.",
+        help="Provided CSV or TSV datafile does not have a header.",
     )
     parser.add_argument(
         "--title", default=None, metavar="<text>", help="Plot title."
diff --git a/dvc/output/base.py b/dvc/output/base.py
--- a/dvc/output/base.py
+++ b/dvc/output/base.py
@@ -61,7 +61,7 @@ class BaseOutput:
     PARAM_PLOT_X_LABEL = "x_label"
     PARAM_PLOT_Y_LABEL = "y_label"
     PARAM_PLOT_TITLE = "title"
-    PARAM_PLOT_CSV_HEADER = "csv_header"
+    PARAM_PLOT_HEADER = "header"
     PARAM_PERSIST = "persist"
 
     METRIC_SCHEMA = Any(
diff --git a/dvc/repo/plots/__init__.py b/dvc/repo/plots/__init__.py
--- a/dvc/repo/plots/__init__.py
+++ b/dvc/repo/plots/__init__.py
@@ -18,7 +18,7 @@ def collect(self, targets=None, revs=None):
 
         Returns a structure like:
             {rev: {plots.csv: {
-                props: {x: ..., "csv_header": ..., ...},
+                props: {x: ..., "header": ..., ...},
                 data: "...data as a string...",
             }}}
         Data parsing is postponed, since it's affected by props.
@@ -200,7 +200,7 @@ def _render(datafile, datas, props, templates):
         rev_data = plot_data(datafile, rev, datablob).to_datapoints(
             fields=fields,
             path=props.get("path"),
-            csv_header=props.get("csv_header", True),
+            header=props.get("header", True),
             append_index=props.get("append_index", False),
         )
         data.extend(rev_data)
diff --git a/dvc/repo/plots/data.py b/dvc/repo/plots/data.py
--- a/dvc/repo/plots/data.py
+++ b/dvc/repo/plots/data.py
@@ -181,10 +181,10 @@ def __init__(self, filename, revision, content, delimiter=","):
         super().__init__(filename, revision, content)
         self.delimiter = delimiter
 
-    def raw(self, csv_header=True, **kwargs):
+    def raw(self, header=True, **kwargs):
         first_row = first(csv.reader(io.StringIO(self.content)))
 
-        if csv_header:
+        if header:
             reader = csv.DictReader(
                 io.StringIO(self.content), delimiter=self.delimiter,
             )
diff --git a/dvc/schema.py b/dvc/schema.py
--- a/dvc/schema.py
+++ b/dvc/schema.py
@@ -37,7 +37,7 @@
     BaseOutput.PARAM_PLOT_X_LABEL: str,
     BaseOutput.PARAM_PLOT_Y_LABEL: str,
     BaseOutput.PARAM_PLOT_TITLE: str,
-    BaseOutput.PARAM_PLOT_CSV_HEADER: bool,
+    BaseOutput.PARAM_PLOT_HEADER: bool,
 }
 PLOT_PROPS_SCHEMA = {
     **OUT_PSTAGE_DETAILED_SCHEMA[str],


Test patch:
diff --git a/tests/func/plots/test_plots.py b/tests/func/plots/test_plots.py
--- a/tests/func/plots/test_plots.py
+++ b/tests/func/plots/test_plots.py
@@ -47,7 +47,7 @@ def test_plot_csv_one_column(tmp_dir, scm, dvc, run_copy_metrics):
     )
 
     props = {
-        "csv_header": False,
+        "header": False,
         "x_label": "x_title",
         "y_label": "y_title",
         "title": "mytitle",
diff --git a/tests/unit/command/test_plots.py b/tests/unit/command/test_plots.py
--- a/tests/unit/command/test_plots.py
+++ b/tests/unit/command/test_plots.py
@@ -63,7 +63,7 @@ def test_metrics_show(dvc, mocker):
             "-t",
             "template",
             "--show-vega",
-            "--no-csv-header",
+            "--no-header",
             "datafile",
         ]
     )
@@ -79,8 +79,7 @@ def test_metrics_show(dvc, mocker):
     assert cmd.run() == 0
 
     m.assert_called_once_with(
-        targets=["datafile"],
-        props={"template": "template", "csv_header": False},
+        targets=["datafile"], props={"template": "template", "header": False},
     )