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

RC 0.2.3 #235

Merged
merged 3 commits into from
Aug 14, 2023
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 DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: vetiver
Title: Version, Share, Deploy, and Monitor Models
Version: 0.2.2.9000
Version: 0.2.3
Authors@R: c(
person("Julia", "Silge", , "[email protected]", role = c("cre", "aut"),
comment = c(ORCID = "0000-0002-3671-836X")),
Expand Down
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# vetiver (development version)
# vetiver 0.2.3

* Updated test involving renv and rsconnect (#230).

Expand Down
4 changes: 2 additions & 2 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
## Release Summary

This is the 12th CRAN release of vetiver. This release removes a usage of `getRversion()` as instructed by CRAN, as well as fixing a Docker-related bug and adding a new endpoint for vetiver model APIs.
This is the 13th CRAN release of vetiver. This release fixes a test that uses renv and rsconnect and updates the test setup for when Python is not available.

## revdepcheck results

We checked 1 reverse dependencies, comparing R CMD check results across CRAN and dev versions of this package.
We checked 1 reverse dependency, comparing R CMD check results across CRAN and dev versions of this package.

* We saw 0 new problems
* We failed to check 0 packages
33 changes: 22 additions & 11 deletions tests/testthat/setup.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,28 @@ options(pins.quiet = TRUE)
options(renv.verbose = FALSE)

clean_python_tmp_dir <- function() {
if (rlang::is_installed("reticulate")) {
python_temp_dir <- dirname(reticulate::py_run_string(
"import tempfile; x=tempfile.NamedTemporaryFile().name",
local = TRUE
)$x)
detritus <- fs::dir_ls(
python_temp_dir,
regexp = "__autograph_generated_file|__pycache__"
)
fs::file_delete(detritus)
}
if (!rlang::is_installed("reticulate"))
return()

if(!reticulate::py_available())
return()

tryCatch(
error = function(cnd) {
cli::cli_inform("Cannot clean Python temp directory: {cnd}")
},
{
python_temp_dir <- dirname(reticulate::py_run_string(
"import tempfile; x=tempfile.NamedTemporaryFile().name",
local = TRUE
)$x)
detritus <- fs::dir_ls(
python_temp_dir,
regexp = "__autograph_generated_file|__pycache__"
)
fs::file_delete(detritus)
}
)
}

withr::defer(clean_python_tmp_dir(), teardown_env())
11 changes: 10 additions & 1 deletion tests/testthat/test-pin-read-write.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
skip_if_not_installed("mockery")

test_that("can pin a model", {
b <- board_temp()
v <- vetiver_model(cars_lm, "cars1")
Expand Down Expand Up @@ -128,7 +130,14 @@ test_that("can read a versioned model with metadata", {

test_that("right message for reading with `check_renv`", {
skip_on_cran()
b <- board_temp()

b <- board_temp(versioned = TRUE)
mock_version_name <- mockery::mock(
"20130104T050607Z-xxxxx",
"20130204T050607Z-yyyyy",
"20130304T050607Z-zzzzz",
)
local_mocked_bindings(version_name = mock_version_name, .package = "pins")
v <- vetiver_model(cars_lm, "cars5")
v$metadata$required_pkgs <- "janeaustenr"
vetiver_pin_write(b, v)
Expand Down
6 changes: 4 additions & 2 deletions tests/testthat/test-xgboost.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ test_that("can print xgboost model", {
})

test_that("can predict xgboost model", {
preds <- predict(v, as.matrix(mtcars[,-1]))
cars_matrix <- as.matrix(mtcars[,-1])
preds <- predict(v, cars_matrix)
expect_equal(length(preds), 32)
expect_equal(mean(preds), 12.7, tolerance = 0.1)
preds2 <- predict(cars_xgb, cars_matrix)
expect_equal(preds, preds2)
})


Expand Down