@@ -82,7 +82,7 @@ def __init__(
82
82
resume : bool = False ,
83
83
report : Literal ["md" , "notebook" , "html" , None ] = None ,
84
84
save_dvc_exp : bool = True ,
85
- dvcyaml : Optional [str ] = "dvc.yaml" ,
85
+ dvcyaml : Optional [str , Path ] = "dvc.yaml" ,
86
86
cache_images : bool = False ,
87
87
exp_name : Optional [str ] = None ,
88
88
exp_message : Optional [str ] = None ,
@@ -104,11 +104,11 @@ def __init__(
104
104
part of `Live.end()`. Defaults to `True`. If you are using DVCLive
105
105
inside a DVC Pipeline and running with `dvc exp run`, the option will be
106
106
ignored.
107
- dvcyaml (str | None): where to write dvc.yaml file, which adds DVC
107
+ dvcyaml (str | Path | None): where to write dvc.yaml file, which adds DVC
108
108
configuration for metrics, plots, and parameters as part of
109
109
`Live.next_step()` and `Live.end()`. If `None`, no dvc.yaml file is
110
110
written. Defaults to `"dvc.yaml"`. See `Live.make_dvcyaml()`.
111
- If a string like `"subdir/dvc.yaml"`, DVCLive will write the
111
+ If a string or Path like `"subdir/dvc.yaml"`, DVCLive will write the
112
112
configuration to that path (file must be named "dvc.yaml").
113
113
If `False`, DVCLive will not write to "dvc.yaml" (useful if you are
114
114
tracking DVCLive metrics, plots, and parameters independently and
@@ -265,10 +265,14 @@ def _init_dvc(self): # noqa: C901
265
265
self ._include_untracked .append (self .dir )
266
266
267
267
def _init_dvc_file (self ) -> str :
268
+ if isinstance (self ._dvcyaml , Path ):
269
+ self ._dvcyaml = str (self ._dvcyaml )
268
270
if isinstance (self ._dvcyaml , str ):
269
271
if os .path .basename (self ._dvcyaml ) == "dvc.yaml" :
270
272
return self ._dvcyaml
271
273
raise InvalidDvcyamlError
274
+ if self ._dvcyaml :
275
+ raise InvalidDvcyamlError
272
276
return "dvc.yaml"
273
277
274
278
def _init_dvc_pipeline (self ):
@@ -334,6 +338,8 @@ def _init_test(self):
334
338
"""
335
339
with tempfile .TemporaryDirectory () as dirpath :
336
340
self ._dir = os .path .join (dirpath , self ._dir )
341
+ if isinstance (self ._dvcyaml , Path ):
342
+ self ._dvcyaml = str (self ._dvcyaml )
337
343
if isinstance (self ._dvcyaml , str ):
338
344
self ._dvc_file = os .path .join (dirpath , self ._dvcyaml )
339
345
self ._save_dvc_exp = False
0 commit comments