version: redesign output format for the dvc version command #3499#4114
Conversation
Redesigned the output format for the command: dvc version
…put-dvc Version: Redesign output format treeverse#3499
|
@sahilbhosale63, thanks for the PR. CI is failing. Did you run pre-commit hooks as mentioned here: https://dvc.org/doc/user-guide/contributing/core? Also, it'd be good to see the outputs for different DVC installations/repos. Thanks. |
| return ", ".join(supported_remotes) | ||
| if supported_remotes.__len__() == 9: | ||
| return "All remotes" | ||
| elif supported_remotes.__len__() == 1: |
There was a problem hiding this comment.
In Python, it's not good to use dunder methods directly(__len__). You can just use len().
Done some suggested fixes in code for the dvc command output format issue.
pmrowla
left a comment
There was a problem hiding this comment.
Changes look alright to me for the most part, but there's a couple general issues regarding the new format that I'm not sure about.
When running from a source installation instead of using any of the package/binary install methods (pip install -e ) we output
Build Info: Python 3.7.7 on Darwin-19.5.0-x86_64-i386-64bit installed via None
It might be better for us to just drop the installed via ... part entirely in this case? When I first read None here, it made me think this was a bug in how we detect installation method, rather than thinking it meant "None as in not installed from a binary package".
This was a bit clearer in the old output when we had
Binary: False
Package: None
Also in the new output we do:
Directory cache: apfs on /dev/disk1s1
...
Workspace with apfs on /dev/disk1s1
and it looks a bit strange to have inconsistent formatting between both of these lines (in one line we use a colon and in the other line we use with)
| if len(supported_remotes) == len(TREES): | ||
| return "All remotes" | ||
| elif len(supported_remotes) == 1: | ||
| return supported_remotes | ||
| else: | ||
| return ", ".join(supported_remotes) |
There was a problem hiding this comment.
@sahilbhosale63, the plan was to make Supports use both remotes and cache types. But, as we didnot go through that, I think it's okay to not go "All remotes" route (i.e what was before with comma separated list of remotes). But, it's your call.
|
@sahilbhosale63, @pmrowla, maybe we could do something like this: Also, it would be good to rename Or, could add it to the version: |
This might work best just because the platform line is already going to be pretty long in a lot of cases (even without the installation method) |
|
@skshetry can you please review this patch? |
skshetry
left a comment
There was a problem hiding this comment.
I am really sorry for taking it so long to review, looks good in general, just a few minor issues.
| f"Binary: {is_binary()}", | ||
| f"Package: {PKG}", | ||
| f"Supported remotes: {self.get_supported_remotes()}", | ||
| f"DVC version: {__version__} ({PKG})", |
There was a problem hiding this comment.
I get:
DVC version: 1.0.1+412f39 (None)PKG can be None too. So, let's leave that out if it's None.
| if os.path.exists(repo.cache.local.cache_dir): | ||
| info.append( | ||
| "Cache: {}".format(self.get_linktype_support_info(repo)) | ||
| "Cache types: " + self.get_linktype_support_info(repo) |
There was a problem hiding this comment.
Let's use {} formated string as above with just the addtion of Cache types:.
| return "dvc (subdir), git" | ||
|
|
||
| return "dvc, git" | ||
| return "dvc + git" |
There was a problem hiding this comment.
We need to make this uniform, either we should make it all commas or all plus-es. Could just use comma for now.
There was a problem hiding this comment.
Same for cache types which seems to use / right now.
There was a problem hiding this comment.
+1 for commas (since / is a path separator)
+1 to check other occurrences
|
@skshetry @pmrowla @jorgeorpinel Does this looks good or should I make some changes? |
|
I just noticed this PR, thanks for the mention.
How about Supported remotes: {List them always} — actually I think that's how it is now so maybe this doesn't need a change... Also:
Also keep in mind this may need updates to https://dvc.org/doc/command-reference/version or other docs after merge. Thanks |
|
@sahilbhosale63 why do we need ( How does the output looks like when no cache dir is available? |
This comment has been minimized.
This comment has been minimized.
@shcheklein When there is no cache dir it gives a warning. We have dicussed about this previously here #3499 (comment) The PKG is Yes, we need that seperator as decided here #3499 |
This comment has been minimized.
This comment has been minimized.
|
@jorgeorpinel Added #3499 issue number to the PR description with the Fix keyword. |
|
The Travis build test failures are unrelated to the changes which I have made. |
skshetry
left a comment
There was a problem hiding this comment.
LGTM, just not sure about All remotes, but fine for now.
Co-authored-by: Saugat Pachhai <suagatchhetri@outlook.com>
|
Thank you @sahilbhosale63 ! 🙏 |
|
Created treeverse/dvc.org/issues/1635 to update the docs. |

Fix #3499 redesign the output format for the
dvc versioncommand.