diff --git a/dvc/commands/ls/__init__.py b/dvc/commands/ls/__init__.py index bee863ff7..f871e0cc6 100644 --- a/dvc/commands/ls/__init__.py +++ b/dvc/commands/ls/__init__.py @@ -1,8 +1,6 @@ import argparse import logging -from tqdm import tqdm - from dvc.cli import completion from dvc.cli.command import CmdBaseNoRepo from dvc.cli.utils import DictAction, append_doc_link @@ -14,11 +12,13 @@ logger = logging.getLogger(__name__) def _format_entry(entry, fmt): + from humanize import naturalsize + size = entry.get("size") if size is None: size = "" else: - size = tqdm.format_sizeof(size, divisor=1024) + size = naturalsize(size, gnu=True) return size, fmt(entry) diff --git a/pyproject.toml b/pyproject.toml index 52257ec60..8022e39f6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -65,6 +65,7 @@ dependencies = [ "tqdm<5,>=4.63.1", "voluptuous>=0.11.7", "zc.lockfile>=1.2.1", + "humanize", ] [project.optional-dependencies]