-
Notifications
You must be signed in to change notification settings - Fork 394
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
suggest some minor things to API #1032
Conversation
resource_url = dvc.api.get_url( | ||
dvc.api.get_url( | ||
'get-started/data.xml', | ||
repo='https://github.com/iterative/dataset-registry') | ||
|
||
# https://remote.dvc.org/dataset-registry/a3/04afb96060aad90176268345e10355 |
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.
Agee about removing the var name but its not very obvious what the comment below is (and probably creates a horizontal scroll). Not sure it's needed for basic usage.
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 think it's intuitively clear ... we can even bring var name back in the comment ... we need to show something than nothing
we can just add
`# returns 'http://....'
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 don't think the basic usage block needs to show the variable value. That's what examples are for I think.
But if you want to keep this I would not reintroduce var name, maybe just make the comment shorter? # https://remote.dvc.org/dataset-registry/a3/04a...
(maybe in the example BTW, so that no scrolls are shown) but not a huge deal about the scrolls for these cases.
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 think it makes this example significantly better if we show the value, I would even say that this the most important part - you see right away what it does
I would keep at as simple as possible, would add returns
at most
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.
OK. Actually I would reintroduce the var name now that I think about it. You wouldn't call a string returning function without assigning it to something. So my full suggestion is:
resource_url = dvc.api.get_url(
'get-started/data.xml',
repo='https://github.com/iterative/dataset-registry')
# resource_url = https://remote.dvc.org/dataset-registry/a3/04a...
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.
Or wrap in print()
and say # prints http...
in the comment.
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.
don't use =
though, write it in a plain language - resource_url is now 'http:///'
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.
otherwise it looks like a commented code
If the target is a directory, the returned URL will point to a file that | ||
contains the mapping of files in the directory (as a JSON array), along with | ||
their hash values. Refer to | ||
[Structure of cache directory](/doc/user-guide/dvc-files-and-directories#structure-of-cache-directory) | ||
and `dvc add` to learn more about how DVC handles data directories. | ||
|
||
⚠️ This function does not check for the actual existence of the file or | ||
directory in the remote storage. |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
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.
OK to move it but the original text is a little better I think, because it doesn't imply that the .dir file will exist (and contain "the mapping of files...").
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.
not sure I got the point ...
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 just wanted to avoid to many details (like .dir, etc - it's internal stuff)
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 think mentioning the .dir ending is appropriate as it may be something the user notices and wonders about when using this fn.
If the target is a directory, the returned URL will point to a file that | |
contains the mapping of files in the directory (as a JSON array), along with | |
their hash values. Refer to | |
[Structure of cache directory](/doc/user-guide/dvc-files-and-directories#structure-of-cache-directory) | |
and `dvc add` to learn more about how DVC handles data directories. | |
⚠️ This function does not check for the actual existence of the file or | |
directory in the remote storage. | |
If the target is a directory, the returned URL will end in `.dir`: a file that | |
contains the mapping of files in the directory. Refer to | |
[Structure of cache directory](/doc/user-guide/dvc-files-and-directories#structure-of-cache-directory) | |
and `dvc add` to learn more about how DVC handles data directories. | |
⚠️ This function does not check for the actual existence of the file or | |
directory in the remote storage. |
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.
they should not care about such specifics, we might change schema for those URL ... we can mention something like (ends with
.dir)
- but that should be enough
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 can mention something like (ends with .dir) - but that should be enough
Good idea. Keeping the last sentence too (link to dvc dir struct), I assume.
--- | ||
It prints | ||
`https://remote.dvc.org/dataset-registry/a3/04afb96060aad90176268345e10355` if | ||
we run it: | ||
|
||
```dvc | ||
$ python script.py |
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.
This is repetitive. Maybe just something like "Prints the URL string value if we run it from terminal:" ?
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.
Again, it's easier to read. Repetition not a big problem. Code snippet just illustrates the code (and gives a command to run). I would keep it extra explicit. Up yo you again. Don't have a strong opinion
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.
Repetition not a big problem.
Yeah but why do it if it's not needed? Just keeping the top paragraph and end it in "if we run it.", and removing the console block code should be enough I think.
p.s. The original one I did with the---
hr was also kind of obvious, like in the basic usage comment 🙂 and I like how it looked rendered.
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
Co-Authored-By: Jorge Orpinel <[email protected]>
I'm going to merge this and address the remaining stuff in the |
Done! In 8089423. |
❗ Please read the guidelines in the Contributing to the Documentation list if you make any substantial changes to the documentation or JS engine.
🐛 Please make sure to mention
Fix #issue
(if applicable) in the description of the PR. This causes GitHub to close it automatically when the PR is merged.Please chose to allow us to edit your branch when creating the PR.
Thank you for the contribution - we'll try to review it as soon as possible. 🙏