diff --git a/dvc/render/match.py b/dvc/render/match.py index 86eba55c3..0e7b5e9b4 100644 --- a/dvc/render/match.py +++ b/dvc/render/match.py @@ -8,7 +8,6 @@ import dpath.options from funcy import get_in, last from dvc.repo.plots import _normpath, infer_data_sources -from dvc.utils.plots import get_plot_id from .convert import _get_converter @@ -42,8 +41,7 @@ class PlotsData: for plot_id, plot_definition in config_file_content.get( "data", {} ).items(): - full_id = get_plot_id(plot_id, config_file) - groups[full_id].append((rev, plot_id, plot_definition)) + groups[plot_id].append((rev, plot_id, plot_definition)) return dict(groups) def get_definition_data(self, target_files, rev): diff --git a/dvc/repo/plots/__init__.py b/dvc/repo/plots/__init__.py index 4225e3a50..5a370c8d9 100644 --- a/dvc/repo/plots/__init__.py +++ b/dvc/repo/plots/__init__.py @@ -367,14 +367,11 @@ def infer_data_sources(plot_id, config=None): def _matches(targets, config_file, plot_id): import re - from dvc.utils.plots import get_plot_id - if not targets: return True - full_id = get_plot_id(plot_id, config_file) if any( - (re.match(target, plot_id) or re.match(target, full_id)) for target in targets + (re.match(target, plot_id) or re.match(target, plot_id)) for target in targets ): return True return False diff --git a/dvc/utils/plots.py b/dvc/utils/plots.py deleted file mode 100644 index 636a22059..000000000 --- a/dvc/utils/plots.py +++ /dev/null @@ -1,4 +0,0 @@ -def get_plot_id(config_plot_id: str, config_file_path: str = ""): - return ( - f"{config_file_path}::{config_plot_id}" if config_file_path else config_plot_id - ) diff --git a/tests/func/plots/test_show.py b/tests/func/plots/test_show.py index e8e50133b..9eece262a 100644 --- a/tests/func/plots/test_show.py +++ b/tests/func/plots/test_show.py @@ -426,5 +426,5 @@ def test_show_plots_defined_with_native_os_path(tmp_dir, dvc, scm, capsys): assert "errors" not in json_out json_data = json_out["data"] - assert json_data[f"dvc.yaml::{top_level_plot}"] + assert json_data[f"{top_level_plot}"] assert json_data[stage_plot] diff --git a/tests/integration/plots/test_plots.py b/tests/integration/plots/test_plots.py index 3c4f79df4..fe62f16d8 100644 --- a/tests/integration/plots/test_plots.py +++ b/tests/integration/plots/test_plots.py @@ -440,8 +440,8 @@ def test_repo_with_config_plots(tmp_dir, capsys, repo_with_config_plots): html_result = extract_vega_specs( html_path, [ - "dvc.yaml::linear_train_vs_test", - "dvc.yaml::confusion_train_vs_test", + "linear_train_vs_test", + "confusion_train_vs_test", ], ) ble = _update_datapoints( @@ -456,5 +456,5 @@ def test_repo_with_config_plots(tmp_dir, capsys, repo_with_config_plots): }, ) - assert html_result["dvc.yaml::linear_train_vs_test"]["data"]["values"] == ble + assert html_result["linear_train_vs_test"]["data"]["values"] == ble # TODO check json results once vscode is able to handle flexible plots diff --git a/tests/unit/render/test_match.py b/tests/unit/render/test_match.py index 822d37283..1ef714ff8 100644 --- a/tests/unit/render/test_match.py +++ b/tests/unit/render/test_match.py @@ -29,9 +29,9 @@ def test_group_definitions(): grouped = PlotsData(data).group_definitions() assert grouped == { - "config_file_1::plot_id_1": [("v1", "plot_id_1", {})], - "config_file_1::plot_id_2": [("v1", "plot_id_2", {})], - "config_file_2::plot_id_3": [ + "plot_id_1": [("v1", "plot_id_1", {})], + "plot_id_2": [("v1", "plot_id_2", {})], + "plot_id_3": [ ("v1", "plot_id_3", {}), ("v2", "plot_id_3", {}), ], @@ -103,7 +103,7 @@ def test_match_renderers(M): }, ] assert renderer.properties == { - "title": "config_file_1::plot_id_1", + "title": "plot_id_1", "x": "x", "y": "y", "x_label": "x",