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

Describe/develop process for using github packages #221

Open
zkamvar opened this issue Dec 16, 2021 · 1 comment
Open

Describe/develop process for using github packages #221

zkamvar opened this issue Dec 16, 2021 · 1 comment
Labels
package cache Related to the {renv} package cache

Comments

@zkamvar
Copy link
Contributor

zkamvar commented Dec 16, 2021

Right now, it's not clear how to auto-detect GitHub-only packages in {renv} outside of a DESCRIPTION file. I would like to not add a description file to the mix because that will add more confusion for lesson authors.

Right now, if there is a lesson with the https://github.com/weecology/ratdat package being used, it will give the following error:

sandpaper::build_lesson()
ℹ No schedule set, using Rmd files in episodes/ directory.To remove this message, define your schedule in config.yaml or use `set_episodes()` to generate it.Consent to use package cache providedSearching for and installing available dependencies
Done!ng R package dependencies ...Restoring any dependency versions
* The library is already synchronized with the lockfile.Recording changes in lockfile
The following package(s) were installed from an unknown source:
         _
  ratdat   [0.1.0]

renv may be unable to restore these packages in the future.
Consider reinstalling these packages from a known source (e.g. CRAN).

Error: callr subprocess failed: aborting snapshot due to pre-flight validation failure
Type .Last.error.trace to see where the error occurred
|> .Last.error.trace

 Stack trace:

 Process 15025:
 1. sandpaper::build_lesson()
 2. sandpaper:::build_markdown(path = path, rebuild = rebuild, quiet = quiet,  ...
 3. sandpaper:::renv_check_consent(path, quiet, sources)
 4. sandpaper:::manage_deps(path, snapshot = TRUE, quiet = quiet)
 5. callr::r(func = callr_manage_deps, args = args, show = !quiet,  ...
 6. callr:::get_result(output = out, options)
 7. throw(newerr, parent = remerr[[2]])

 x callr subprocess failed: aborting snapshot due to pre-flight validation failure 

 Process 15092:
 19. (function (path, repos, snapshot, lockfile_exists)  ...
 20. renv::snapshot(project = path, lockfile = renv_lock, prompt = FALSE)
 21. base:::stop("aborting snapshot due to pre-flight validation failure")
 22. base:::.handleSimpleError(function (e)  ...
 23. h(simpleError(msg, call))

 x aborting snapshot due to pre-flight validation failure

The solution is to use sandpaper::pin_version("weecology/ratdat"), but there should be a better way to include this.

@zkamvar zkamvar added the package cache Related to the {renv} package cache label Jan 26, 2022
@zkamvar
Copy link
Contributor Author

zkamvar commented Oct 24, 2023

There is currently another wrinkle to this saga:

If a GitHub package does not exist on a system, then it cannot be provisioned by {sandpaper} (see carpentries/actions#32 (comment))

This is because when we search for packages that need to be hydrated, we use renv::dependencies(), which just reports package names, not provenance:

sandpaper/R/utils-renv.R

Lines 245 to 252 in fbf1fa2

if (lockfile_exists) {
# if there _is_ a lockfile, we only want to hydrate new packages that do not
# previously exist in the library, because otherwise, we end up trying to
# install packages that we should be able to install with renv::restore().
installed <- utils::installed.packages(lib.loc = renv_lib)[, "Package"]
deps <- unique(renv::dependencies(path = path, root = path, dev = TRUE)$Package)
pkgs <- setdiff(deps, installed)
needs_hydration <- length(pkgs) > 0

The solution would be to exclude packages that already exist in the lockfile for hydration.

csmagnano added a commit to carpentries-incubator/bioc-scrnaseq that referenced this issue Feb 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package cache Related to the {renv} package cache
Projects
None yet
Development

No branches or pull requests

1 participant