Skip to content

Updates to use rewritten reproducible #293

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

Open
wants to merge 121 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
121 commits
Select commit Hold shift + click to select a range
ca0a296
createDESCRIPTIONandDocs
Jun 19, 2024
b0dfdb1
bugfix when debug = 2 ... spades call errors with Error in class(xx) …
Jun 22, 2024
96c5eab
fixes for test-mod
Jun 25, 2024
b91a295
use box::use
Jun 27, 2024
81a5e30
mod masking from other packages e.g., magrittr
Jul 5, 2024
2628562
add box to DESCRIPTION
Jul 5, 2024
83c5f4f
Merge branch 'development' into box
Oct 28, 2024
67be609
minor
Nov 4, 2024
a800f29
cleaning
Nov 5, 2024
a77e724
restartSpades doesn't have clockTime
Nov 5, 2024
bb1eadc
test updates
Nov 5, 2024
69d826e
start using gitcreds
Nov 5, 2024
221d19f
quieter tests
Nov 5, 2024
0b7d14e
hide Rstudio bug about "package:stats" may not be available
Nov 13, 2024
e2db4c9
uncomment tests
Nov 13, 2024
b8093c1
new spadesOptions -- spades.reqdPkgsDontLoad - to explicitly prevent …
Nov 13, 2024
83757b4
Merge branch 'reqdPkgsDontLoad' into box
Nov 13, 2024
71d6b2e
options("spades.useBox"); redoc
Nov 13, 2024
858ee7c
reqdPkgsDontLoad
Nov 13, 2024
2c3176b
Merge branch 'reqdPkgsDontLoad' into box
Nov 13, 2024
a9552db
doc fail
Nov 13, 2024
419a442
Merge branch 'reqdPkgsDontLoad' into box
Nov 13, 2024
221da24
Revert "restartSpades doesn't have clockTime"
Nov 26, 2024
8b8c56a
when copying over objs from Cache, don't copy ._*** objs; they are si…
eliotmcintire Nov 26, 2024
47659ab
Merge remote-tracking branch 'origin/development' into box
Nov 26, 2024
71c95ab
restartSpades needs temporary sim@current; like simInit
Dec 2, 2024
b8b37de
bugfix useBox --> getOption(spades.useBox)
Dec 2, 2024
63a5e11
restartSpades with box fix; pkgs
eliotmcintire Dec 2, 2024
bdff6ae
allow parameter class to be a vector
eliotmcintire Dec 16, 2024
a167fa2
missing userTags in spades module calls
eliotmcintire Dec 18, 2024
c114055
Merge branch 'paramsWithClassVector' into box
Dec 18, 2024
bcde50b
Merge branch 'userTags' into box
Dec 18, 2024
cfea4d3
bump version
Dec 18, 2024
732c192
quick = FALSE default for objSize.simList
eliotmcintire Dec 20, 2024
d918a83
restartSpades mods; saveState
eliotmcintire Dec 20, 2024
73d809a
saveSimList add files as explicit param; bugfix inputFNs
eliotmcintire Dec 20, 2024
f4afcc0
protect using box with spades.useBox
eliotmcintire Dec 20, 2024
0d029e1
._startClockTime fixes in simInit; debugToVerbose
eliotmcintire Dec 20, 2024
086ff8b
debugToVerbose in spades
eliotmcintire Dec 20, 2024
bec480f
createDESCRIPTIONandDocs updates for missing .RbuildIgnore; add verbose
eliotmcintire Dec 20, 2024
a6e5c63
muffleWarning for package:stats may not be available
eliotmcintire Dec 20, 2024
549a985
useBox option
eliotmcintire Dec 20, 2024
577f034
clean up recovery mode in simulation-spades.R
eliotmcintire Dec 20, 2024
7176e46
Merge branch 'paramsWithClassVector' into box
Dec 21, 2024
cf87fcc
Plots for SpatRaster tweak
eliotmcintire Jan 10, 2025
6d3bc15
Merge branch 'box' of github.com:PredictiveEcology/SpaDES.core into box
eliotmcintire Jan 10, 2025
1dd6d35
.wrap.simList missing a cacheId
Jan 11, 2025
97ab870
Merge remote-tracking branch 'origin/box' into box
Jan 11, 2025
1072415
suppliedElsewhere: use loadOrder to include known cyclic starting
eliotmcintire Jan 11, 2025
7aa7afc
Merge branch 'box' of github.com:PredictiveEcology/SpaDES.core into box
eliotmcintire Jan 11, 2025
953d6c1
Bump 2.1.5.9007
Jan 11, 2025
5b1fc29
dealing with updated reproducible;
Jan 17, 2025
cab26c1
objSize updates -- use `.objSizeWithTry` b/c bug in lobstr
Jan 17, 2025
34af0b7
rename with "_": ._spadesDebugWidth
Jan 17, 2025
f8b1102
add "package:stats" warning catch
Jan 17, 2025
40cbf87
redoc; bump min reproducible
Jan 17, 2025
e6c38b8
getModuleVersion -- add moduleFiles arg -- no need to check internet 2x
Jan 17, 2025
03de272
rm ::: and redoc
Jan 17, 2025
a417bf2
use objects instead of txt for hidden sim objects
Jan 18, 2025
af7ddda
R CMD check
Jan 18, 2025
f2145e0
Bump
Jan 18, 2025
bee4ed2
._txtClockTime needs
Jan 19, 2025
bdf42da
test elapsedTime.simList
Jan 19, 2025
b21667c
R CMD checking
eliotmcintire Jan 20, 2025
5b3e68d
rm .modifySearchPath
Jan 22, 2025
4840114
Merge remote-tracking branch 'origin/box' into box
Jan 22, 2025
dc963c5
Merge remote-tracking branch 'origin/development' into box
Jan 23, 2025
078a71f
fix for caching with `@inputs` ... only this module's `@inputs`
eliotmcintire Feb 7, 2025
8ed85ec
Plots -- allow directly `Plots(ggObj)`
eliotmcintire Feb 7, 2025
3fd97a7
return the `gg` object invisibly for layering later
eliotmcintire Feb 7, 2025
122a0db
Plots -- if `filename` is absolute, accept it
eliotmcintire Feb 7, 2025
a4cafaa
rm "Work around for bug in qs that recovers data.tables as lists"; fa…
eliotmcintire Feb 7, 2025
644b5ab
recoverModePre -- use `try(Copy` b/c files can become corrupted
eliotmcintire Feb 7, 2025
adaa6f8
Merge branch 'box' of github.com:PredictiveEcology/SpaDES.core into box
eliotmcintire Feb 7, 2025
256aa79
spades.useBox implementation memory explodes; rm
eliotmcintire Feb 14, 2025
7275d29
restartSpades catch missing sim with meaningful stop
eliotmcintire Feb 14, 2025
87573ba
Bump
eliotmcintire Feb 15, 2025
76db18c
Merge branch 'development' into box
Feb 20, 2025
4ee8805
move restartSpades chunk
eliotmcintire Feb 20, 2025
695ab1b
Merge branch 'box' of github.com:PredictiveEcology/SpaDES.core into box
eliotmcintire Feb 20, 2025
d16eca9
Merge branch 'development' into box
Feb 20, 2025
eb0c783
restart -- stop for missing sim, shift
eliotmcintire Feb 24, 2025
e915d75
bump
eliotmcintire Feb 24, 2025
6763077
Merge branch 'box' of github.com:PredictiveEcology/SpaDES.core into box
eliotmcintire Feb 24, 2025
8804720
merge part 2
eliotmcintire Feb 24, 2025
1c74209
when updating params from .globals, it missed params whose defaults a…
eliotmcintire Feb 26, 2025
2981686
Merge remote-tracking branch 'origin/development' into box
Feb 27, 2025
f2eb252
Merge remote-tracking branch 'origin/box' into box
Feb 27, 2025
a2ba42a
edge case for .robustDigest and .prepareOutputs -- was incorrect for …
eliotmcintire Mar 1, 2025
2209f46
restartOrSimInitAndSpades
eliotmcintire Mar 1, 2025
1950d03
supplied Elsewhere attempts to fix circular dependencies between modules
eliotmcintire Mar 27, 2025
f53d164
sim@outputs -- in .prepareOutputs -- need vectorized
eliotmcintire Mar 28, 2025
571bd95
.robustDigest -- add algo everywhere
eliotmcintire Mar 28, 2025
160d763
bump; redoc
eliotmcintire Mar 28, 2025
f34a2fe
update tests for R CMD check
eliotmcintire Mar 28, 2025
40c9ee1
Merge branch 'suppliedElsewhere' into box
Mar 28, 2025
90c1774
restartSpades arg misnamed
eliotmcintire Mar 31, 2025
3d9d725
createDESCRIPTIONandDocs updates with R CMD check
eliotmcintire Mar 31, 2025
6f2b138
R CMD checking; rm box from checks
eliotmcintire Mar 31, 2025
e745cd4
other useBox --> FALSE
eliotmcintire Apr 1, 2025
a27eec3
Merge remote-tracking branch 'origin/suppliedElsewhere' into box
Apr 1, 2025
3fab620
rm temp dir
eliotmcintire Apr 1, 2025
81674a5
use reproducible@AI & fix on.exit with createDESCRIPTIONandDocs
eliotmcintire Apr 1, 2025
ae95eaf
minor
eliotmcintire Apr 1, 2025
7c7e635
minor
eliotmcintire Apr 1, 2025
abc78d5
rm imports on box
eliotmcintire Apr 1, 2025
5759cdc
redoc
eliotmcintire Apr 1, 2025
b1f3f60
spadesOptions table
eliotmcintire Apr 2, 2025
b537a96
Bump version of Require needed
Apr 5, 2025
2bffff3
comma to remotes
ianmseddy Apr 9, 2025
c0d68dd
Merge branch 'development' into box
Apr 10, 2025
e9dff1f
test-downloadData workaround?
Apr 10, 2025
e0c770b
test-downloadData fails on Windows: use GDrive instead of Github links
Apr 10, 2025
55dfc3f
use httr2 instead of httr
Apr 11, 2025
70fbe5f
rm fastshp from GA workflows
Apr 12, 2025
cb20e14
Revert "test-downloadData fails on Windows: use GDrive instead of Git…
Apr 12, 2025
b0a6cf0
test-downloadData and test-downloadModule
Apr 12, 2025
89e6d6f
minor re: recoveryModeOnExit
eliotmcintire Apr 30, 2025
1211b0e
reexports
eliotmcintire Apr 30, 2025
84452ba
Merge remote-tracking branch 'origin/development' into box
Apr 30, 2025
1bcdb44
Merge branch 'development' into box
May 14, 2025
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 .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
with:
extra-packages: |
any::rcmdcheck
PredictiveEcology/reproducible@development
PredictiveEcology/reproducible@AI
NLMR=?ignore
needs: check

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
extra-packages: |
any::pkgdown
local::.
PredictiveEcology/reproducible@development
PredictiveEcology/reproducible@AI
NLMR=?ignore
needs: website

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/revdeps.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
with:
extra-packages: |
any::rcmdcheck
PredictiveEcology/reproducible@development
PredictiveEcology/reproducible@AI
NLMR=?ignore
needs: check

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
with:
extra-packages: |
any::covr
PredictiveEcology/reproducible@development
PredictiveEcology/reproducible@AI
NLMR=?ignore

