From 7bdddc761fa74e91223e67912aefb2c4078bc19c Mon Sep 17 00:00:00 2001 From: Colin Gillespie Date: Fri, 16 Oct 2026 13:34:06 +0100 Subject: [PATCH 1/3] fix: Import %||% from rlang and require R 4.1.0 get_uv_python_versions() used base R's %||%, which only exists from R 4.4.0, so on older R the remote version lookup always fell back to the cache. jsonlite moves to Imports, as it is called unconditionally. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01BEZ4ZUv51gFQjAe1WePbJF --- DESCRIPTION | 4 +++- NAMESPACE | 1 + R/get_latest_versions_remote.R | 4 ---- R/import-from.R | 2 +- tests/testthat/test-imports.R | 4 ++++ 5 files changed, 9 insertions(+), 6 deletions(-) create mode 100644 tests/testthat/test-imports.R diff --git a/DESCRIPTION b/DESCRIPTION index ad94618..5c3e496 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -7,6 +7,8 @@ Authors@R: Description: Base package for sharing classes between posit audit packages. Unlikely to be useful as is. License: file LICENSE +Depends: + R (>= 4.1.0) Imports: cli, dplyr, @@ -14,6 +16,7 @@ Imports: gt, htmltools, httr, + jsonlite, processx, purrr, R6, @@ -24,7 +27,6 @@ Imports: tibble, yaml Suggests: - jsonlite, rvest, testthat (>= 3.0.0) Remotes: diff --git a/NAMESPACE b/NAMESPACE index 6f5a2f7..3e76fd4 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -25,4 +25,5 @@ export(print_colour_versions) export(update_all_versions) import(R6) importFrom(dplyr,"%>%") +importFrom(rlang,"%||%") importFrom(rlang,.data) diff --git a/R/get_latest_versions_remote.R b/R/get_latest_versions_remote.R index 750dd40..1ef17de 100644 --- a/R/get_latest_versions_remote.R +++ b/R/get_latest_versions_remote.R @@ -36,10 +36,6 @@ get_latest_versions_remote = function() { } get_latest_versions_from_posit = function(type = c("r", "python")) { - if (!requireNamespace("jsonlite")) { - cli::cli_alert_info("Missing package - jsonlite") - return(invisible(NULL)) - } type = match.arg(type) url = glue::glue("https://cdn.posit.co/{type}/versions.json") versions = unlist(jsonlite::read_json(url)) diff --git a/R/import-from.R b/R/import-from.R index 4654213..c56141c 100644 --- a/R/import-from.R +++ b/R/import-from.R @@ -1,4 +1,4 @@ -#' @importFrom rlang .data +#' @importFrom rlang .data %||% NULL #' @importFrom dplyr %>% diff --git a/tests/testthat/test-imports.R b/tests/testthat/test-imports.R new file mode 100644 index 0000000..633bf80 --- /dev/null +++ b/tests/testthat/test-imports.R @@ -0,0 +1,4 @@ +test_that("%||% is imported from rlang, so it works before R 4.4.0", { + imports = parent.env(asNamespace("audit.base")) + expect_true(exists("%||%", envir = imports, inherits = FALSE)) +}) From 80da19f23be798455ba14defd759caef3197a149 Mon Sep 17 00:00:00 2001 From: Colin Gillespie Date: Fri, 16 Oct 2026 13:34:06 +0100 Subject: [PATCH 2/3] chore: Bump version to 0.7.4 --- DESCRIPTION | 2 +- NEWS.md | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 5c3e496..e98b0c9 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: audit.base Title: Base package for Posit Checks -Version: 0.7.3 +Version: 0.7.4 Authors@R: person("Jumping", "Rivers", , "info@jumpingrivers.com", role = c("aut", "cre")) Description: Base package for sharing classes between posit audit diff --git a/NEWS.md b/NEWS.md index 908906d..192094f 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,6 @@ +# audit.base 0.7.4 _2026-10-16_ + * fix: `get_uv_python_versions()` works before R 4.4, as `%||%` is imported from rlang. DESCRIPTION requires R 4.1.0 and imports jsonlite (#61) + # audit.base 0.7.3 _2026-10-15_ * fix: A release newer than the version list is reported as newer than the list, not as past EOL (#55) * fix: Versions are compared as numbers, so Quarto 1.10 counts as newer than 1.9 From 75edd321323b98d9665041176b2b8c383621ca56 Mon Sep 17 00:00:00 2001 From: Colin Gillespie Date: Fri, 16 Oct 2026 13:54:58 +0100 Subject: [PATCH 3/3] test: Remove the %||% import test --- tests/testthat/test-imports.R | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 tests/testthat/test-imports.R diff --git a/tests/testthat/test-imports.R b/tests/testthat/test-imports.R deleted file mode 100644 index 633bf80..0000000 --- a/tests/testthat/test-imports.R +++ /dev/null @@ -1,4 +0,0 @@ -test_that("%||% is imported from rlang, so it works before R 4.4.0", { - imports = parent.env(asNamespace("audit.base")) - expect_true(exists("%||%", envir = imports, inherits = FALSE)) -})