-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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 iterative#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. |
dvc/command/version.py
Outdated
return ", ".join(supported_remotes) | ||
if supported_remotes.__len__() == 9: | ||
return "All remotes" | ||
elif supported_remotes.__len__() == 1: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
)
dvc/command/version.py
Outdated
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am really sorry for taking it so long to review, looks good in general, just a few minor issues.
dvc/command/version.py
Outdated
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I get:
DVC version: 1.0.1+412f39 (None)
PKG
can be None too. So, let's leave that out if it's None.
dvc/command/version.py
Outdated
@@ -46,13 +45,11 @@ def run(self): | |||
# `dvc config cache.shared group`. | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use {}
formated string as above with just the addtion of Cache types:
.
dvc/command/version.py
Outdated
@@ -139,7 +144,7 @@ def _get_dvc_repo_info(repo): | |||
if repo.root_dir != repo.scm.root_dir: | |||
return "dvc (subdir), git" | |||
|
|||
return "dvc, git" | |||
return "dvc + git" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same for cache types which seems to use /
right now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just not sure about All remotes
, but fine for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Co-authored-by: Saugat Pachhai <[email protected]>
Thank you @sahilbhosale63 ! 🙏 |
Created iterative/dvc.org/issues/1635 to update the docs. |
Fix #3499 redesign the output format for the
dvc version
command.