Skip to content
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

Merged
merged 11 commits into from
Jul 28, 2020

Conversation

sahilbhosale63
Copy link
Contributor

@sahilbhosale63 sahilbhosale63 commented Jun 25, 2020

Fix #3499 redesign the output format for the dvc version command.

Redesigned the output format for the command: dvc version
@efiop efiop requested a review from skshetry June 25, 2020 16:00
@skshetry
Copy link
Member

skshetry commented Jun 25, 2020

@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:
Copy link
Member

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().

dvc/command/version.py Outdated Show resolved Hide resolved
dvc/command/version.py Outdated Show resolved Hide resolved
dvc/command/version.py Outdated Show resolved Hide resolved
@sahilbhosale63 sahilbhosale63 requested a review from pmrowla June 28, 2020 11:24
dvc/command/version.py Outdated Show resolved Hide resolved
dvc/command/version.py Outdated Show resolved Hide resolved
Copy link
Contributor

@pmrowla pmrowla left a 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)

Comment on lines 131 to 136
if len(supported_remotes) == len(TREES):
return "All remotes"
elif len(supported_remotes) == 1:
return supported_remotes
else:
return ", ".join(supported_remotes)
Copy link
Member

@skshetry skshetry Jun 29, 2020

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.

@skshetry
Copy link
Member

@sahilbhosale63, @pmrowla, maybe we could do something like this:

Build Info: Python 3.7.7 on Darwin-19.5.0-x86_64-i386-64bit (pip)
Build Info: Python 3.7.7 on Darwin-19.5.0-x86_64-i386-64bit (binary)

Also, it would be good to rename Build Info to Platform which is what it is.

Or, could add it to the version: DVC version: 1.0.0 (pip)?

@pmrowla
Copy link
Contributor

pmrowla commented Jun 29, 2020

Or, could add it to the version: DVC version: 1.0.0 (pip)?

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)

@sahilbhosale63
Copy link
Contributor Author

@skshetry can you please review this patch?

Copy link
Member

@skshetry skshetry left a 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.

f"Binary: {is_binary()}",
f"Package: {PKG}",
f"Supported remotes: {self.get_supported_remotes()}",
f"DVC version: {__version__} ({PKG})",
Copy link
Member

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.

@@ -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)
Copy link
Member

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 Show resolved Hide resolved
@@ -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"
Copy link
Member

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.

Copy link
Contributor

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.

Copy link
Member

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

@sahilbhosale63
Copy link
Contributor Author

sahilbhosale63 commented Jul 21, 2020

rsz_screenshot_from_2020-07-21_20-55-51

@skshetry @pmrowla @jorgeorpinel Does this looks good or should I make some changes?

@jorgeorpinel
Copy link
Contributor

I just noticed this PR, thanks for the mention.

Supports: All remotes

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:

  • Cache types -> Supported cache types ?
  • Workspace Directory - lower case directory
  • Cache Directory - same ^. And put after Workspace dir?
  • Repo: -> Repo control: ?

Also keep in mind this may need updates to https://dvc.org/doc/command-reference/version or other docs after merge. Thanks

@shcheklein
Copy link
Member

@sahilbhosale63 why do we need (----------------) separator?

How does the output looks like when no cache dir is available?
I don't see the install method ... is it None on your screenshot? should we use some human readable name?

@sahilbhosale63

This comment has been minimized.

@sahilbhosale63
Copy link
Contributor Author

sahilbhosale63 commented Jul 22, 2020

@sahilbhosale63 why do we need (----------------) separator?

How does the output looks like when no cache dir is available?
I don't see the install method ... is it None on your screenshot? should we use some human readable name?

@shcheklein When there is no cache dir it gives a warning. We have dicussed about this previously here #3499 (comment)

The PKG is (None) because here in this case we have not installed dvc using pip or any other package manager.

Yes, we need that seperator as decided here #3499

@jorgeorpinel

This comment has been minimized.

@sahilbhosale63
Copy link
Contributor Author

sahilbhosale63 commented Jul 22, 2020

@jorgeorpinel Added #3499 issue number to the PR description with the Fix keyword.

@sahilbhosale63
Copy link
Contributor Author

sahilbhosale63 commented Jul 23, 2020

The Travis build test failures are unrelated to the changes which I have made.

dvc/command/version.py Outdated Show resolved Hide resolved
Copy link
Member

@skshetry skshetry left a 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.

@skshetry skshetry requested review from efiop, pared and pmrowla July 28, 2020 11:52
Copy link
Contributor

@pmrowla pmrowla left a 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]>
@efiop efiop merged commit f4595a0 into iterative:master Jul 28, 2020
@efiop
Copy link
Contributor

efiop commented Jul 28, 2020

Thank you @sahilbhosale63 ! 🙏

@jorgeorpinel
Copy link
Contributor

Created iterative/dvc.org/issues/1635 to update the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

version: redesign output
7 participants