diff --git a/NEWS.md b/NEWS.md index 032845c3..c1f2e10c 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,7 @@ # pins (development version) +* Added example Python code to pin previews for Posit Connect (#806). + # pins 1.3.0 ## Breaking changes diff --git a/R/board_connect_bundle.R b/R/board_connect_bundle.R index 9d72b059..455c9e5e 100644 --- a/R/board_connect_bundle.R +++ b/R/board_connect_bundle.R @@ -62,6 +62,7 @@ rsc_bundle_preview_index <- function(board, name, x, metadata) { data_preview_style = if (is.data.frame(x)) "" else "display:none", urls = paste0("", metadata$urls, "", collapse = ", "), url_preview_style = if (!is.null(metadata$urls)) "" else "display:none", + show_python_style = if (metadata$type %in% c("rds", "qs")) "display:none" else "", pin_name = paste0(owner, "/", name$name), pin_metadata = list( as_yaml = yaml::as.yaml(metadata), diff --git a/inst/preview/index.html b/inst/preview/index.html index 1486461b..a1754c2a 100644 --- a/inst/preview/index.html +++ b/inst/preview/index.html @@ -33,7 +33,7 @@
- {{#date}}Last updated: {{{.}}} •{{/date}} + {{#date}}Last updated from R: {{{.}}} •{{/date}} Format: {{{format}}} • API: v{{{api_version}}}
@@ -52,14 +52,25 @@library(pins)
+ R Code
+ library(pins)
board <- {{{board_deparse}}}
pin_read(board, "{{pin_name}}")
-
+
+
import pins
+from dotenv import load_dotenv
+load_dotenv()
+
+board = pins.board_connect()
+board.pin_read(board, "{{pin_name}}")
- Last updated: 2021-11-11 11:39:56 • + Last updated from R: 2021-11-11 11:39:56 • Format: rds • API: v1.0
@@ -65,14 +65,25 @@library(pins)
+ R Code
+ library(pins)
board <- board_connect(auth = "envvar")
pin_read(board, "TEST/test")
-
+
+