Skip to content

Commit

Permalink
To align with ropensci/targets#1244 and ropensci/targets#1262, switch…
Browse files Browse the repository at this point in the history
… the hashing functions from digest::digest() to secretbase::siphash13().
  • Loading branch information
wlandau-lilly committed Apr 5, 2024
1 parent bf761c3 commit bbdda1b
Show file tree
Hide file tree
Showing 8 changed files with 154 additions and 86 deletions.
8 changes: 4 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Description: Bayesian data analysis usually incurs long runtimes
both single-fit workflows and multi-rep simulation studies.
For the statistical methodology, please refer to 'Stan' documentation
(Stan Development Team 2020) <https://mc-stan.org/>.
Version: 0.1.0.9001
Version: 0.1.1
License: MIT + file LICENSE
URL: https://docs.ropensci.org/stantargets/, https://github.com/ropensci/stantargets
BugReports: https://github.com/ropensci/stantargets/issues
Expand Down Expand Up @@ -44,16 +44,16 @@ Depends:
R (>= 3.5.0)
Imports:
cmdstanr (>= 0.5.0),
digest (>= 0.6.25),
fs (>= 1.5.0),
fst (>= 0.9.2),
posterior (>= 1.0.1),
purrr (>= 0.3.4),
qs (>= 0.23.2),
rlang (>= 0.4.10),
secretbase (>= 0.4.0),
stats,
targets (>= 1.5.1.9001),
tarchetypes (>= 0.7.12.9001),
targets (>= 1.6.0),
tarchetypes (>= 0.8.0),
tibble (>= 3.0.1),
tidyselect,
withr (>= 2.1.2)
Expand Down
3 changes: 2 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ export(tar_stan_vb_rep_run)
export(tar_stan_vb_rep_summary)
export(tar_stan_vb_run)
importFrom(cmdstanr,cmdstan_model)
importFrom(digest,digest)
importFrom(fs,path_ext_remove)
importFrom(fs,path_rel)
importFrom(fst,read_fst)
Expand All @@ -42,6 +41,7 @@ importFrom(qs,qread)
importFrom(rlang,check_installed)
importFrom(rlang,expr)
importFrom(rlang,quo_squash)
importFrom(secretbase,siphash13)
importFrom(stats,rnorm)
importFrom(stats,runif)
importFrom(tarchetypes,tar_combine_raw)
Expand All @@ -61,6 +61,7 @@ importFrom(targets,tar_load)
importFrom(targets,tar_option_get)
importFrom(targets,tar_read)
importFrom(targets,tar_script)
importFrom(targets,tar_seed_create)
importFrom(targets,tar_seed_get)
importFrom(targets,tar_target)
importFrom(targets,tar_target_raw)
Expand Down
8 changes: 7 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
# stantargets 0.1.0.9001 (development)
# stantargets 0.1.1

## Invalidating changes

* To align with https://github.com/ropensci/targets/issues/1244 and https://github.com/ropensci/targets/pull/1262, switch the hashing functions from `digest::digest()` to `secretbase::siphash13()`.

## Other changes

* Remove temporary files generated CmdStan.
* Add the new `description` arguments of `tar_target()` (`targets >= 1.5.1.9001).
Expand Down
6 changes: 3 additions & 3 deletions R/tar_stan_package.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,21 @@
#' @name stantargets-package
#' @seealso <https://docs.ropensci.org/stantargets/>, [tar_stan_mcmc()]
#' @importFrom cmdstanr cmdstan_model
#' @importFrom digest digest
#' @importFrom fs path_ext_remove path_rel
#' @importFrom fst read_fst
#' @importFrom qs qread
#' @importFrom posterior as_draws_df
#' @importFrom purrr map map_dbl map2_dfr
#' @importFrom rlang check_installed expr quo_squash
#' @importFrom secretbase siphash13
#' @importFrom stats rnorm runif
#' @importFrom targets tar_assert_chr tar_assert_nonempty
#' tar_assert_not_dir tar_assert_not_in
#' tar_assert_nzchar tar_assert_path
#' tar_assert_scalar tar_assert_unique
#' tar_cue tar_deparse_safe tar_dir tar_load tar_option_get
#' tar_read tar_script tar_seed_get tar_target tar_target_raw tar_test
#' tar_tidy_eval tar_throw_validate
#' tar_read tar_script tar_seed_create tar_seed_get tar_target
#' tar_target_raw tar_test tar_tidy_eval tar_throw_validate
#' @importFrom tarchetypes tar_combine_raw tar_map
#' @importFrom tidyselect any_of
#' @importFrom withr local_message_sink local_output_sink
Expand Down
2 changes: 1 addition & 1 deletion R/utils_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ produce_seed_rep <- function(name, batch, rep, reps) {
return(NA_integer_)
}
scalar <- paste(name, rep + reps * (batch - 1))
abs(digest::digest2int(as.character(scalar), seed = seed))
abs(targets::tar_seed_create(as.character(scalar), global_seed = seed))
}

list_nonempty <- function(list) {
Expand Down
2 changes: 1 addition & 1 deletion R/utils_output.R
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ tar_stan_output <- function(
)
out <- tibble::as_tibble(out)
out <- tar_stan_output_rep_scalars(out, data, data_copy)
out$.rep <- digest::digest(stats::runif(1), algo = "xxhash32")
out$.rep <- secretbase::siphash13(stats::runif(1))
out$.dataset_id <- data$.dataset_id
out$.seed <- if_any(length(seed) == 1L, seed, list(seed))
out
Expand Down
Loading

0 comments on commit bbdda1b

Please sign in to comment.