- name: Install additional package dependencies
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update-citation-cff.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
extra-packages: |
any::cffr
any::V8
PredictiveEcology/reproducible@development
PredictiveEcology/reproducible@AI
NLMR=?ignore

- name: Install additional package dependencies
Expand Down
17 changes: 11 additions & 6 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ Description: Provides the core framework for a discrete event system to
URL:
https://spades-core.predictiveecology.org/,
https://github.com/PredictiveEcology/SpaDES.core
Date: 2025-02-25
Version: 2.1.5.9003
Date: 2025-04-11
Version: 2.1.5.9022
Authors@R: c(
person("Alex M", "Chubaty", , "achubaty@for-cast.ca", role = c("aut"),
comment = c(ORCID = "0000-0001-7146-8135")),
Expand All @@ -31,7 +31,7 @@ Authors@R: c(
Depends:
R (>= 4.3),
quickPlot (>= 1.0.2),
reproducible (>= 2.1.1)
reproducible (>= 2.1.2.9027)
Imports:
cli,
data.table (>= 1.11.0),
Expand All @@ -40,7 +40,7 @@ Imports:
lobstr,
methods,
qs (>= 0.21.1),
Require (>= 0.3.1),
Require (>= 1.0.1.9000),
stats,
terra (>= 1.7-46),
tools,
Expand All @@ -51,12 +51,15 @@ Suggests:
CircStats,
codetools,
covr,
DBI,
DiagrammeR (>= 0.8.2),
future,
future.callr,
ggplot2,
ggplotify,
httr,
gitcreds,
googledrive,
httr2,
knitr,
lattice,
lme4,
Expand All @@ -78,7 +81,8 @@ Suggests:
withr
Remotes:
ropensci/NLMR,
PredictiveEcology/reproducible@development
PredictiveEcology/reproducible@AI,
PredictiveEcology/Require@development
Additional_repositories: https://predictiveecology.r-universe.dev/
Encoding: UTF-8
Language: en-CA
Expand All @@ -102,6 +106,7 @@ Collate:
'code-checking.R'
'convertToPackage.R'
'copy.R'
'createDESCRIPTIONandDocs.R'
'debugging.R'
'downloadData.R'
'simulation-parseModule.R'
Expand Down
4 changes: 4 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ export(conditionalEvents)
export(convertTimeunit)
export(convertToPackage)
export(copyModule)
export(createDESCRIPTIONandDocs)
export(createsOutput)
export(current)
export(currentModule)
Expand Down Expand Up @@ -182,11 +183,13 @@ export(rasterToMemory)
export(registerOutputs)
export(remoteFileSize)
export(reqdPkgs)
export(restartOrSimInitAndSpades)
export(restartR)
export(restartSpades)
export(rndstr)
export(saveFiles)
export(saveSimList)
export(saveState)
export(savedSimEnv)
export(scheduleConditionalEvent)
export(scheduleEvent)
Expand Down Expand Up @@ -397,6 +400,7 @@ importFrom(reproducible,.cacheMessageObjectToRetrieve)
importFrom(reproducible,.checkCacheRepo)
importFrom(reproducible,.file.move)
importFrom(reproducible,.grepSysCalls)
importFrom(reproducible,.objSizeWithTry)
importFrom(reproducible,.orderDotsUnderscoreFirst)
importFrom(reproducible,.preDigestByClass)
importFrom(reproducible,.prepareOutput)
Expand Down
6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
# SpaDES.core (development version)

* drop support for R 4.2;
* fix edge case with caching of events; `outputs` would create false positives (i.e., a change, when there wasn't one); this meant that caching would only be successful after the 2nd time running the event, if another module had put objects in the `outputs` list, especially by using `Plots`
* fix issue with `Plots()` where plots were discarded if no filename was specified;
* minor documentation improvements;
* new option: `spades.reqdPkgsDontLoad`, a character vector. If anything is specified,
then it will not be loaded with `require` or `library`, but it will be installed, if needed,
and if `spades.useRequire = TRUE`, which is the default. Default for this new option is
"box", which is one of potentially many in the R universe that throws an error if it is
loaded.

# SpaDES.core 2.1.5

Expand Down
34 changes: 27 additions & 7 deletions R/Plots.R
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ ggplotClassesCanHandle <- c("eps", "ps", "tex", "pdf", "jpeg", "tiff", "png", "b
#' .plotInitialTime = 1)
#' }
#' } # end ggplot
#' unlink("figures") # clean up
#' } # end of dontrun
Plots <- function(data, fn, filename,
types = quote(params(sim)[[currentModule(sim)]]$.plots),
Expand Down Expand Up @@ -242,7 +243,11 @@ Plots <- function(data, fn, filename,
if (missing(data)) {
gg <- fn(...)
} else {
gg <- fn(data, ...)
if (is(data, "ggplot")) {
gg <- data
}
else
gg <- fn(data, ...)
}

if (!is(gg, ".quickPlot")) {
Expand Down Expand Up @@ -309,18 +314,31 @@ Plots <- function(data, fn, filename,
names(ggListToScreen) <- gsub(names(ggListToScreen), pattern = " |(\\\n)|[[:punct:]]", replacement = "_")
Plot(ggListToScreen, addTo = gg$labels$title)
} else {
if (!(identical(fn, plot) || identical(fn, terra::plot)))
if ((!(identical(fn, plot) || identical(fn, terra::plot)) || is(gg, "gg")) &&
!is(gg, ".quickPlot"))
print(gg)
}
}
}
needSaveRaw <- any(grepl("raw", types))
if (needSave || needSaveRaw) {
if (missing(filename)) {
filename <- tempfile(fileext = "") ## TODO: can we use e.g. the object name + sim time??
dataObjName <- deparse(substitute(data))
filename <- paste0(dataObjName, "_", basename(gsub("file", "", tempfile(fileext = "")))) ## TODO: can we use e.g. the object name + sim time??
if (exists("sim", inherits = FALSE)) {
simTime <- round(as.numeric(time(sim)), 3)
filename <- paste0("sim", "_", filename)
}
} else {
filename <- basename(filename) |> tools::file_path_sans_ext()
filename <- filename |> tools::file_path_sans_ext()
}

if (isAbsolutePath(filename)) {
path <- dirname(filename)
}

filename <- basename(filename)

isDefaultPath <- identical(eval(formals(Plots)$path), path)
if (!is.null(simIsIn)) {
if (is(path, "call"))
Expand All @@ -333,7 +351,7 @@ Plots <- function(data, fn, filename,
}

if (needSaveRaw) {
if (is(data, "Raster")) {
if (is(data, "Raster") || is(data, "SpatRaster")) {
rasterFilename <- file.path(path, paste0(filename, "_data.tif"))
writeRaster(data, filename = rasterFilename, overwrite = TRUE)
if (exists("sim", inherits = FALSE))
Expand All @@ -355,7 +373,6 @@ Plots <- function(data, fn, filename,
)
}
}

if (needSave) {
if (is.null(simIsIn)) {
if (is.call(path))
Expand Down Expand Up @@ -417,7 +434,10 @@ Plots <- function(data, fn, filename,
if (exists("sim", inherits = FALSE))
assign("sim", sim, envir = simIsIn)

return(invisible(NULL))
if (exists("gg", inherits = FALSE))
return(invisible(gg))
else
return(invisible(NULL))
}

#' Test whether there should be any plotting from `.plots` module parameter
Expand Down
Loading
Loading