deps: update dvc-data to >=2.24 (#10158)

This commit is contained in:
skshetry
2023-12-13 16:55:45 +05:45
committed by GitHub
parent 8ccae0a086
commit dec1ac7346
9 changed files with 28 additions and 24 deletions
+6 -3
View File
@@ -3,7 +3,6 @@
from typing import TYPE_CHECKING, Iterable, Optional, Set, Tuple
from dvc.config import NoRemoteError, RemoteConfigError
from dvc.fs.callbacks import Callback
from dvc.log import logger
from dvc.utils.objects import cached_property
from dvc_data.hashfile.db import get_index
@@ -206,11 +205,13 @@ class DataCloud:
jobs: Optional[int] = None,
odb: "HashFileDB",
) -> "TransferResult":
from dvc.fs.callbacks import TqdmCallback
if odb.hash_name == "md5-dos2unix":
cache = self.repo.cache.legacy
else:
cache = self.repo.cache.local
with Callback.as_tqdm_callback(
with TqdmCallback(
desc=f"Pushing to {odb.fs.unstrip_protocol(odb.path)}",
unit="file",
) as cb:
@@ -265,11 +266,13 @@ class DataCloud:
jobs: Optional[int] = None,
odb: "HashFileDB",
) -> "TransferResult":
from dvc.fs.callbacks import TqdmCallback
if odb.hash_name == "md5-dos2unix":
cache = self.repo.cache.legacy
else:
cache = self.repo.cache.local
with Callback.as_tqdm_callback(
with TqdmCallback(
desc=f"Fetching from {odb.fs.unstrip_protocol(odb.path)}",
unit="file",
) as cb:
+4 -2
View File
@@ -27,7 +27,7 @@ from dvc_objects.fs.errors import ( # noqa: F401
)
from dvc_objects.fs.path import Path # noqa: F401
from .callbacks import Callback
from .callbacks import Callback # noqa: F401
from .data import DataFileSystem # noqa: F401
from .dvc import DVCFileSystem
from .git import GitFileSystem # noqa: F401
@@ -51,7 +51,9 @@ def download(
) -> int:
from dvc.scm import lfs_prefetch
with Callback.as_tqdm_callback(
from .callbacks import TqdmCallback
with TqdmCallback(
desc=f"Downloading {fs.path.name(fs_path)}",
unit="files",
) as cb:
+5 -5
View File
@@ -786,7 +786,7 @@ class Output:
self.hash_name,
ignore=self.dvcignore,
)
with Callback.as_tqdm_callback(
with TqdmCallback(
desc=f"Committing {self} to cache",
unit="file",
) as cb:
@@ -826,7 +826,7 @@ class Output:
save_obj = obj.filter(prefix)
assert isinstance(save_obj, Tree)
checkout_obj = save_obj.get_obj(self.cache, prefix)
with Callback.as_tqdm_callback(
with TqdmCallback(
desc=f"Committing {self} to cache",
unit="file",
) as cb:
@@ -1059,7 +1059,7 @@ class Output:
upload=upload,
no_progress_bar=no_progress_bar,
)
with Callback.as_tqdm_callback(
with TqdmCallback(
desc=f"Transferring to {odb.fs.unstrip_protocol(odb.path)}",
unit="file",
) as cb:
@@ -1092,7 +1092,7 @@ class Output:
def unprotect(self):
if self.exists and self.use_cache:
with Callback.as_tqdm_callback(
with TqdmCallback(
size=self.meta.nfiles or -1, desc=f"Unprotecting {self}"
) as callback:
self.cache.unprotect(self.fs_path, callback=callback)
@@ -1438,7 +1438,7 @@ class Output:
assert staging
assert obj.hash_info
with Callback.as_tqdm_callback(
with TqdmCallback(
desc=f"Adding {self} to cache",
unit="file",
) as cb:
+2 -2
View File
@@ -449,9 +449,9 @@ class Repo:
return init(root_dir=root_dir, no_scm=no_scm, force=force, subdir=subdir)
def unprotect(self, target):
from dvc_objects.fs.callbacks import Callback
from dvc.fs.callbacks import TqdmCallback
with Callback.as_tqdm_callback(desc=f"Unprotecting {target}") as callback:
with TqdmCallback(desc=f"Unprotecting {target}") as callback:
return self.cache.repo.unprotect(target, callback=callback)
def _ignore(self):
+3 -2
View File
@@ -210,7 +210,8 @@ class Artifacts:
) -> Tuple[int, str]:
from dvc_studio_client.model_registry import get_download_uris
from dvc.fs import Callback, HTTPFileSystem, generic, localfs
from dvc.fs import HTTPFileSystem, generic, localfs
from dvc.fs.callbacks import TqdmCallback
logger.debug("Trying to download artifact '%s' via studio", name)
out = out or os.getcwd()
@@ -244,7 +245,7 @@ class Artifacts:
) from exc
fs = HTTPFileSystem()
jobs = jobs or fs.jobs
with Callback.as_tqdm_callback(
with TqdmCallback(
desc=f"Downloading '{name}' from '{repo_url}'",
unit="files",
) as cb:
+2 -2
View File
@@ -100,10 +100,10 @@ def save_imports(
Returns:
Objects which were downloaded from source location.
"""
from dvc.fs.callbacks import TqdmCallback
from dvc.stage.exceptions import DataSourceChanged
from dvc_data.index import md5, save
from dvc_data.index.checkout import apply, compare
from dvc_objects.fs.callbacks import Callback
downloaded: Set["HashInfo"] = set()
@@ -122,7 +122,7 @@ def save_imports(
if not cache.fs.exists(cache.path):
os.makedirs(cache.path)
with TemporaryDirectory(dir=cache.path) as tmpdir:
with Callback.as_tqdm_callback(
with TqdmCallback(
desc="Downloading imports from source",
unit="files",
) as cb:
+3 -5
View File
@@ -3,7 +3,6 @@ from typing import TYPE_CHECKING, Any, Dict, Iterable, Optional, Tuple, Union
from funcy import first
from dvc.fs.callbacks import Callback
from dvc.log import logger
from dvc.stage.exceptions import StageUpdateError
@@ -247,11 +246,12 @@ def _fetch_out_changes(
remote_index: Union["DataIndex", "DataIndexView"],
remote: "Remote",
):
from dvc.fs.callbacks import TqdmCallback
from dvc_data.index.checkout import apply, compare
old, new = _get_diff_indexes(out, local_index, remote_index)
with Callback.as_tqdm_callback(
with TqdmCallback(
unit="entry",
desc="Comparing indexes",
) as cb:
@@ -265,9 +265,7 @@ def _fetch_out_changes(
)
total = len(new)
with Callback.as_tqdm_callback(
unit="file", desc=f"Updating '{out}'", disable=total == 0
) as cb:
with TqdmCallback(unit="file", desc=f"Updating '{out}'", disable=total == 0) as cb:
cb.set_size(total)
apply(
diff,
+2 -2
View File
@@ -231,7 +231,7 @@ class StageCache:
def transfer(self, from_odb, to_odb):
from dvc.fs import HTTPFileSystem, LocalFileSystem
from dvc.fs.callbacks import Callback
from dvc.fs.callbacks import TqdmCallback
from_fs = from_odb.fs
to_fs = to_odb.fs
@@ -266,7 +266,7 @@ class StageCache:
src_name = from_fs.path.name(src)
parent_name = from_fs.path.name(from_fs.path.parent(src))
with Callback.as_tqdm_callback(
with TqdmCallback(
desc=src_name,
bytes=True,
) as cb:
+1 -1
View File
@@ -35,7 +35,7 @@ dependencies = [
"configobj>=5.0.6",
"distro>=1.3",
"dpath<3,>=2.1.0",
"dvc-data>=2.23.1,<2.24",
"dvc-data>=2.24,<2.25",
"dvc-http>=2.29.0",
"dvc-render>=1.0.0,<2",
"dvc-studio-client>=0.17.1,<1",