diff --git a/dvc/command/version.py b/dvc/command/version.py index 60c6109d3..3a4fe042d 100644 --- a/dvc/command/version.py +++ b/dvc/command/version.py @@ -31,6 +31,7 @@ class CmdVersion(CmdBaseNoRepo): "Platform: {}".format(platform.platform()), "Binary: {}".format(is_binary()), "Package: {}".format(PKG), + "Supported remotes: {}".format(self.get_supported_remotes()), ] try: @@ -112,6 +113,17 @@ class CmdVersion(CmdBaseNoRepo): return ", ".join(cache) + @staticmethod + def get_supported_remotes(): + from dvc.remote import REMOTES + + supported_remotes = [] + for remote in REMOTES: + if not remote.get_missing_deps(): + supported_remotes.append(remote.scheme) + + return ", ".join(supported_remotes) + def add_parser(subparsers, parent_parser): VERSION_HELP = "Show DVC version and system/environment information." diff --git a/dvc/remote/base.py b/dvc/remote/base.py index 8ff3046cb..67941b37a 100644 --- a/dvc/remote/base.py +++ b/dvc/remote/base.py @@ -108,17 +108,21 @@ class RemoteBASE(object): self.cache_types = config.get("type") or copy(self.DEFAULT_CACHE_TYPES) self.cache_type_confirmed = False - def _check_requires(self, config): + @classmethod + def get_missing_deps(cls): import importlib missing = [] - - for package, module in self.REQUIRES.items(): + for package, module in cls.REQUIRES.items(): try: importlib.import_module(module) except ImportError: missing.append(package) + return missing + + def _check_requires(self, config): + missing = self.get_missing_deps() if not missing: return diff --git a/tests/func/test_version.py b/tests/func/test_version.py index 31d0d7e66..44e44d552 100644 --- a/tests/func/test_version.py +++ b/tests/func/test_version.py @@ -17,6 +17,7 @@ def test_info_in_repo(tmp_dir, dvc, caplog): assert re.search(r"Platform: .*", caplog.text) assert re.search(r"Binary: (True|False)", caplog.text) assert re.search(r"Package: .*", caplog.text) + assert re.search(r"Supported remotes: .*", caplog.text) assert re.search( r"(Cache: (.*link - (not )?supported(,\s)?){3})", caplog.text ) @@ -39,6 +40,7 @@ def test_info_outside_of_repo(tmp_dir, caplog): assert re.search(r"Platform: .*", caplog.text) assert re.search(r"Binary: (True|False)", caplog.text) assert re.search(r"Package: .*", caplog.text) + assert re.search(r"Supported remotes: .*", caplog.text) assert not re.search(r"(Cache: (.*link - (not )?(,\s)?){3})", caplog.text)