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

checkout with action "snapshot" does not generate the standard renv snapshot #1969

Closed
kieranjmartin opened this issue Aug 15, 2024 · 1 comment

Comments

@kieranjmartin
Copy link

R4.3.1 and renv 1.07.

I start with a repo with a lock file with just renv currently recorded, and add an R script with library(abc) (library doesn't matter for this, just picked a package with a smaller dependency footprint)

Running
renv::checkout("https://packagemanager.posit.co/cran/2024-08-14", actions = c("restore", "snapshot"))

Generates a lockfile which looks like this:

{
  "R": {
    "Version": "4.3.1",
    "Repositories": [
      {
        "Name": null,
        "URL": "https://packagemanager.posit.co/cran/2024-08-14"
      }
    ]
  },
  "Packages": {
    "KernSmooth": {
      "Package": "KernSmooth",
      "Version": "2.23-24",
      "Source": "Repository"
    },
    "MatrixModels": {
      "Package": "MatrixModels",
      "Version": "0.5-3",
      "Source": "Repository"
    },
{rest expunged}

Now I run renv::snapshot()

{
  "R": {
    "Version": "4.3.1",
    "Repositories": [
      {
        "Name": "CRAN",
        "URL": "https://packagemanager.posit.co/cran/2024-08-14"
      }
    ]
  },
  "Packages": {
    "MASS": {
      "Package": "MASS",
      "Version": "7.3-60",
      "Source": "Repository",
      "Repository": "RSPM",
      "Requirements": [
        "R",
        "grDevices",
        "graphics",
        "methods",
        "stats",
        "utils"
      ],
      "Hash": "a56a6365b3fa73293ea8d084be0d9bb0"
    },
    "Matrix": {
      "Package": "Matrix",
      "Version": "1.6-1.1",
      "Source": "Repository",
      "Repository": "RSPM",
      "Requirements": [
        "R",
        "grDevices",
        "graphics",
        "grid",
        "lattice",
        "methods",
        "stats",
        "utils"
      ],
      "Hash": "1a00d4828f33a9d690806e98bd17150c"
    },

Note that the new version has the hash and the dependency tree described.

As far as I can tell this isn't a huge problem; the initial snapshot will work if you are using rspm (as renv gets the correct dependency order during download anyway). (Although as a note I lost kernmooth as a dependency when I made this reprex... I don't know why that happened!).

However I think probably I expect that if I run checkout with snapshot as an action I should get identical results to running checkout then running snapshot. Right now this doesn't seem to be what happens.

@kevinushey
Copy link
Collaborator

Thanks for the bug report! This should now be better handled in the development version of renv.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants