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

add option for appending lockfile to reprex #314

Closed
wants to merge 4 commits into from

Conversation

kevinushey
Copy link

This is a speculative PR. When renv_lockfile is set, a lockfile capturing the dependencies of the script is appended to the generated output.

Some open questions:

  1. Do we want to include rmarkdown + its recursive dependencies as part of the lockfile? (Since those are required to generate the reprex.)

  2. Do we have any preferences on the formatting of output? I figured making it easy to copy + paste would be a high priority.

  3. Any other concerns about behavior / configurability we'd like to add or control here?

Closes #313.


print("Hello, renv!")
#> [1] "Hello, renv!"

Created on 2020-02-20 by the reprex package (v0.3.0.9001)

Lockfile
{
  "R": {
    "Version": "3.6.2",
    "Repositories": [
      {
        "Name": "CRAN",
        "URL": "https://cran.rstudio.com"
      }
    ]
  },
  "Packages": {
    "R6": {
      "Package": "R6",
      "Version": "2.4.1",
      "Source": "Repository",
      "Repository": "CRAN",
      "Hash": "292b54f8f4b94669b08f94e5acce6be2"
    },
    "Rcpp": {
      "Package": "Rcpp",
      "Version": "1.0.3",
      "Source": "Repository",
      "Repository": "CRAN",
      "Hash": "f3ca785924863b0e4c8cb23b6a5c75a1"
    },
    "base64enc": {
      "Package": "base64enc",
      "Version": "0.1-3",
      "Source": "Repository",
      "Repository": "CRAN",
      "Hash": "543776ae6848fde2f48ff3816d0628bc"
    },
    "callr": {
      "Package": "callr",
      "Version": "3.4.2",
      "Source": "Repository",
      "Repository": "CRAN",
      "Hash": "d16f6e202179e69c1400cc1f845bfc09"
    },
    "clipr": {
      "Package": "clipr",
      "Version": "0.7.0",
      "Source": "Repository",
      "Repository": "CRAN",
      "Hash": "08cf4045c149a0f0eaf405324c7495bd"
    },
    "digest": {
      "Package": "digest",
      "Version": "0.6.24",
      "Source": "Repository",
      "Repository": "CRAN",
      "Hash": "dc0030cea0d85397ba3ba5b930c82c6a"
    },
    "evaluate": {
      "Package": "evaluate",
      "Version": "0.14",
      "Source": "Repository",
      "Repository": "CRAN",
      "Hash": "ec8ca05cffcc70569eaaad8469d2a3a7"
    },
    "fs": {
      "Package": "fs",
      "Version": "1.3.1",
      "Source": "Repository",
      "Repository": "CRAN",
      "Hash": "0e26be4558dbbc713d7cfe4a4c361f38"
    },
    "glue": {
      "Package": "glue",
      "Version": "1.3.1",
      "Source": "Repository",
      "Repository": "CRAN",
      "Hash": "d4e25697c450c01b202c79ef35694a83"
    },
    "highr": {
      "Package": "highr",
      "Version": "0.8",
      "Source": "Repository",
      "Repository": "CRAN",
      "Hash": "4dc5bb88961e347a0f4d8aad597cbfac"
    },
    "htmltools": {
      "Package": "htmltools",
      "Version": "0.4.0",
      "Source": "Repository",
      "Repository": "CRAN",
      "Hash": "2d7691222f82f41e93f6d30f169bd5e1"
    },
    "jsonlite": {
      "Package": "jsonlite",
      "Version": "1.6.1",
      "Source": "Repository",
      "Repository": "CRAN",
      "Hash": "84b0ee361e2f78d6b7d670db9471c0c5"
    },
    "knitr": {
      "Package": "knitr",
      "Version": "1.28",
      "Source": "Repository",
      "Repository": "CRAN",
      "Hash": "915a6f0134cdbdf016d7778bc80b2eda"
    },
    "magrittr": {
      "Package": "magrittr",
      "Version": "1.5",
      "Source": "Repository",
      "Repository": "CRAN",
      "Hash": "1bb58822a20301cee84a41678e25d9b7"
    },
    "markdown": {
      "Package": "markdown",
      "Version": "1.1",
      "Source": "Repository",
      "Repository": "CRAN",
      "Hash": "61e4a10781dd00d7d81dd06ca9b94e95"
    },
    "mime": {
      "Package": "mime",
      "Version": "0.9",
      "Source": "Repository",
      "Repository": "CRAN",
      "Hash": "e87a35ec73b157552814869f45a63aa3"
    },
    "processx": {
      "Package": "processx",
      "Version": "3.4.2",
      "Source": "Repository",
      "Repository": "CRAN",
      "Hash": "20a082f2bde0ffcd8755779fd476a274"
    },
    "ps": {
      "Package": "ps",
      "Version": "1.3.2",
      "Source": "Repository",
      "Repository": "CRAN",
      "Hash": "98777535b61c57d1749344345e2a4ccd"
    },
    "renv": {
      "Package": "renv",
      "Version": "0.9.3-28",
      "Source": "GitHub",
      "RemoteType": "github",
      "RemoteHost": "api.github.com",
      "RemoteUsername": "rstudio",
      "RemoteRepo": "renv",
      "RemoteRef": "master",
      "RemoteSha": "a94bc1eb94874cd6b6662420b58c28dd48b75ed7",
      "Hash": "f59f1c023fe7d3f9636f445d92ad247e"
    },
    "reprex": {
      "Package": "reprex",
      "Version": "0.3.0.9001",
      "Source": "Repository",
      "Repository": "CRAN",
      "Hash": "21563e18f3234aec27a0e1c62c12cf5c"
    },
    "rlang": {
      "Package": "rlang",
      "Version": "0.4.4",
      "Source": "Repository",
      "Repository": "CRAN",
      "Hash": "09a36f36a13436be327dad3d000c8dd3"
    },
    "rmarkdown": {
      "Package": "rmarkdown",
      "Version": "2.1",
      "Source": "Repository",
      "Repository": "CRAN",
      "Hash": "9d1c61d476c448350c482d6664e1b28b"
    },
    "stringi": {
      "Package": "stringi",
      "Version": "1.4.6",
      "Source": "Repository",
      "Repository": "CRAN",
      "Hash": "e99d8d656980d2dd416a962ae55aec90"
    },
    "stringr": {
      "Package": "stringr",
      "Version": "1.4.0",
      "Source": "Repository",
      "Repository": "CRAN",
      "Hash": "0759e6b6c0957edb1311028a49a35e76"
    },
    "tinytex": {
      "Package": "tinytex",
      "Version": "0.19",
      "Source": "Repository",
      "Repository": "CRAN",
      "Hash": "b1c0c22cab714ec9ce9472a8073b6922"
    },
    "withr": {
      "Package": "withr",
      "Version": "2.1.2",
      "Source": "Repository",
      "Repository": "CRAN",
      "Hash": "aa57ed55ff2df4bea697a07df528993d"
    },
    "xfun": {
      "Package": "xfun",
      "Version": "0.12",
      "Source": "Repository",
      "Repository": "CRAN",
      "Hash": "ccd8453a7b9e380628f6cd2862e46cad"
    },
    "yaml": {
      "Package": "yaml",
      "Version": "2.2.1",
      "Source": "Repository",
      "Repository": "CRAN",
      "Hash": "2826c5d9efb0a88f657c7a679c7106db"
    }
  }
}
Lockfile generated by [the renv package](https://rstudio.github.io/renv/) (v0.9.3.28)

@wlandau
Copy link

wlandau commented Feb 21, 2020

After highlighting and copying the lockfile in the example, I appreciate #313 (comment) even more. A couple thoughts:

  • Maybe we could insert an inline clipboard button in the R Markdown? klippy seems lightweight as a dependency (except for stringi, which reprex depends on through glue anyway). Could be a long shot though. Not sure if GitHub-flavored Markdown will pick it up.
  • What if the renv_lockfile argument had choices "none", "inline", and "gist"?

@wlandau
Copy link

wlandau commented Feb 21, 2020

I think I spoke too soon about klippy specifically. It is not on CRAN (yet) and the klippy button requires the document to be rendered to HTML.

@jennybc
Copy link
Member

jennybc commented Feb 21, 2020

This looks really interesting. Just want to check in before I return to my current project (googlesheets4/gargle releaeses). I can't dig in to this now but will before next reprex release.

@kevinushey
Copy link
Author

Notes for myself: it seems like (for R invoked from the console?) we need to ensure that we move to the reprex tempdir before invoking renv's APIs.

@jennybc
Copy link
Member

jennybc commented Jan 15, 2021

Closing, explanation in #313.

@jennybc jennybc closed this Jan 15, 2021
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

Successfully merging this pull request may close these issues.

Option to generate an renv lockfile to go with a reprex
3 participants