Skip to content

Commit a6de973

Browse files
authored
Switch to using native pipe |> operator (#879)
* Switch to using native pipe `|>` operator * Fix test for native pipe * Do I still need this? * Escalate deprecation for old functions * Update snapshot for deprecated functionality * Remove test for deprecated function * Update tests for deprecation * Update more snapshots for deprecation * Update a few more tests for legacy pins * Update examples for deprecated functions * OK, let's get serious now about updating the examples * Update NEWS
1 parent 6966087 commit a6de973

File tree

110 files changed

+385
-846
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

110 files changed

+385
-846
lines changed

.github/cross-compat/read-pins.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ library(pins)
22
args <- commandArgs(trailingOnly = TRUE)
33

44
board <- board_folder(args[1])
5-
res <- board %>% pin_read("mtcars-py")
5+
res <- board |> pin_read("mtcars-py")
66
testthat::expect_equal(res, datasets::mtcars, ignore_attr = TRUE)

.github/cross-compat/write-pins.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ library(pins)
22
args <- commandArgs(trailingOnly = TRUE)
33

44
board <- board_folder(args[1])
5-
board %>% pin_write(mtcars, "mtcars-r", type = "csv", tags = c("cars", "fuel"))
5+
board |> pin_write(mtcars, "mtcars-r", type = "csv", tags = c("cars", "fuel"))

.github/workflows/R-CMD-check.yaml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,6 @@ jobs:
5252
with:
5353
extra-packages: any::rcmdcheck
5454
needs: check
55-
56-
- name: "Set LOGNAME environment variable to get _R_CHECK_THINGS_IN_OTHER_DIRS_ to work"
57-
run: |
58-
cat("LOGNAME=", Sys.info()[["user"]], "\n", sep = "", file = Sys.getenv("GITHUB_ENV"), append = TRUE)
59-
shell: Rscript {0}
60-
6155
- uses: r-lib/actions/check-r-package@v2
6256
with:
6357
error-on: '"note"'

DESCRIPTION

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ License: Apache License (>= 2)
1919
URL: https://pins.rstudio.com/, https://github.com/rstudio/pins-r
2020
BugReports: https://github.com/rstudio/pins-r/issues
2121
Depends:
22-
R (>= 3.6)
22+
R (>= 4.1.0)
2323
Imports:
2424
cli,
2525
digest,
@@ -29,7 +29,6 @@ Imports:
2929
httr,
3030
jsonlite,
3131
lifecycle,
32-
magrittr,
3332
purrr (>= 1.0.0),
3433
rappdirs,
3534
rlang (>= 1.1.0),

NAMESPACE

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,6 @@ S3method(write_board_manifest_yaml,pins_board_folder)
174174
S3method(write_board_manifest_yaml,pins_board_ms365)
175175
S3method(write_board_manifest_yaml,pins_board_s3)
176176
S3method(write_board_manifest_yaml,pins_board_url)
177-
export("%>%")
178177
export(board_azure)
179178
export(board_browse)
180179
export(board_cache_path)
@@ -266,7 +265,6 @@ importFrom(cli,cli_text)
266265
importFrom(generics,required_pkgs)
267266
importFrom(glue,glue)
268267
importFrom(lifecycle,deprecated)
269-
importFrom(magrittr,"%>%")
270268
importFrom(purrr,compact)
271269
importFrom(purrr,imap)
272270
importFrom(purrr,map)
@@ -275,4 +273,5 @@ importFrom(purrr,map_chr)
275273
importFrom(purrr,map_dbl)
276274
importFrom(purrr,map_int)
277275
importFrom(purrr,map_lgl)
276+
importFrom(purrr,pluck)
278277
importFrom(purrr,possibly)

NEWS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66

77
* Added support for writing pins with multiple types, like `type = c("rds", "csv")` (#877, @lbm364dl).
88

9+
* Switched to using the native pipe in examples and documentation (#879).
10+
11+
* Further escalated gradual deprecation process for legacy pins functions such as `pin()` (#879).
12+
913
# pins 1.4.1
1014

1115
* Support new `preview_data` parameter for pin previews on Posit Connect (#850).

R/board.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ board_deparse.pins_board <- function(board, ...) {
197197
#' write_board_manifest(board)
198198
#'
199199
#' # see the manifest's format:
200-
#' fs::path(board$path, "_pins.yaml") %>% readLines() %>% cat(sep = "\n")
200+
#' fs::path(board$path, "_pins.yaml") |> readLines() |> cat(sep = "\n")
201201
#'
202202
#' # if you write another pin, the manifest file is out of date:
203203
#' pin_write(board, 1:10, "nice-numbers", type = "json")
@@ -223,8 +223,8 @@ make_manifest <- function(board) {
223223

224224
result <- map(
225225
pin_names,
226-
~fs::path(.x, pin_versions(board, name = .x)$version) %>%
227-
end_with_slash() %>% # versions usually don't include slash
226+
~fs::path(.x, pin_versions(board, name = .x)$version) |>
227+
end_with_slash() |> # versions usually don't include slash
228228
as.list()
229229
)
230230
names(result) <- pin_names

R/board_azure.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
#' url <- "https://pins.blob.core.windows.net/public-data"
3434
#' container <- AzureStor::blob_container(url)
3535
#' board <- board_azure(container)
36-
#' board %>% pin_read("mtcars")
36+
#' board |> pin_read("mtcars")
3737
#' }
3838
#'
3939
#' \dontrun{
@@ -43,7 +43,7 @@
4343
#' url <- "https://myaccount.blob.core.windows.net/mycontainer"
4444
#' container <- AzureStor::blob_container(url, sas = "my-sas")
4545
#' board <- board_azure(container, "path/to/board")
46-
#' board %>% pin_write(iris)
46+
#' board |> pin_write(iris)
4747
#'
4848
#' # ADLSgen2 is a modern, efficient way to access blobs
4949
#' # - Use 'dfs' instead of 'blob' in the account URL to use the ADLSgen2 API
@@ -53,8 +53,8 @@
5353
#' adls_url <- "https://myaccount.dfs.core.windows.net/mycontainer"
5454
#' container <- AzureStor::storage_container(adls_url, sas = "my-sas")
5555
#' board <- board_azure(container, "path/to/board")
56-
#' board %>% pin_list()
57-
#' board %>% pin_read("iris")
56+
#' board |> pin_list()
57+
#' board |> pin_read("iris")
5858
#' }
5959
board_azure <- function(container, path = "", n_processes = 10, versioned = TRUE, cache = NULL) {
6060
check_installed("AzureStor")

R/board_connect.R

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#' setting the access type to `all`:
1717
#'
1818
#' ```r
19-
#' board %>% pin_write(my_df, access_type = "all")
19+
#' board |> pin_write(my_df, access_type = "all")
2020
#' ```
2121
#'
2222
#' (You can also do this in Posit Connect by setting "Access" to
@@ -28,7 +28,7 @@
2828
#' board <- board_url(c(
2929
#' numbers = "https://pub.current.posit.team/public/great-numbers/"
3030
#' ))
31-
#' board %>% pin_read("numbers")
31+
#' board |> pin_read("numbers")
3232
#' ```
3333
#'
3434
#' You can find the URL of a pin with [pin_browse()].
@@ -40,7 +40,7 @@
4040
#' table preview for rectangular data, but you can opt out of the table preview:
4141
#'
4242
#' ```r
43-
#' board %>% pin_write(my_df, preview_data = FALSE)
43+
#' board |> pin_write(my_df, preview_data = FALSE)
4444
#' ```
4545
#'
4646
#' @inheritParams new_board
@@ -74,10 +74,10 @@
7474
#' \dontrun{
7575
#' board <- board_connect()
7676
#' # Share the mtcars with your team
77-
#' board %>% pin_write(mtcars, "mtcars")
77+
#' board |> pin_write(mtcars, "mtcars")
7878
#'
7979
#' # Download a shared dataset
80-
#' board %>% pin_read("timothy/mtcars")
80+
#' board |> pin_read("timothy/mtcars")
8181
#' }
8282
board_connect <- function(auth = c("auto", "manual", "envvar", "rsconnect"),
8383
server = NULL,

R/board_connect_url.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
#' my_vanity_url_pin = "https://pub.current.posit.team/public/great-numbers/"
2626
#' ))
2727
#'
28-
#' board %>% pin_read("my_vanity_url_pin")
28+
#' board |> pin_read("my_vanity_url_pin")
2929
#'
3030
board_connect_url <- function(vanity_urls,
3131
cache = NULL,

0 commit comments

Comments
 (0)