Skip to content

Commit

Permalink
More work on release procedure
Browse files Browse the repository at this point in the history
  • Loading branch information
schuemie committed Oct 11, 2023
1 parent 3b06636 commit e768143
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 46 deletions.
4 changes: 3 additions & 1 deletion extras/Releasing/PackageCheckFunctions.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ checkPackage <- function(package, inCran) {
sourcePackage <- remotes::download_version(package, type = "source")
on.exit(unlink(sourcePackage))
} else {
sourcePackage <- remotes::remote_download(remotes::github_remote(sprintf("%s/%s", gitHubOrganization, package)))
ref <- sprintf("v%s", packageVersion(package))
sourcePackage <- remotes::remote_download(remotes::github_remote(repo = sprintf("%s/%s", gitHubOrganization, package), ref = ref))
on.exit(unlink(sourcePackage))
}
sourceFolder <- tempfile(pattern = package)
Expand All @@ -51,6 +52,7 @@ checkPackage <- function(package, inCran) {
if (dir.exists(docDir)) {
unlink(docDir, recursive = TRUE)
}
# devtools::check_built(path = sourcePath)
rcmdcheck::rcmdcheck(path = sourcePath, args = c("--no-manual", "--no-multiarch"), error_on = "warning")
}

Expand Down
10 changes: 4 additions & 6 deletions extras/Releasing/RunCheckOnAllHadesPackages.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,15 @@

install.packages("rcmdcheck")

reticulate::use_virtualenv("r-reticulate")

source("PackageCheckFunctions.R")
saveRDS(prepareForPackageCheck(), "Dependencies.rds")
dependencies <- readRDS("Dependencies.rds")
# Skipping Hydra, as renv seems to clash with skeleton renv environments:
dependencies <- dependencies[dependencies$name != "Hydra", ]
for (i in 25:nrow(dependencies)) {
if (dependencies$name[i] == "CohortGenerator") {
# Delete RedShift files from JDBC drivers folder, at least until this is released: https://github.com/OHDSI/DatabaseConnector/commit/c7e3e9b8dab2b04bebadfcf34f2049a23de66dac
toDelete <- list.files(Sys.getenv("DATABASECONNECTOR_JAR_FOLDER"), "Redshift", full.names = TRUE)
unlink(toDelete, force = TRUE)
}
for (i in 1:nrow(dependencies)) {
checkPackage(package = dependencies$name[i], inCran = dependencies$inCran[i])

}
unlink("Dependencies.rds")
53 changes: 14 additions & 39 deletions extras/Releasing/SetupPython.R
Original file line number Diff line number Diff line change
@@ -1,42 +1,17 @@
# Code to work around renv bugs relating to Python
# Code to install Python dependencies. Does not use conda as it was throwing inexplicable errors

# Install all required dependencies --------------------------------------------
packages <- c("scikit-survival","numpy","scipy","scikit-learn", "pandas","pydotplus","joblib", "sklearn-json")
reticulate::conda_install(
envname='base',
packages = packages,
forge = TRUE,
pip = FALSE,
pip_ignore_installed = TRUE,
conda = "auto"
)
reticulate::conda_install(
envname='r-reticulate',
packages = packages,
forge = TRUE,
pip = FALSE,
pip_ignore_installed = TRUE,
conda = "auto"
)
reticulate::use_condaenv("base")
torch::install_torch()
reticulate::use_condaenv("r-reticulate")
torch::install_torch()
# Install packages needed by PatientLevelPrediction ----------------------------
PatientLevelPrediction::configurePython(envname = 'r-reticulate', envtype = "python")
reticulate::use_virtualenv("r-reticulate")
# Test: np <- reticulate::import('numpy')

# Copy Python from global to renv ----------------------------------------------
# Packages needed by DeepPatientLevelPrediction --------------------------------
reticulate::py_install(c("polars", "tqdm", "connectorx", "scikit-learn", "pyarrow"))
reticulate::py_install("torch")
# Test: torch <- reticulate::import('torch')
pyarrow <- reticulate::import('pyarrow')

# Under some (poorly understood) circumstances, reticulate creates a duplicate
# r-reticulate environment. Use this code to copy all libraries from the main one
# to the new one:
envs <- reticulate::conda_list()
envs <- envs[envs$name == 'r-reticulate', ]
message(sprintf("Good r-reticulate: %s", envs$python[1]))
message(sprintf("Evil r-reticulate: %s", envs$python[2]))
# TODO: this somehow creates a r-reticulate folder in the r-reticulate folder. Need to fix
unlink(dirname(envs$python[2]), recursive = TRUE)
dir.create(dirname(envs$python[2]))
file.copy(
from = dirname(envs$python[1]),
to = dirname(envs$python[2]),
recursive = TRUE
)
# reticulate::virtualenv_remove("r-reticulate")

reticulate::virtualenv_list()
reticulate::virtualenv_root()

0 comments on commit e768143

Please sign in to comment.