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

Add codespace for 3.4.0, maintaining r-devel as default #103

Merged
merged 15 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"build": { "dockerfile": "Dockerfile", "context": ".."}
"build": { "dockerfile": "r-devel/Dockerfile", "context": ".."}
}
68 changes: 68 additions & 0 deletions .devcontainer/r-340/.Rprofile
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Minimal testthat masks for R before testthat support so that source(test_script) works

test_that = function(desc, expr) tryCatch(expr, skip_error = identity)

skip_if = function(cond, info) {
if (!cond) return(invisible())
e = simpleError(paste("Skipping:", info))
class(e) = c("skip_error", class(e))
stop(e)
}

skip_if_not_installed = function(pkg) {
skip_if(!requireNamespace(pkg), paste(pkg, "is not installed"))
}

expect_identical = function(x, y, tolerance = NULL, ignore_attr = NULL) {
if (!is.null(ignore_attr)) {
attributes(x) = attributes(x)[!names(attributes(x)) %in% ignore_attr]
attributes(y) = attributes(y)[!names(attributes(y)) %in% ignore_attr]
}
if (is.null(tolerance)) {
stopifnot(identical(x, y))
} else {
stopifnot(isTRUE(all.equal(x, y, tolerance=tolerance)))
}
invisible(x)
}

expect_true = function(x) expect_identical(x, TRUE)
expect_false = function(x) expect_identical(x, FALSE)

# NB: this doesn't really work like expect_warning does, to be revisited...
expect_warning = function(expr, msg, ...) {
e = new.env()
withCallingHandlers(
warning = function(w) { e$msg = conditionMessage(w); invokeRestart("muffleWarning") },
expr
)
stopifnot(grepl(msg, e$msg, ...))
invisible(x)
}
# overwrite by automatically passing these tests for now
expect_warning = function(...) invisible()

expect_error = function(expr, msg, ...) {
val = tryCatch(expr, error = identity)
stopifnot(inherits(val, "error") && grepl(msg, conditionMessage(val), ...))
}

expect_s3_class = function(x, kls) stopifnot(inherits(x, kls))
expect_length = function(x, l) expect_identical(length(x), l)

expect_output = function(expr, str, ...) {
act = paste(capture.output(val <- expr), collapse="\n")
stopifnot(grepl(str, act, ...))
invisible(val)
}

expect_match = function(x, pattern, ..., all=TRUE) {
agg = if (all) base::all else any
stopifnot(agg(grepl(pattern, x, ...)))
invisible(x)
}

expect_no_match = function(x, pattern, ...) {
stopifnot(!any(grepl(pattern, x, ...)))
invisible(x)
}
22 changes: 22 additions & 0 deletions .devcontainer/r-340/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM ghcr.io/r-hub/evercran/3.4.0

RUN apt-get -qq update && \
apt-get install -y --no-install-recommends git

COPY DESCRIPTION .

RUN Rscript -e ' \
options(repos = "https://cloud.r-project.org"); \
dcf = read.dcf("DESCRIPTION", c("Depends", "Imports", "Suggests")); \
deps = names(tools:::.split_dependencies(dcf)); \
default_pkgs = tools:::.get_standard_package_names()$base; \
installable = setdiff(rownames(available.packages()), default_pkgs); \
message("All deps: ", toString(deps)); \
deps = intersect(deps, installable); \
message("Installing: ", toString(deps)); \
install.packages(deps); \
'

# Needed for testthat equivalency on pre-testthat R
WORKDIR /root
COPY .devcontainer/r-340/.Rprofile .
3 changes: 3 additions & 0 deletions .devcontainer/r-340/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"build": { "dockerfile": "Dockerfile", "context": "../.." }
}
File renamed without changes.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Authors@R: c(
person("Leonardo", "Silvestri", role = "ctb"),
person("Ofek", "Shilon", role = "ctb")
)
Depends: R (>= 3.3.0), bit (>= 4.0.0)
Depends: R (>= 3.4.0), bit (>= 4.0.0)
Description:
Package 'bit64' provides serializable S3 atomic 64bit (signed) integers.
These are useful for handling database keys and exact counting in +-2^63.
Expand Down
4 changes: 3 additions & 1 deletion NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@

I don't have any major plans for new features, and mostly hope to keep the package running and up to date. Contributors most welcome! I am also trying to freshen up the code base to make contribution easier.

1. The R version dependency has increased from 3.0.1 (May 2013) to 3.3.0 (April 2017). We plan to keep roughly the same R dependency as {data.table}, i.e., as old as possibly for as long as possible, with some bias towards gradually bringing in new R features to reduce the maintenance overhead of a growing nest of workarounds to keep the package "fresh" for users of the latest R versions.
1. The R version dependency has increased from 3.0.1 (May 2013) to 3.4.0 (April 2017). We plan to keep roughly the same R dependency as {data.table}, i.e., as old as possibly for as long as possible, with some bias towards gradually bringing in new R features to reduce the maintenance overhead of a growing nest of workarounds to keep the package "fresh" for users of the latest R versions.

Required package {bit} already requires R 3.4.0, so the old 3.0.1 requirement was effectively impossible anyway.

1. Default packages {methods}, {stats}, and {utils} are now `Imports:`, not `Depends:`, dependencies. `Depends:` is an out-dated mode of dependency in R. This will only affect the small audience of users that run R with `R_DEFAULT_PACKAGES=NULL` (or some other subset excluding some of these three), _and_ who are relying (perhaps implicitly) on {bit64} being responsible for attaching those packages.

Expand Down
2 changes: 2 additions & 0 deletions tests/testthat/test-integer64.R
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ test_that("semantics about mixed types for multiplication are respected", {
expect_identical(int * i64, as.integer64(10L))
expect_identical(i64 * i64, as.integer64(4L))

skip_if_not_installed("withr") # only really for testing without testthat
withr::with_options(list(integer64_semantics = "new"), {
expect_identical(i64 * dbl, as.integer64(7L))
expect_identical(dbl * i64, as.integer64(7L))
Expand All @@ -263,6 +264,7 @@ test_that("semantics about mixed types for division are respected", {
expect_identical(int / i64, 2.0)
expect_identical(i64 / i64, 1.0)

skip_if_not_installed("withr") # only really for testing without testthat
withr::with_options(list(integer64_semantics = "new"), {
expect_identical(i64 / dbl, 2.0)
expect_identical(dbl / i64, 0.5)
Expand Down
Loading