rstudio / pins-r

Pin, discover, and share resources
https://pins.rstudio.com
Other
310 stars 64 forks source link

Update the "CODE" block in the RStudio Connect HTML preview #615

Closed sellorm closed 1 year ago

sellorm commented 2 years ago

The code block currently suggest this piece of code:

library(pins)
board <- board_rsconnect("envvar", server = "https://connect.example.com")
pin_read(board, "username/pin_name")

This is nice, but envvar auth frequently doesn't work out of the box unless the user is already pins user and has previously configured it.

Including a note about how to set that up and well as a similar code snippet for python would be ideal.

So we'd end up with something like (though with the appropriate URLs and pin names substituted in):


Code

The following examples assume you have your Connect API key stored in a CONNECT_API_KEY environment variable. Please refer to the documentation for more information and information on other supported authentication modes.

R

library(pins)
board <- board_rsconnect("envvar", server = "https://connect.example.com")
pin_read(board, "username/pin_name")

Pins for R documentation

Python

import pins
board = pins.board_rsconnect(server_url = "https://connect.example.com")
board.pin_read("username/pin_name")

Pins for python documentation


This could perhaps be collapsible, though it should be clear even when collapsed that this section contains R and Python code.

More than anything this is about on-boarding new users to the pins ecosystem more quickly if someone within their organisation has shared a pin with them.

There is an equivalent ticket in pins-python repo.

sellorm commented 2 years ago

At a minimum, it would be great if the code provided today were labelled as being R code, just to avoid any potential confusion with pins published to Connect from Python using a different code snippet.

juliasilge commented 2 years ago

Related to #603

juliasilge commented 1 year ago

Looks like the Connect docs have updated the recommended approach (no more server arg included) so we should likely update what we have as well.

github-actions[bot] commented 1 year ago

This issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue.