@@ -25,7 +25,14 @@ def _wrap_exceptions(repo, url):
2525 raise PathMissingError (exc .path , url ) from exc
2626
2727
28- def get_url (path , repo = None , rev = None , ** kwargs ):
28+ def get_url (
29+ path : str ,
30+ repo : Optional [str ] = None ,
31+ rev : Optional [str ] = None ,
32+ remote : Optional [str ] = None ,
33+ config : Optional [dict [str , Any ]] = None ,
34+ remote_config : Optional [dict [str , Any ]] = None ,
35+ ):
2936 """
3037 Returns the URL to the storage location of a data file or directory tracked
3138 in a DVC repo. For Git repos, HEAD is used unless a rev argument is
@@ -35,11 +42,45 @@ def get_url(path, repo=None, rev=None, **kwargs):
3542
3643 NOTE: This function does not check for the actual existence of the file or
3744 directory in the remote storage.
45+
46+ Args:
47+ path (str): location and file name of the target, relative to the root
48+ of `repo`.
49+ repo (str, optional): location of the DVC project or Git Repo.
50+ Defaults to the current DVC project (found by walking up from the
51+ current working directory tree).
52+ It can be a URL or a file system path.
53+ Both HTTP and SSH protocols are supported for online Git repos
54+ (e.g. [user@]server:project.git).
55+ rev (str, optional): Any `Git revision`_ such as a branch or tag name,
56+ a commit hash or a dvc experiment name.
57+ Defaults to HEAD.
58+ If `repo` is not a Git repo, this option is ignored.
59+ remote (str, optional): Name of the `DVC remote`_ used to form the
60+ returned URL string.
61+ Defaults to the `default remote`_ of `repo`.
62+ For local projects, the cache is tried before the default remote.
63+ config(dict, optional): config to be passed to the DVC repository.
64+ Defaults to None.
65+ remote_config(dict, optional): remote config to be passed to the DVC
66+ repository.
67+ Defaults to None.
68+
69+ Returns:
70+ str: URL to the file or directory.
3871 """
3972 from dvc .config import NoRemoteError
4073 from dvc_data .index import StorageKeyError
4174
42- with Repo .open (repo , rev = rev , subrepos = True , uninitialized = True , ** kwargs ) as _repo :
75+ with Repo .open (
76+ repo ,
77+ rev = rev ,
78+ subrepos = True ,
79+ uninitialized = True ,
80+ remote = remote ,
81+ config = config ,
82+ remote_config = remote_config ,
83+ ) as _repo :
4384 index , entry = _repo .get_data_index_entry (path )
4485 with reraise (
4586 (StorageKeyError , ValueError ),
0 commit comments