diff --git a/dvc/command/plots.py b/dvc/command/plots.py index 3904f61fdd..1cbba00949 100644 --- a/dvc/command/plots.py +++ b/dvc/command/plots.py @@ -45,7 +45,7 @@ def run(self): rel: str = self.args.out or "plots.html" path = (Path.cwd() / rel).resolve() self.repo.plots.write_html( - path, plots=plots, html_template_path=self.args.html_template + path, plots=plots, html_template_path=self.args.html ) except DvcException: @@ -249,8 +249,8 @@ def _add_output_arguments(parser): help="Open plot file directly in the browser.", ) parser.add_argument( - "--html-template", + "--html", default=None, - help="Custom HTML template for VEGA visualization.", + help="Custom HTML for VEGA visualization.", metavar="", ) diff --git a/dvc/config_schema.py b/dvc/config_schema.py index dfa2a0ac24..059e8e891c 100644 --- a/dvc/config_schema.py +++ b/dvc/config_schema.py @@ -225,5 +225,5 @@ class RelPath(str): # enabled by default. It's of no use, kept for backward compatibility. Optional("parametrization", default=True): Bool }, - "plots": {"html_template": str}, + "plots": {"html": str}, } diff --git a/dvc/repo/plots/__init__.py b/dvc/repo/plots/__init__.py index 6f76cfb3ae..3c21addf10 100644 --- a/dvc/repo/plots/__init__.py +++ b/dvc/repo/plots/__init__.py @@ -242,7 +242,7 @@ def write_html( ): if not html_template_path: html_template_path = self.repo.config.get("plots", {}).get( - "html_template", None + "html", None ) if html_template_path and not os.path.isabs(html_template_path): html_template_path = os.path.join( diff --git a/dvc/utils/html.py b/dvc/utils/html.py index b4b56a9a06..1cf2f8c5b5 100644 --- a/dvc/utils/html.py +++ b/dvc/utils/html.py @@ -12,7 +12,7 @@ - {plot_divs} + {dvc_plots} """ @@ -29,7 +29,7 @@ def __init__(self, placeholder): class HTML: - PLACEHOLDER = "plot_divs" + PLACEHOLDER = "dvc_plots" PLACEHOLDER_FORMAT_STR = f"{{{PLACEHOLDER}}}" def __init__(self, template: str = None): diff --git a/tests/func/utils/test_html.py b/tests/func/utils/test_html.py index 37d9266bc8..64bdb8de9b 100644 --- a/tests/func/utils/test_html.py +++ b/tests/func/utils/test_html.py @@ -11,7 +11,7 @@ - {plot_divs} + {dvc_plots} """ @@ -19,11 +19,11 @@ @pytest.mark.parametrize( "template,page_elements,expected_page", [ - (None, ["content"], PAGE_HTML.format(plot_divs="content")), + (None, ["content"], PAGE_HTML.format(dvc_plots="content")), ( CUSTOM_PAGE_HTML, ["content"], - CUSTOM_PAGE_HTML.format(plot_divs="content"), + CUSTOM_PAGE_HTML.format(dvc_plots="content"), ), ], )