diff --git a/DESCRIPTION b/DESCRIPTION index 2fd07bc..c029dc8 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: dpdeploy Title: A package to manage deployment of data products -Version: 0.4.0 +Version: 0.5.0 Authors@R: c( person(given = "Afshin", family = "Mashadi-Hossein", email ="amashadihossein@gmail.com", role = c("aut", "cre")), person(given = "Yue", family = "Jiang", email = "rivehill@gmail.com", role = "aut") @@ -28,13 +28,12 @@ Imports: yaml Suggests: covr, - qs, roxygen2, testthat (>= 3.0.0) Encoding: UTF-8 LazyData: true Roxygen: list(markdown = TRUE) -RoxygenNote: 7.3.2 +RoxygenNote: 7.3.3 Remotes: github::camorosi/pinsLabkey Config/testthat/edition: 3 diff --git a/NEWS.md b/NEWS.md index 76333c0..5ce6ed3 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,7 @@ +# dpdeploy 0.5.0 + +* Add s3 "prefix" option so that a subfolder can be used for s3 daaps + # dpdeploy 0.4.0 * Enable saving data objects in qs format via the "type" param in `dpinput_sync()`. Note that `dp_deploy()` now detects type automatically. diff --git a/R/dp_deploy.R b/R/dp_deploy.R index 594f7e4..20130fa 100644 --- a/R/dp_deploy.R +++ b/R/dp_deploy.R @@ -45,24 +45,24 @@ detect_type = function(project_path){ #' @description read the output data object, for now only rds and qs are supported #' @noRd object_read <- function(project_path, type){ - type = rlang::arg_match0(type, c('rds', 'qs')) + type = rlang::arg_match0(type, c('rds')) #, 'qs')) switch(type, - rds = readRDS(file = glue::glue("{project_path}/output_files/RDS_format/data_object.RDS")), - qs = read_qs(project_path) + rds = readRDS(file = glue::glue("{project_path}/output_files/RDS_format/data_object.RDS")) #, + # qs = read_qs(project_path) ) } -#' @title Reas qs object -#' @description Read in qs object -#' @noRd -read_qs <- function(path){ - rlang::check_installed("qs") - dataobj_path <- glue::glue( - "{path}/", - "output_files/qs_format/data_object.qs" - ) - qs::qread(dataobj_path) -} +# #' @title Reas qs object +# #' @description Read in qs object +# #' @noRd +# read_qs <- function(path){ +# rlang::check_installed("qs") +# dataobj_path <- glue::glue( +# "{path}/", +# "output_files/qs_format/data_object.qs" +# ) +# qs::qread(dataobj_path) +# } #' The dp_deploy is a wrapper around this. @@ -99,7 +99,7 @@ dp_deployCore.s3_board <- function(conf, project_path, d, dlog, git_info, type, } board <- pins::board_s3( - prefix = "daap/", + prefix = paste0(ifelse(is.na(conf$board_params$prefix), "", conf$board_params$prefix), "daap/"), bucket = conf$board_params$bucket_name, region = conf$board_params$region, access_key = aws_creds$key, diff --git a/R/dpinput_sync.R b/R/dpinput_sync.R index c5a5b2f..b79f9b0 100644 --- a/R/dpinput_sync.R +++ b/R/dpinput_sync.R @@ -105,7 +105,7 @@ init_board.s3_board <- function(conf) { } pins::board_s3( - prefix = "dpinput/", + prefix = paste0(ifelse(is.na(conf$board_params$prefix), "", conf$board_params$prefix), "dpinput/"), bucket = conf$board_params$bucket_name, region = conf$board_params$region, access_key = aws_creds$key, diff --git a/tests/testthat/test-dp_deploy.R b/tests/testthat/test-dp_deploy.R index bacabab..865d38f 100644 --- a/tests/testthat/test-dp_deploy.R +++ b/tests/testthat/test-dp_deploy.R @@ -9,14 +9,14 @@ test_that("properly checks valid repository ", { test_that("object_read properly detects type", { - project_path = withr::local_tempfile() - path = file.path(project_path, "output_files/qs_format/") - dir.create(path, recursive = TRUE) - qs::qsave(structure(list(), class = "dp"), file = file.path(path, "data_object.qs")) - expect_equal( - detect_type(project_path), - 'qs' - ) + # project_path = withr::local_tempfile() + # path = file.path(project_path, "output_files/qs_format/") + # dir.create(path, recursive = TRUE) + # qs::qsave(structure(list(), class = "dp"), file = file.path(path, "data_object.qs")) + # expect_equal( + # detect_type(project_path), + # 'qs' + # ) project_path = withr::local_tempfile() path = file.path(project_path, "output_files/RDS_format/")