From 2aa2bef9d6c3fcdf79f72bde97f56e012f25ae78 Mon Sep 17 00:00:00 2001 From: David de la Iglesia Castro Date: Tue, 26 Sep 2023 13:32:27 +0200 Subject: [PATCH] artifacts: Bring back `name_is_compatible`. (#9972) * artifacts: Bring back `name_is_compatible`. Unfortunately, DVCLive was importing this function so I am bringing back the name for backwards compatibility. * Update artifacts.py --- dvc/repo/artifacts.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/dvc/repo/artifacts.py b/dvc/repo/artifacts.py index f42ce4f05..ad33900ac 100644 --- a/dvc/repo/artifacts.py +++ b/dvc/repo/artifacts.py @@ -38,6 +38,21 @@ def check_name_format(name: str) -> None: ) from exc +def name_is_compatible(name: str) -> bool: + """ + Only needed by DVCLive per iterative/dvclive#715 + Will be removed in future release. + """ + from gto.constants import assert_name_is_valid + from gto.exceptions import ValidationError + + try: + assert_name_is_valid(name) + return True + except ValidationError: + return False + + def check_for_nested_dvc_repo(dvcfile: Path): from dvc.repo import Repo