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

pin_write should return the version as well as the name #592

Open
sellorm opened this issue Jan 25, 2022 · 4 comments
Open

pin_write should return the version as well as the name #592

sellorm opened this issue Jan 25, 2022 · 4 comments
Labels
feature a feature request or enhancement

Comments

@sellorm
Copy link
Contributor

sellorm commented Jan 25, 2022

In the the current version of pins (1.0.1) pin_write() returns the fully qualified name of the new pin, invisibly.

library(pins)
board = board_folder("~/tmp/pins")
pinout <- pin_write(board, 
                    ggplot2::diamonds, 
                    name = "diamonds", 
                    type = "csv")
#> Replacing version '20220125T122254Z-c9e9b' with '20220125T122531Z-c9e9b'
#> Writing to pin 'diamonds'
str(pinout)
#>  chr "diamonds"

There are a number of additional workflows that would be enabled by also returning the version. In the example above, 20220125T122531Z-c9e9b.

This is useful, since both the "fully qualified name" and the version are required to obtain a specific version of a data set rather than just the latest version.

For example, users may want to record the versions of specific pins in another system and currently, this is not a straightforward task.

Perhaps pin_write(), could return a list that includes the fully qualified domain name as well as the version.

@afshinmhCLG
Copy link

Returning version would be a very useful feature!
I rely on knowing the version prior to pinning so much that I have a wrapper/hack where I always pin into a local empty/temp location just to get the version and then pin to remote knowing what the version will be.

@juliasilge
Copy link
Member

We could look into whether it's possible to return the whole metadata object invisibly for pin_write().

@juliasilge
Copy link
Member

juliasilge commented Oct 18, 2022

It turns out the meta object in this function doesn't contain the name or version (in fact, no metadata objects contain the name) so that's not really going to help us much here. 🙈 Instead, let's try returning a named list with name and version.

After working on this today, I believe that each pin_store method will need to be updated; it can't be done in pin_write() because that messes up the cache by making another API call.

@juliasilge
Copy link
Member

In #735 we are looking at an argument to check the hash of the pin contents before pinning, so another possible component to consider returning is whether pinning was successful.

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

No branches or pull requests

3 participants