mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
info: Include subprojects.
This commit is contained in:
+19
@@ -14,6 +14,14 @@ from dvc.scm import SCMError
|
||||
from dvc.utils import error_link
|
||||
from dvc.utils.pkg import PKG
|
||||
|
||||
SUBPROJECTS = (
|
||||
"dvc_data",
|
||||
"dvc_objects",
|
||||
"dvc_render",
|
||||
"dvc_task",
|
||||
"dvclive",
|
||||
"scmrepo",
|
||||
)
|
||||
package = "" if PKG is None else f"({PKG})"
|
||||
|
||||
|
||||
@@ -23,6 +31,7 @@ def get_dvc_info():
|
||||
"---------------------------------",
|
||||
f"Platform: Python {platform.python_version()} on "
|
||||
f"{platform.platform()}",
|
||||
f"Subprojects:{_get_subprojects()}",
|
||||
f"Supports:{_get_supported_remotes()}",
|
||||
]
|
||||
|
||||
@@ -88,6 +97,16 @@ def _get_linktype_support_info(repo):
|
||||
return ", ".join(links)
|
||||
|
||||
|
||||
def _get_subprojects():
|
||||
subprojects = []
|
||||
for subproject in SUBPROJECTS:
|
||||
subprojects.append(
|
||||
f"{subproject} = " f"{importlib_metadata.version(subproject)}"
|
||||
)
|
||||
|
||||
return "\n\t" + "\n\t".join(subprojects)
|
||||
|
||||
|
||||
def _get_supported_remotes():
|
||||
supported_remotes = []
|
||||
for scheme in registry:
|
||||
|
||||
@@ -4,6 +4,7 @@ from dvc.cli import main
|
||||
from tests.unit.test_info import (
|
||||
DVC_VERSION_REGEX,
|
||||
PYTHON_VERSION_REGEX,
|
||||
SUBPROJECTS,
|
||||
find_supported_remotes,
|
||||
)
|
||||
|
||||
@@ -14,6 +15,9 @@ def test_(tmp_dir, dvc, scm, capsys):
|
||||
out, _ = capsys.readouterr()
|
||||
assert re.search(rf"DVC version: {DVC_VERSION_REGEX}", out)
|
||||
assert re.search(f"Platform: {PYTHON_VERSION_REGEX} on .*", out)
|
||||
for subproject in SUBPROJECTS:
|
||||
assert re.search(rf"{subproject} = {DVC_VERSION_REGEX}", out)
|
||||
|
||||
assert find_supported_remotes(out)
|
||||
assert re.search(r"Cache types: .*", out)
|
||||
assert re.search(r"Caches: local", out)
|
||||
|
||||
@@ -4,7 +4,7 @@ import shutil
|
||||
|
||||
import pytest
|
||||
|
||||
from dvc.info import get_dvc_info
|
||||
from dvc.info import SUBPROJECTS, get_dvc_info
|
||||
|
||||
# Python's version is in the shape of:
|
||||
# <major>.<minor>.<patch>[{a|b|rc}N][.postN][.devN]
|
||||
@@ -53,6 +53,9 @@ def test_info_in_repo(scm_init, tmp_dir):
|
||||
|
||||
assert re.search(rf"DVC version: {DVC_VERSION_REGEX}", dvc_info)
|
||||
assert re.search(f"Platform: {PYTHON_VERSION_REGEX} on .*", dvc_info)
|
||||
for subproject in SUBPROJECTS:
|
||||
assert re.search(rf"{subproject} = {DVC_VERSION_REGEX}", dvc_info)
|
||||
|
||||
assert find_supported_remotes(dvc_info)
|
||||
assert re.search(r"Cache types: .*", dvc_info)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user