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

Some general package maintenance #844

Merged
merged 13 commits into from
Oct 7, 2024
8 changes: 1 addition & 7 deletions .github/workflows/check-boards.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes

# needed for modern board tests
# board specific env vars
PINS_AZURE_SAS: ${{ secrets.PINS_AZURE_SAS }}
PINS_AZURE_KEY: ${{ secrets.PINS_AZURE_KEY }}
PINS_AZURE_ACCOUNT: ${{ secrets.PINS_AZURE_ACCOUNT }}
Expand All @@ -26,12 +26,6 @@ jobs:
DATABRICKS_HOST: "https://rstudio-partner-posit-default.cloud.databricks.com"
PINS_DATABRICKS_FOLDER_URL: "/Volumes/workshops/models/vetiver"

# needed for legacy board tests
TEST_AWS_BUCKET: "pins-github-tests"
TEST_AWS_KEY: "AKIAWDFKE5M2ZHDUORMW"
TEST_AWS_REGION: "us-east-2"
TEST_AWS_SECRET: ${{ secrets.TEST_AWS_SECRET }}

steps:
- uses: actions/checkout@v3

Expand Down
8 changes: 4 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Type: Package
Package: pins
Title: Pin, Discover and Share Resources
Title: Pin, Discover, and Share Resources
Version: 1.3.0.9000
Authors@R: c(
person("Julia", "Silge", , "[email protected]", role = c("cre", "aut"),
Expand All @@ -13,8 +13,8 @@ Authors@R: c(
Description: Publish data sets, models, and other R objects, making it
easy to share them across projects and with your colleagues. You can
pin objects to a variety of "boards", including local folders (to
share on a networked drive or with 'DropBox'), 'RStudio' connect,
Amazon S3, and more.
share on a networked drive or with 'DropBox'), 'Posit Connect',
'AWS S3', and more.
License: Apache License (>= 2)
URL: https://pins.rstudio.com/, https://github.com/rstudio/pins-r
BugReports: https://github.com/rstudio/pins-r/issues
Expand Down Expand Up @@ -73,4 +73,4 @@ Config/Needs/website: tidyverse/tidytemplate
Config/testthat/edition: 3
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.3
RoxygenNote: 7.3.2
4 changes: 4 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ S3method(pin_exists,pins_board_kaggle_dataset)
S3method(pin_exists,pins_board_ms365)
S3method(pin_exists,pins_board_s3)
S3method(pin_exists,pins_board_url)
S3method(pin_extract,"compressed-tar")
S3method(pin_extract,default)
S3method(pin_extract,gzip)
S3method(pin_extract,zip)
S3method(pin_fetch,pins_board_azure)
S3method(pin_fetch,pins_board_connect)
S3method(pin_fetch,pins_board_databricks)
Expand Down
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

* Changed the function signature of `pin_upload()` to be consistent with `pin_write()` i.e. arguments like `tags` must be passed by name and not position (#809).

* Started gradual deprecation process for legacy pins functions such as `pin()` (#844).

## Other improvements

* Added example Python code to pin previews for Posit Connect (#806).
Expand Down
20 changes: 10 additions & 10 deletions R/board_connect.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#'
#' ```r
#' board <- board_url(c(
#' numbers = "https://colorado.posit.co/rsc/great-numbers/"
#' numbers = "https://pub.current.posit.team/public/great-numbers/"
#' ))
#' board %>% pin_read("numbers")
#' ```
Expand Down Expand Up @@ -701,24 +701,24 @@ rsc_v1 <- function(...) {
# Testing setup -----------------------------------------------------------

board_connect_test <- function(...) {
if (connect_has_colorado()) {
board_connect_colorado(...)
if (connect_has_ptd()) {
board_connect_ptd(...)
} else {
board_connect_susan(...)
}
}

# Use Colorado for local testing
connect_has_colorado <- function() {
# Use demo.posit.team PTD for local testing
connect_has_ptd <- function() {
accounts <- rsconnect::accounts()
"colorado.posit.co" %in% accounts$server
"pub.demo.posit.team" %in% accounts$server
}

board_connect_colorado <- function(...) {
if (!connect_has_colorado()) {
testthat::skip("board_connect_colorado() only works with Posit's demo server")
board_connect_ptd <- function(...) {
if (!connect_has_ptd()) {
testthat::skip("board_connect_ptd() only works with Posit's demo PTD server")
}
board_connect(..., server = "colorado.posit.co", auth = "rsconnect", cache = fs::file_temp())
board_connect(..., server = "pub.demo.posit.team", auth = "rsconnect", cache = fs::file_temp())
}

board_connect_susan <- function(...) {
Expand Down
12 changes: 6 additions & 6 deletions R/board_connect_url.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#' connect_auth_headers()
#'
#' board <- board_connect_url(c(
#' my_vanity_url_pin = "https://colorado.posit.co/rsc/great-numbers/"
#' my_vanity_url_pin = "https://pub.current.posit.team/public/great-numbers/"
#' ))
#'
#' board %>% pin_read("my_vanity_url_pin")
Expand Down Expand Up @@ -68,16 +68,16 @@ vanity_url_test <- function(env = parent.frame()) {
}

board_connect_url_test <- function(...) {
if (connect_has_colorado()) {
board_connect_url_colorado(...)
if (connect_has_ptd()) {
board_connect_url_ptd(...)
} else {
board_connect_url_susan(...)
}
}

board_connect_url_colorado <- function(...) {
if (!connect_has_colorado()) {
testthat::skip("board_connect_url_colorado() only works with Posit's demo server")
board_connect_url_ptd <- function(...) {
if (!connect_has_ptd()) {
testthat::skip("board_connect_url_ptd() only works with Posit's demo server")
}
board_connect_url(..., cache = fs::file_temp())
}
Expand Down
9 changes: 9 additions & 0 deletions R/legacy_azure.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#' Azure board (legacy API)
#'
#' @description
#' `r lifecycle::badge('deprecated')`
#'
#' To use Microsoft Azure Storage as a board, you'll need an Azure Storage
#' account, an Azure Storage container, and an Azure Storage key.
#' You can sign-up and create those at [portal.azure.com](https://portal.azure.com).
Expand All @@ -24,6 +26,7 @@
#' )
#' }
#' @export
#' @keywords internal
legacy_azure <- function(
container = Sys.getenv("AZURE_STORAGE_CONTAINER"),
account = Sys.getenv("AZURE_STORAGE_ACCOUNT"),
Expand Down Expand Up @@ -61,6 +64,12 @@ board_register_azure <- function(name = "azure",
cache = NULL,
path = NULL,
...) {
lifecycle::deprecate_soft(
"1.4.0",
"board_register_azure()",
details = 'Learn more at <https://pins.rstudio.com/articles/pins-update.html>'
)

board <- legacy_azure(
name = name,
container = container,
Expand Down
2 changes: 2 additions & 0 deletions R/legacy_board.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@

#' Custom Boards
#'
#' `r lifecycle::badge('deprecated')`
#'
#' Family of functions meant to be used to implement custom boards extensions,
#' not to be used by users.
#'
Expand Down
8 changes: 8 additions & 0 deletions R/legacy_board_registry.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#' Board registry (legacy API)
#'
#' @description
#' `r lifecycle::badge('deprecated')`
#'
#' The legacy pins API uses a board registry, where you first register a board
#' then refer to it by name in calls to pin functions.
#'
Expand Down Expand Up @@ -52,6 +54,12 @@ board_register_rsconnect <- function(name = "rsconnect",
output_files = FALSE,
cache = NULL,
...) {
lifecycle::deprecate_soft(
"1.4.0",
"board_register_rsconnect()",
details = 'Learn more at <https://pins.rstudio.com/articles/pins-update.html>'
)

board <- board_rsconnect(
name = name,
server = server,
Expand Down
9 changes: 9 additions & 0 deletions R/legacy_datatxt.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#' Remote "data.txt" board (legacy API)
#'
#' `r lifecycle::badge('deprecated')`
#'
#' Use board that for a website that uses the [data.txt](https://datatxt.org)
#' specification. A `data.txt` file is a YAML that provides some basic metadata
#' about a directory of files.
Expand All @@ -26,6 +28,7 @@
#' # find pins
#' pin_find(board = "txtexample")
#' @export
#' @keywords internal
legacy_datatxt <- function(url,
headers = NULL,
cache = NULL,
Expand Down Expand Up @@ -67,6 +70,12 @@ board_register_datatxt <- function(url,
headers = NULL,
cache = NULL,
...) {
lifecycle::deprecate_soft(
"1.4.0",
"board_register_datatxt()",
details = 'Learn more at <https://pins.rstudio.com/articles/pins-update.html>'
)

board <- legacy_datatxt(
name = name,
url = url,
Expand Down
9 changes: 9 additions & 0 deletions R/legacy_dospaces.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#' DigitalOcean board (legacy API)
#'
#' `r lifecycle::badge('deprecated')`
#'
#' To use DigitalOcean Spaces as a board, you first
#' need an DigitalOcean space and a storage key. You can sign-up and create
#' those at [digitalocean.com](https://www.digitalocean.com/).
Expand All @@ -21,6 +23,7 @@
#' board <- legacy_dospace(bucket = "s3bucket")
#' }
#' @export
#' @keywords internal
legacy_dospace <- function(
space = Sys.getenv("DO_SPACE"),
key = Sys.getenv("DO_ACCESS_KEY_ID"),
Expand Down Expand Up @@ -64,6 +67,12 @@ board_register_dospace <- function(name = "dospace",
host = "digitaloceanspaces.com",
path = NULL,
...) {
lifecycle::deprecate_soft(
"1.4.0",
"board_register_dospace()",
details = 'Learn more at <https://pins.rstudio.com/articles/pins-update.html>'
)

board <- legacy_dospace(
name = name,
space = space,
Expand Down
9 changes: 9 additions & 0 deletions R/legacy_gcloud.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#' Google Cloud board (legacy API)
#'
#' `r lifecycle::badge('deprecated')`
#'
#' To use a Google Cloud Storage board, you first need a Google Cloud Storage
#' account, a Google Storage bucket, and an access token or the
#' [Google Cloud SDK](https://cloud.google.com/sdk/) properly installed and
Expand All @@ -22,6 +24,7 @@
#' board <- legacy_gcloud(container = "gcloudcontainer")
#' }
#' @export
#' @keywords internal
legacy_gcloud <- function(
bucket = Sys.getenv("GCLOUD_STORAGE_BUCKET"),
token = NULL,
Expand Down Expand Up @@ -68,6 +71,12 @@ board_register_gcloud <- function(name = "gcloud",
cache = NULL,
path = NULL,
...) {
lifecycle::deprecate_soft(
"1.4.0",
"board_register_gcloud()",
details = 'Learn more at <https://pins.rstudio.com/articles/pins-update.html>'
)

board <- legacy_gcloud(
name = name,
bucket = bucket,
Expand Down
26 changes: 17 additions & 9 deletions R/legacy_github.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#' GitHub board (legacy API)
#'
#' `r lifecycle::badge('deprecated')`
#'
#' To use a GitHub board, you'll need to set up authentication, following
#' the instructions at <https://happygitwithr.com/https-pat.html#https-pat>.
#'
Expand Down Expand Up @@ -29,15 +31,15 @@
#' board <- legacy_github("owner/repo")
#' }
#' @export
legacy_github <- function(
repo,
branch = NULL,
token = NULL,
path = "",
host = "https://api.github.com",
name = "github",
cache = NULL,
...) {
#' @keywords internal
legacy_github <- function(repo,
branch = NULL,
token = NULL,
path = "",
host = "https://api.github.com",
name = "github",
cache = NULL,
...) {

cache <- cache %||% board_cache_path(name)

Expand Down Expand Up @@ -97,6 +99,12 @@ board_register_github <- function(name = "github",
host = "https://api.github.com",
cache = NULL,
...) {
lifecycle::deprecate_soft(
"1.4.0",
"board_register_github()",
details = 'Learn more at <https://pins.rstudio.com/articles/pins-update.html>'
)

board <- legacy_github(
name = name,
repo = repo,
Expand Down
7 changes: 7 additions & 0 deletions R/legacy_kaggle.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#' Kaggle board (legacy API)
#'
#' `r lifecycle::badge('deprecated')`
#'
#' These functions are no longer supported because of changes to the Kaggle
#' API and will be removed in a future version of pins. We recommend that you
#' use the [Kaggle CLI](https://www.kaggle.com/docs/api) instead.
Expand Down Expand Up @@ -52,6 +54,11 @@ board_register_kaggle <- function(name = "kaggle",
token = NULL,
cache = NULL,
...) {
lifecycle::deprecate_soft(
"1.4.0",
"board_register_kaggle()",
details = 'Learn more at <https://pins.rstudio.com/articles/pins-update.html>'
)

cache <- cache %||% board_cache_path(name)

Expand Down
8 changes: 8 additions & 0 deletions R/legacy_local.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#' Local board (legacy API)
#'
#' @description
#' `r lifecycle::badge('deprecated')`
#'
#' `legacy_local()` powers `board_register_local()`, which allows you to
#' access local pins created in earlier versions of the pins package. For
#' new pins, we recommend that you transition to [board_local()] which
Expand All @@ -14,6 +16,7 @@
#' to a system **cache** directory, which may be deleted by the operating
#' system if you run out of disk space.
#' @export
#' @keywords internal
#' @examplesIf rlang::is_installed("filelock")
#' # Old api
#' pin(data.frame(x = 1:3), "test")
Expand All @@ -38,6 +41,11 @@ legacy_local <- function(path = NULL, name = "local", versions = FALSE) {
#' @rdname legacy_local
#' @export
board_register_local <- function(name = "local", cache = NULL, ...) {
lifecycle::deprecate_soft(
"1.4.0",
"board_register_local()",
details = 'Learn more at <https://pins.rstudio.com/articles/pins-update.html>'
)
board <- legacy_local(path = cache, name = name, ...)
board_register2(board)
}
Expand Down
Loading
Loading