From f7b64e4661cea53d2400cbc8c8c086a8688adb7b Mon Sep 17 00:00:00 2001 From: camorosi <50029049+camorosi@users.noreply.github.com> Date: Tue, 10 Feb 2026 17:42:48 -0800 Subject: [PATCH 1/2] Remove qs --- DESCRIPTION | 1 - R/dp_commit.R | 4 +-- R/dp_write.R | 38 +++++++++++++-------------- R/utils.R | 28 ++++++++++---------- tests/testthat/test-dp_write.R | 48 +++++++++++++++++----------------- 5 files changed, 59 insertions(+), 60 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index f1969f2..0ddc699 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -34,7 +34,6 @@ Imports: yaml Suggests: httr, - qs, testthat (>= 3.0.0) Config/testthat/edition: 3 Encoding: UTF-8 diff --git a/R/dp_commit.R b/R/dp_commit.R index ad495fa..2d316c6 100644 --- a/R/dp_commit.R +++ b/R/dp_commit.R @@ -59,8 +59,8 @@ dp_commit <- function(project_path = fs::path_wd(), get_data_object_path <- function(project_path) { # Define possible formats and their paths possible_formats <- list( - RDS = fs::path_tidy(glue::glue("{project_path}/output_files/RDS_format/data_object.RDS")), - QS = fs::path_tidy(glue::glue("{project_path}/output_files/qs_format/data_object.qs")) + RDS = fs::path_tidy(glue::glue("{project_path}/output_files/RDS_format/data_object.RDS")) #, + # QS = fs::path_tidy(glue::glue("{project_path}/output_files/qs_format/data_object.qs")) ) # Iterate through the list and check if the file exists diff --git a/R/dp_write.R b/R/dp_write.R index 30f925c..7653f3b 100644 --- a/R/dp_write.R +++ b/R/dp_write.R @@ -66,8 +66,8 @@ save_object <- function(data_object, project_path, type = "rds"){ # Check if directories for other types exist # Create a mapping of type names to their directory format names format_dirs <- list( - "rds" = "RDS_format", - "qs" = "qs_format" + "rds" = "RDS_format" #, + # "qs" = "qs_format" # Add new formats here in the future ) @@ -94,26 +94,26 @@ save_object <- function(data_object, project_path, type = "rds"){ } switch(type, - rds = write_rds(data_object, project_path), - qs = write_qs(data_object, project_path) + rds = write_rds(data_object, project_path) # , +# qs = write_qs(data_object, project_path) ) } -#' @title Write qs object -#' @description Write qs object to `output_files/qs_format/` directory, -#' will create the directory if it does not exist -#' @noRd -write_qs <- function(data_object, project_path) { - rlang::check_installed("qs") - dataobj_path <- glue::glue( - "{project_path}/", - "output_files/qs_format/data_object.qs" - ) - check_dir(dataobj_path) - qs::qsave(data_object, dataobj_path) - return(dataobj_path) -} +# #' @title Write qs object +# #' @description Write qs object to `output_files/qs_format/` directory, +# #' will create the directory if it does not exist +# #' @noRd +# write_qs <- function(data_object, project_path) { +# rlang::check_installed("qs") +# dataobj_path <- glue::glue( +# "{project_path}/", +# "output_files/qs_format/data_object.qs" +# ) +# check_dir(dataobj_path) +# qs::qsave(data_object, dataobj_path) +# return(dataobj_path) +# } #' @title Write rds object #' @description Write rds object to `output_files/RDS_format/` directory, @@ -129,7 +129,7 @@ write_rds <- function(data_object, project_path) { return(dataobj_path) } -object_types <- c("rds", "qs") +object_types <- c("rds") #, "qs") #' @title Check directory #' @description Checks if directory exists and will create one if it does not exist diff --git a/R/utils.R b/R/utils.R index a643678..93ef8d2 100644 --- a/R/utils.R +++ b/R/utils.R @@ -327,21 +327,21 @@ check_pins_compatibility <- 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) -} \ No newline at end of file +# #' @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) +# } \ No newline at end of file diff --git a/tests/testthat/test-dp_write.R b/tests/testthat/test-dp_write.R index 2a984f4..4256726 100644 --- a/tests/testthat/test-dp_write.R +++ b/tests/testthat/test-dp_write.R @@ -25,35 +25,35 @@ test_that("properly creates data object paths", { save_object(data_object, path, type = 'rds'), file.path(path, "output_files/RDS_format/data_object.RDS")) unlink(file.path(path, "output_files/RDS_format/"), recursive = TRUE) - expect_equal( - save_object(data_object, path, type = 'qs'), - file.path(path, "output_files/qs_format/data_object.qs")) + # expect_equal( + # save_object(data_object, path, type = 'qs'), + # file.path(path, "output_files/qs_format/data_object.qs")) }) -test_that("properly errors when different format directory exists", { - # Set up temporary project path - path <- withr::local_tempdir() - data_object <- structure(list(), class = "dp") +# test_that("properly errors when different format directory exists", { +# # Set up temporary project path +# path <- withr::local_tempdir() +# data_object <- structure(list(), class = "dp") - # Mock validation function - local_mocked_bindings(is_valid_dp_repository = function(path) TRUE) +# # Mock validation function +# local_mocked_bindings(is_valid_dp_repository = function(path) TRUE) - # Create directory structure for RDS format first - dir.create(file.path(path, "output_files/RDS_format"), recursive = TRUE) +# # Create directory structure for RDS format first +# dir.create(file.path(path, "output_files/RDS_format"), recursive = TRUE) - # Now try to save as qs format, which should error - expect_error( - save_object(data_object, path, type = 'qs'), - "Directory for RDS format already exists while trying to save as qs. Please try again with the existing daap format." - ) +# # Now try to save as qs format, which should error +# expect_error( +# save_object(data_object, path, type = 'qs'), +# "Directory for RDS format already exists while trying to save as qs. Please try again with the existing daap format." +# ) - # Clean up and test the reverse case - unlink(file.path(path, "output_files/RDS_format"), recursive = TRUE) - dir.create(file.path(path, "output_files/qs_format"), recursive = TRUE) +# # Clean up and test the reverse case +# unlink(file.path(path, "output_files/RDS_format"), recursive = TRUE) +# dir.create(file.path(path, "output_files/qs_format"), recursive = TRUE) - expect_error( - save_object(data_object, path, type = 'rds'), - "Directory for qs format already exists while trying to save as RDS. Please try again with the existing daap format." - ) -}) \ No newline at end of file +# expect_error( +# save_object(data_object, path, type = 'rds'), +# "Directory for qs format already exists while trying to save as RDS. Please try again with the existing daap format." +# ) +# }) \ No newline at end of file From 553e02cc5766a5fe92aa1f96d61cbef1a2a6716d Mon Sep 17 00:00:00 2001 From: camorosi <50029049+camorosi@users.noreply.github.com> Date: Tue, 17 Feb 2026 15:47:43 -0800 Subject: [PATCH 2/2] Increment version number to 0.4.0 --- DESCRIPTION | 2 +- NEWS.md | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 0ddc699..1d89f4e 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: dpbuild Title: A package to manage building of data products -Version: 0.3.1 +Version: 0.4.0 Authors@R: person(given = "Afshin", family = "Mashadi-Hossein", diff --git a/NEWS.md b/NEWS.md index cd31f35..5788a85 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,7 @@ +# dpbuild 0.4.0 + +* Remove qs dependency and tooling + # dpbuild 0.3.1 * Fixed the bug related to the daap pin version not being captured properly in the log file