Git Product home page Git Product logo

holepunch's Introduction

Hole punch

R build status

Coveralls test coverage Lifecycle: maturing CRAN status

What this package does

holepunch will read the contents of your R project on GitHub, create a DESCRIPTION file with all dependencies, write a Dockerfile, add a badge to your README, and build a Docker image. Once these 4 steps are complete, any reader can click the badge and within minutes, be dropped into a free, live, RStudio server. Here they can run your scripts and notebooks and see how everything works.

Motivation

Binder is an open source project that can take any most GitHub repos of notebooks (R or Jupyter) and turn them into a free, live instance that not only has all dependencies ready to go but also provides Jupyter or Rstudio server to run the code on. The instances are small and should not be used to demonstrate resource intensive computation. However they are ideal for reproducing papers/figures/examples and make a great addition to any public analysis project that is being hosted on GitHub.

binder-bam

Why this is awesome

  • You can launch a free instance of Rstudio server from any of your projects on GitHub. The instance will have all of your dependencies and version of R installed and ready to go!
  • Easily allow anyone (up to 100 simultaneous users) to replicate or modify your analysis
  • Free

Limitations

  • The server has limited memory so you cannot load large datasets or run big computations
  • Binder is meant for interactive and ephemeral interactive coding so an instance will die after 10 minutes of inactivity.
  • An instance cannot be kept alive for more than 12 hours

Installation

remotes::install_github("karthik/holepunch")
# Please report any installation problems in the issues

Setting up your project as a compendium (recommended)

If you are unfamiliar with the idea of research compendia, I highly recommend reading this paper by Marwick et al:

Marwick B, Boettiger C, Mullen L. 2018. Packaging data analytical work reproducibly using R (and friends) PeerJ Preprints 6:e3192v2 https://doi.org/10.7287/peerj.preprints.3192v2

and also looking through my presentation at RStudio::conf 2019 where I talk about this in detail.

library(holepunch)
write_compendium_description(package = "Your compendium name", 
                             description = "Your compendium description")
# to write a description, with dependencies. Be sure to fill in placeholder text

write_dockerfile(maintainer = "your_name") 
# To write a Dockerfile. It will automatically pick the date of the last 
# modified file, match it to that version of R and add it here. You can 
# override this by passing r_date to some arbitrary date
# (but one for which a R version exists).

generate_badge() # This generates a badge for your readme.

# ----------------------------------------------
# At this time 🙌 push the code to GitHub 🙌
# ----------------------------------------------

# And click on the badge or use the function below to get the build 
# ready ahead of time.
build_binder()
# 🤞🚀

Alternate setup method

If for some reason you really don't want to set up your project as a compendium, then set it up by creating runtime.txt and install.R. This build will take a very long time.

# Note that this particular approach will be super slow.
# And take just as long everytime you edit your code
library(holepunch)
write_install() # Writes install.R with all your dependencies
write_runtime() # Writes the date your code was last modified. Can be overridden.
generate_badge() # Generates a badge you can add to your README. Clicking badge will launch the Binder.
# ----------------------------------------------
# At this time 🙌 push the code to GitHub 🙌
# ----------------------------------------------
# Then click the badge on your README or run
build_binder() # to kick off the build process
# 🤞🚀

Testing this package

An easy way to test this package without writing any code is to visit the binder-test repo and follow the instructions.

Roadmap

The ETA for the first release of this package is fall 2019 (after renv goes to CRAN). Comments, suggestions for improving the workflow or any other comments welcome in the issues. Other planned features include:

  • Full support for GitHub packages
  • Support for Bioconductor packages
  • Reference Binders to separate environment from code (still in early planning)

Code of conduct

Please note that the 'holepunch' project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

holepunch's People

Contributors

annakrystalli avatar betatim avatar choldgraf avatar denironyx avatar imgbotapp avatar karthik avatar setgree avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

holepunch's Issues

Correctly guess maintainer

The user now defaults to "karthik" whereas before it was correctly guessing "Anna" for me. Now have to remember to set this manually.

From #8

Link to repo2docker for running locally

It would be good to mention that people can already run their work locally before making it public or when they need more resources by using https://repo2docker.readthedocs.io/ which is the tech used on a BinderHub.

The advantage is that you are adding reproducibility from day one, not as an after thought when "everything is done now, just need to make it reproducible".

Non-R system requirements

holepunch is magical! I am using it for https://github.com/wlandau/learndrake, and it makes the workshop materials so much more accessible.

The setup was mostly smooth, but I hit a snag because of the dependency on TensorFlow. rocker/binder omits TensorFlow (and rightly so) so learndrake's own Dockerfile borrows heavily from rocker/tensorflow. It works now, but it took some micromanaging to go through apt-get and pip3 and make sure to invoke the correct user for each.

I an wondering if we can or should do anything in holepunch's API to abstract away this sort of thing. Maybe have arguments in holepunch::write_dockerfile() to supply apt and python dependencies? Or maybe a .holepunch.yml file that borrows from .travis.yml?

libsbml

Hi,
I am trying to punch-up an R script that uses libsbml to run. As I understand it, libsbml must be installed in the system (via apt or whatever) and then I also need the R bindings, which according to official guides have to be installed using R CMD, e.g.

R CMD INSTALL libSBML_5.18.0.tar.gz

How do I make that happen in the Docker image?
I guess, maybe the apt command from an earlier issue would help:

write_apt(apt_input = "libsbml5 libsbml5-dev")

But, since there is no official libsbml5-R package, the R bindings will be tricky to get, right? Do you have any advice?

Remote packages not recognized

First is first:

Thanks so much for the holepunch package! It's a awesome :-) 🥇

I didn't actually experience this bug, but I read through the source code of write_compendium_description() and found, what I believe is a typo:

if (length(remote_pkgs > 0)) {

As I understand it, this line is always false. It should be

if (length(remote_pkgs) > 0) { 

Best,
Sebastian

binder fails if holepunch is used from a non-master branch

I followed the instructions (I think) and ended up with a .binder/Dockerfile like so:

FROM rocker/binder:3.6.0
LABEL maintainer='Unknown'
USER root
COPY . ${HOME}
RUN chown -R ${NB_USER} ${HOME}
USER ${NB_USER}
RUN wget https://github.com/hughjonesd/GSV-comment/raw/master/DESCRIPTION && R -e "options(repos = list(CRAN = 'http://mran.revolutionanalytics.com/snapshot/2019-08-17/')); devtools::install_deps()"

However, when I click the binder button on my README, I get first a long long log scrolling by, then a 404.

New to binder, so not sure what I am really doing... my goal would be to reproduce the paper in my github file GSV-comment.Rmd, I guess!

My files can be found in the "binder" branch of https://github.com/hughjonesd/GSV-comment.

Normalize arugments

Right now write_comependium_description uses Type, Package, Description, Version and path. They need to be case consistent.

write_compendium_description duplicates

When running the write_compendium_description multiple times if I ask it to overwrite the pre-existing DESCRIPTION file package dependencies are being added each time so it's duplicating the list of packages.
So working through the tutorial if I run the function three times I get the the following in my DESCRIPTION file

Type: Compendium
Package: Jess's-awesome-compendium
Title: What the Package Does (One Line, Title Case)
Version: 0.0.1
Authors@R: 
    person(given = "First",
           family = "Last",
           role = c("aut", "cre"),
           email = "[email protected]",
           comment = c(ORCID = "YOUR-ORCID-ID"))
Description: A wonderful compendium
License: What license it uses
Depends: 
    dataRetrieval,
    dataRetrieval,
    dataRetrieval,
    dplyr,
    dplyr,
    dplyr,
    ggplot2,
    ggplot2,
    ggplot2,
    lubridate,
    lubridate,
    lubridate,
    tidyr,
    tidyr,
    tidyr,
    viridis,
    viridis,
    viridis
Encoding: UTF-8
LazyData: true

Improve build_binder print

Finally very minor comment re: current print out of the build log messages. At the minute they are just being printed off as a list which can be hard to follow (see below). A completely non-essential enhancement could be to translate those into visually more accessible format. But certainly not a priority.

From #8

Binder doesn't work due to old branch names

I used generate_badge() to add a binder badge to my repo, however when clicking it binder gave the following error:

Could not resolve ref for gh:paulmaunders/coronavirus-graphs/master. Double check your URL. GitHub recently changed default branches from "master"to "main". Did you mean the "main" branch?

Updating the badge link to main helped, but then I encountered another error:

Resolving github.com (github.com)... 140.82.114.4
Connecting to github.com (github.com)|140.82.114.4|:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2020-12-31 17:43:32 ERROR 404: Not Found.

So it looks like the references to master in the DockerFile need updating too.

[Enhancement] Add R version as a parameter to write_docker

Hi love the package, just one request - add r_version to write_dockerfile to allow user to specify the version of R they want to use, as opposed to using date to look up version. Useful if you don't know when a specific R version was published (/ to lazy to look it ups ;) ). I can make a pull request if you agree

Parsing of wget line in write_dockerfile incorrect

Hello Karthik! 👋

When running write_dockerfile() on my system, the wget line is parsed over 2 lines like so:

RUN wget https://github.com/annakrystalli/rrcompendium/raw/master/DESCRIPTION &&
R -e "devtools::install_deps()"

And launching binder fails.

However binder launches if that's corrected it to a single line, ie:

RUN wget https://github.com/annakrystalli/rrcompendium/raw/master/DESCRIPTION && R -e "devtools::install_deps()"

Check the repo I'm working here if interested: https://github.com/annakrystalli/rrcompendium

Session info ------------------------------------------------------------------------------------------------
 setting  value                       
 version  R version 3.5.2 (2018-12-20)
 system   x86_64, darwin15.6.0        
 ui       RStudio (1.1.463)           
 language (EN)                        
 collate  en_GB.UTF-8                 
 tz       Europe/London               
 date     2019-03-18                  

Packages ----------------------------------------------------------------------------------------------------
 package        * version    date       source                                  
 assertthat       0.2.0      2017-04-11 CRAN (R 3.5.0)                          
 backports        1.1.3      2018-12-14 CRAN (R 3.5.0)                          
 base           * 3.5.2      2018-12-22 local                                   
 compiler         3.5.2      2018-12-22 local                                   
 containerit      0.5.0.9004 2019-02-28 Github (o2r-project/containerit@42c89ed)
 crayon           1.3.4      2017-09-16 CRAN (R 3.5.0)                          
 curl             3.3        2019-01-10 CRAN (R 3.5.2)                          
 datasets       * 3.5.2      2018-12-22 local                                   
 desc             1.2.0      2018-05-01 CRAN (R 3.5.0)                          
 devtools       * 1.13.6     2018-06-27 CRAN (R 3.5.0)                          
 digest           0.6.18     2018-10-10 CRAN (R 3.5.0)                          
 formatR          1.5        2017-04-25 cran (@1.5)                             
 fs               1.2.6      2018-08-23 CRAN (R 3.5.0)                          
 futile.logger    1.4.3      2016-07-10 cran (@1.4.3)                           
 futile.options   1.0.1      2018-04-20 cran (@1.0.1)                           
 gh               1.0.1      2017-07-16 CRAN (R 3.5.0)                          
 glue             1.3.1      2019-03-14 Github (tidyverse/glue@f356a12)         
 graphics       * 3.5.2      2018-12-22 local                                   
 grDevices      * 3.5.2      2018-12-22 local                                   
 holepunch        0.0.3.9000 2019-02-28 Github (karthik/holepunch@9d78c01)      
 httr             1.4.0      2018-12-11 CRAN (R 3.5.0)                          
 ini              0.3.1      2018-05-20 CRAN (R 3.5.0)                          
 jsonlite         1.6        2018-12-07 CRAN (R 3.5.0)                          
 lambda.r         1.2.3      2018-05-17 cran (@1.2.3)                           
 magrittr         1.5        2014-11-22 CRAN (R 3.5.0)                          
 memoise          1.1.0      2017-04-21 CRAN (R 3.5.0)                          
 methods        * 3.5.2      2018-12-22 local                                   
 R6               2.4.0      2019-02-14 CRAN (R 3.5.2)                          
 Rcpp             1.0.0      2018-11-07 CRAN (R 3.5.0)                          
 requirements     0.0.0.9000 2019-02-28 Github (hadley/requirements@79ed4cc)    
 rlang            0.3.1      2019-01-08 CRAN (R 3.5.2)                          
 rprojroot        1.3-2      2018-01-03 CRAN (R 3.5.0)                          
 rstudioapi       0.9.0      2019-01-09 CRAN (R 3.5.2)                          
 semver           0.2.0      2017-01-06 cran (@0.2.0)                           
 stats          * 3.5.2      2018-12-22 local                                   
 stevedore        0.9.1      2019-01-02 cran (@0.9.1)                           
 stringi          1.3.1      2019-02-13 CRAN (R 3.5.2)                          
 stringr          1.4.0      2019-02-10 CRAN (R 3.5.2)                          
 tools            3.5.2      2018-12-22 local                                   
 usethis        * 1.4.0      2018-08-14 CRAN (R 3.5.0)                          
 utils          * 3.5.2      2018-12-22 local                                   
 withr            2.1.2      2018-03-15 CRAN (R 3.5.0)                          
 yaml             2.2.0      2018-07-25 CRAN (R 3.5.0)       

Fix versions by default

I suggest that by default hole punch fix versions for R and packages and print an informative message for packages used. This would involve:

  • Picking the appropriate Rocker base based on local R version.
  • Using a runtime.txt to fix the MRAN date
  • Identify non-CRAN packages and set appropriate fixed-version Remotes.

write_install includes duplicate packages

What I observed

When multiple files import the same package, the file install.R created by write_install() runs install.packages() multiple times.

What I expected

I expected that each package used in a project would be installed once in install.R.

Reproducible example

packageVersion("holepunch")
#> [1] '0.1.26.9000'
packageVersion("renv")
#> [1] '0.9.2'

d <- tempfile()
dir.create(d)
f1 <- file.path(d, "f1.R")
writeLines(c("library(rmarkdown)", "library(knitr)"), con = f1)
f2 <- file.path(d, "f2.R")
writeLines("library(rmarkdown)", con = f2)
renv::dependencies(d)
#> Finding R package dependencies ... Done!
#>                                  Source   Package Require Version   Dev
#> 1 /tmp/RtmpaLehvK/file266e481c0b2e/f1.R     knitr                 FALSE
#> 2 /tmp/RtmpaLehvK/file266e481c0b2e/f1.R rmarkdown                 FALSE
#> 3 /tmp/RtmpaLehvK/file266e481c0b2e/f2.R rmarkdown                 FALSE
holepunch::get_dependencies(d)
#> Finding R package dependencies ... Done!
#> [1] "knitr"     "rmarkdown" "rmarkdown"
holepunch::write_install(d)
#> Finding R package dependencies ... Done!
#> ✔ Writing '/tmp/RtmpaLehvK/file266e481c0b2e/.binder/install.R'
install <- file.path(d, ".binder", "install.R")
readLines(install)
#> [1] "install.packages('knitr')"     "install.packages('rmarkdown')"
#> [3] "install.packages('rmarkdown')"

Created on 2020-03-01 by the reprex package (v0.3.0.9000)

Session info
sessioninfo::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#>  setting  value                       
#>  version  R version 3.6.3 (2020-02-29)
#>  os       Ubuntu 18.04.4 LTS          
#>  system   x86_64, linux-gnu           
#>  ui       X11                         
#>  language (EN)                        
#>  collate  en_US.UTF-8                 
#>  ctype    en_US.UTF-8                 
#>  tz       America/New_York            
#>  date     2020-03-01                  
#> 
#> ─ Packages ───────────────────────────────────────────────────────────────────
#>  package     * version     date       lib source                            
#>  assertthat    0.2.1       2019-03-21 [3] CRAN (R 3.5.3)                    
#>  backports     1.1.5       2019-10-02 [3] CRAN (R 3.6.1)                    
#>  cli           2.0.2       2020-02-28 [3] CRAN (R 3.6.3)                    
#>  cliapp        0.1.0       2018-12-16 [1] CRAN (R 3.6.1)                    
#>  clisymbols    1.2.0       2017-05-21 [3] CRAN (R 3.5.1)                    
#>  crayon        1.3.4       2017-09-16 [3] CRAN (R 3.5.0)                    
#>  desc          1.2.0       2018-05-01 [3] CRAN (R 3.5.0)                    
#>  digest        0.6.25      2020-02-23 [3] CRAN (R 3.6.3)                    
#>  evaluate      0.14        2019-05-28 [3] CRAN (R 3.6.0)                    
#>  fansi         0.4.1       2020-01-08 [3] CRAN (R 3.6.2)                    
#>  fs            1.3.1.9000  2020-01-08 [1] Github (r-lib/fs@2fb543e)         
#>  gh            1.1.0       2020-01-24 [3] CRAN (R 3.6.2)                    
#>  glue          1.3.1       2019-03-12 [3] CRAN (R 3.5.3)                    
#>  highr         0.8         2019-03-20 [3] CRAN (R 3.5.3)                    
#>  hms           0.5.3       2020-01-08 [3] CRAN (R 3.6.2)                    
#>  holepunch     0.1.26.9000 2020-02-28 [1] Github (karthik/holepunch@0eec31c)
#>  htmltools     0.4.0       2019-10-04 [3] CRAN (R 3.6.1)                    
#>  httr          1.4.1       2019-08-05 [3] CRAN (R 3.6.1)                    
#>  jsonlite      1.6.1       2020-02-02 [3] CRAN (R 3.6.2)                    
#>  knitr         1.28        2020-02-06 [3] CRAN (R 3.6.2)                    
#>  lubridate     1.7.4       2018-04-11 [3] CRAN (R 3.5.0)                    
#>  magrittr      1.5         2014-11-22 [3] CRAN (R 3.5.0)                    
#>  pkgconfig     2.0.3       2019-09-22 [3] CRAN (R 3.6.1)                    
#>  prettyunits   1.1.1       2020-01-24 [3] CRAN (R 3.6.2)                    
#>  progress      1.2.2       2019-05-16 [3] CRAN (R 3.6.0)                    
#>  R6            2.4.1       2019-11-12 [3] CRAN (R 3.6.1)                    
#>  Rcpp          1.0.3       2019-11-08 [3] CRAN (R 3.6.1)                    
#>  renv          0.9.2       2019-12-09 [1] CRAN (R 3.6.2)                    
#>  reprex        0.3.0.9000  2019-07-19 [1] local                             
#>  rlang         0.4.4       2020-01-28 [3] CRAN (R 3.6.2)                    
#>  rmarkdown     2.1         2020-01-20 [1] CRAN (R 3.6.2)                    
#>  rprojroot     1.2         2017-01-16 [3] CRAN (R 3.5.0)                    
#>  selectr       0.4-2       2019-11-20 [3] CRAN (R 3.6.1)                    
#>  sessioninfo   1.1.1       2018-11-05 [3] CRAN (R 3.5.1)                    
#>  stringi       1.4.6       2020-02-17 [3] CRAN (R 3.6.2)                    
#>  stringr       1.4.0       2019-02-10 [3] CRAN (R 3.5.2)                    
#>  usethis       1.5.1.9000  2020-02-04 [1] Github (r-lib/usethis@ff34e40)    
#>  vctrs         0.2.3       2020-02-20 [3] CRAN (R 3.6.2)                    
#>  withr         2.1.2       2018-03-15 [3] CRAN (R 3.5.0)                    
#>  xfun          0.11        2019-11-12 [3] CRAN (R 3.6.1)                    
#>  xml2          1.2.2       2019-08-09 [3] CRAN (R 3.6.1)                    
#>  yaml          2.2.1       2020-02-01 [3] CRAN (R 3.6.2)                    
#> 
#> [1] /home/jdb-work/R/x86_64-pc-linux-gnu-library/3.6
#> [2] /usr/local/lib/R/site-library
#> [3] /usr/lib/R/site-library
#> [4] /usr/lib/R/library

Proposal

I propose solving this by running unique() on the packages returned by renv::dependencies(). This could either be done in get_dependencies() or write_install().

Also, is it a requirement for binder/repo2docker that each package is installed on a separate line in install.r? The installation would be faster if all the packages were passed to install.packages() at once, so that it can figure out the dependency order.

For example, the lines below install rstudioapi twice (since it is a dependency of getPass):

install.packages("getPass")
install.packages("rstudioapi")

whereas the following only installs it once:

install.packages(c(
  "getPass",
  "rstudioapi"
))

The only added difficulty in the second approach is removing the comma from the final entry.

Are you interested in either of these proposed changes? At the upcoming Chicago R Collaborative, I am going to be mentoring new contributors to open source R packages, and I think these changes would be ideal for a new contributor.

future error with build_binder()

After resolving the namespace issue (#22), we encountered a new error that looks related to the future package:

later: exception occurred while executing callback: Evaluation error: Cannot resolve MultisessionFuture (<none>), because the connection to the worker is corrupt: Connection (connection: description="NA", class="NA", mode="NA", text="NA", opened="NA", can read="NA", can write="NA", id=434) is no longer valid. There is currently no registered R connection with that index 3.

We do not know how to resolve this but just thought we'd let you know!

Check for uncommitted files before pinging the build API

Right now one has to create a description, a dockerfile, then PUSH before launching build. Is there an elegant (but dependency free way) to see if the Dockerfile or Description (at the least) are not in a uncommitted state?

A new approach to writing the Dockerfile

@annakrystalli writes:

One thing that’s “maybe missing” is a runtime.txt file, but then I’ve also heard that using a Dockerfile means that runtime.txt is ignored? Indeed this is my main conceptual hole about the Dockerfile + DESCRIPTION approach currently, ie how can we capture specific versions of dependencies? I've tried the package (== version) approach in the DESCRIPTION but that didn't seem to work. This was actually on my top priority to try and figure out so if you have more info on this it would be great to hear!

This is indeed correct.

So I have a better proposal for writing the Dockerfile and would like some feedback.

There is a new function called last_modification_date that will capture the last date any file on the project was touched and use that as the date to grab the R version and associated packages. This is useful if you are turning binder on an old project, where you don't accidentally want to use the current R version + latest packages.

So with last_modification_date + R version for that date, we write a Dockerfile that does:

FROM rocker/binder:latest
LABEL maintainer="karthik"
USER root
COPY . ${HOME}
RUN chown -R ${NB_USER} ${HOME}
## Become normal user again
USER ${NB_USER}
RUN wget https://github.com/karthik/delete-asap/raw/master/DESCRIPTION && R -e "options(repos = list(CRAN = 'http://mran.revolutionanalytics.com/snapshot/{DATE}/'); 'devtools::install_deps()"

Thoughts on this @annakrystalli and @benmarwick?

Build failing with NB_USER

My build is failing on RUN chown -R ${NB_USER} ${HOME} and I believe it is due to an undefined NB_USER. NB_USER is an empty variable in this environment.

Here is the Docker file source code generated with make_dockerfile().

I reviewed you instructions, but I am not seeing where/how to specify NB_USER.

Thanks for your work on this package!

can we write the dockerfile to binder/

I recently learned from @seabbs that we can put Dockerfiles for binder in a binder/ directory:

Can I put my configuration files outside the root of my repository?
Yes! Configuration files may be placed in the root of your repository or in a binder/ folder in the root of your repository (i.e. myproject/binder/). If a binder/ folder is used, Binder will only read configuration files from that location (i.e. myproject/binder/requirements.txt) and will ignore those in the repository’s root (myproject/environment.yml and myproject/requirements.txt).

https://mybinder.readthedocs.io/en/latest/faq.html#can-i-put-my-configuration-files-outside-the-root-of-my-repository

Learning that made me wonder what you think about making that an option for write_dockerfile (or even a default?).

Some advantages that I can see are that:

  • the user has a meaningfully-named item in their repo (binder/ for binder), and
  • the user can have another top-level Dockerfile for other purposes, such as CI with circle-ci, etc.

Just a thought!

Bioconductor

Hello,

I'd like to create a project session with some bioconductor libraries. But I'm having issue, I see this as a point in the roadmap. What is the problem exactly? Maybe I can help.

Thanks,
Carlos Vivar Rios

Run build_binder in the background

There is no reason why it needs to hold up the console while the image is being built. It would be ideal to run this in the background and open the URL once built.

Error with Binder

I have create a Docker file for Binder with the command:
holepunch::write_dockerfile()

However, when running Binder, there are many errors. See the binder here and the GitHub repo there.
I copy the log below.

From my limited understanding, it seems there is an issue with the renv package (@kevinushey).

Any hint to solve the problem?


Waiting for build to start...
Picked Git content provider.
Cloning into '/tmp/repo2dockerqyh9v61f'...
Updating files: 100% (724/724), done.
HEAD is now at b853852 Update README files and delete old files
Using DockerBuildPack builder
Step 1/11 : FROM rocker/binder:4.0.2
---> c12d2367b296e...
Step 2/11 : LABEL maintainer='Ivan Calandra'
---> Running in a7c34e2596d8
Removing intermediate container a7c34e2596d8
---> 962dac7cc903
Step 3/11 : USER root
---> Running in 440ca0a398e8
Removing intermediate container 440ca0a398e8
---> b8c1be48397a
Step 4/11 : COPY . ${HOME}
---> 6eed326d3051
Step 5/11 : RUN chown -R ${NB_USER} ${HOME}
---> Running in a2474602d73a
Removing intermediate container a2474602d73a
---> f0c81634f98a
Step 6/11 : USER ${NB_USER}
---> Running in 4f7204f139c1
Removing intermediate container 4f7204f139c1
---> bf17160a62ea
Step 7/11 : RUN wget https://github.com/tracer-monrepos/SSFAcomparisonPaper/raw/master/DESCRIPTION && R -e "options(repos = list(CRAN = 'http://mran.revolutionanalytics.com/snapshot/2021-01-26/')); devtools::install_deps()"
---> Running in 93c02b86bd99
--2022-09-12 15:32:12-- https://github.com/tracer-monrepos/SSFAcomparisonPaper/raw/master/DESCRIPTION
Resolving github.com (github.com)... 140.82.114.3
Connecting to github.com (github.com)|140.82.114.3|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://raw.githubusercontent.com/tracer-monrepos/SSFAcomparisonPaper/master/DESCRIPTION [following]
--2022-09-12 15:32:12-- https://raw.githubusercontent.com/tracer-monrepos/SSFAcomparisonPaper/master/DESCRIPTION
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 185.199.111.133, 185.199.110.133, 185.199.109.133, ...
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|185.199.111.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 833 [text/plain]
Saving to: ‘DESCRIPTION.1’

 0K                                                       100% 27.4M=0s

2022-09-12 15:32:13 (27.4 MB/s) - ‘DESCRIPTION.1’ saved [833/833]

R version 4.0.2 (2020-06-22) -- "Taking Off Again"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

Bootstrapping renv 0.14.0 --------------------------------------------------

  • Downloading renv 0.14.0 ... OK
  • Installing renv 0.14.0 ... Done!
    Error installing renv:
    ======================
    Error: ERROR: cannot cd to directory ‘/home/rstudio/renv/library/R-4.0/x86_64-pc-linux-gnu’
    Warning messages:
    1: In system2(r, args, stdout = TRUE, stderr = TRUE) :
    running command ''/usr/local/lib/R/bin/R' --vanilla CMD INSTALL -l '/home/rstudio/renv/library/R-4.0/x86_64-pc-linux-gnu' '/tmp/Rtmp4O2rQL/renv_0.14.0.tar.gz' 2>&1' had status 1
    2: Failed to find an renv installation: the project will not be loaded.
    Use renv::activate() to re-initialize the project.

options(repos = list(CRAN = 'http://mran.revolutionanalytics.com/snapshot/2021-01-26/')); devtools::install_deps()
rlang (0.4.8 -> 0.4.10 ) [CRAN]
R6 (2.4.1 -> 2.5.0 ) [CRAN]
fansi (0.4.1 -> 0.4.2 ) [CRAN]
jsonlite (1.7.1 -> 1.7.2 ) [CRAN]
gitcreds (NA -> 0.1.1 ) [CRAN]
cli (2.0.2 -> 2.2.0 ) [CRAN]
rstudioapi (0.11 -> 0.13 ) [CRAN]
rprojroot (1.3-2 -> 2.0.2 ) [CRAN]
digest (0.6.25 -> 0.6.27 ) [CRAN]
pillar (1.4.6 -> 1.4.7 ) [CRAN]
generics (0.0.2 -> 0.1.0 ) [CRAN]
cpp11 (0.2.2 -> 0.2.5 ) [CRAN]
vctrs (0.3.4 -> 0.3.6 ) [CRAN]
tibble (3.0.3 -> 3.0.5 ) [CRAN]
magrittr (1.5 -> 2.0.1 ) [CRAN]
dplyr (1.0.2 -> 1.0.3 ) [CRAN]
ps (1.4.0 -> 1.5.0 ) [CRAN]
xfun (0.18 -> 0.20 ) [CRAN]
tinytex (0.26 -> 0.29 ) [CRAN]
htmltools (0.5.0 -> 0.5.1.1 ) [CRAN]
processx (3.4.4 -> 3.4.5 ) [CRAN]
withr (2.3.0 -> 2.4.0 ) [CRAN]
rmarkdown (2.4 -> 2.6 ) [CRAN]
callr (3.5.0 -> 3.5.1 ) [CRAN]
hms (0.5.3 -> 1.0.0 ) [CRAN]
Rcpp (1.0.5 -> 1.0.6 ) [CRAN]
BH (1.72.0-3 -> 1.75.0-0 ) [CRAN]
backports (1.1.10 -> 1.2.1 ) [CRAN]
broom (0.7.1 -> 0.7.3 ) [CRAN]
DBI (1.1.0 -> 1.1.1 ) [CRAN]
colorspace (1.4-1 -> 2.0-0 ) [CRAN]
labeling (0.3 -> 0.4.2 ) [CRAN]
diffobj (NA -> 0.3.3 ) [CRAN]
pkgbuild (1.1.0 -> 1.2.0 ) [CRAN]
waldo (NA -> 0.2.3 ) [CRAN]
brio (NA -> 1.1.1 ) [CRAN]
testthat (2.3.2 -> 3.0.1 ) [CRAN]
isoband (0.2.2 -> 0.2.3 ) [CRAN]
RcppEigen (NA -> 0.3.3.9.1 ) [CRAN]
statmod (NA -> 1.4.35 ) [CRAN]
nloptr (NA -> 1.2.2.2 ) [CRAN]
minqa (NA -> 1.2.4 ) [CRAN]
numDeriv (NA -> 2016.8-1.1) [CRAN]
lme4 (NA -> 1.1-26 ) [CRAN]
gh (1.1.0 -> 1.2.0 ) [CRAN]
gert (1.0.0 -> 1.1.0 ) [CRAN]
lubridate (1.7.9 -> 1.7.9.2 ) [CRAN]
ggplot2 (3.3.2 -> 3.3.3 ) [CRAN]
dbplyr (1.4.4 -> 2.0.0 ) [CRAN]
Deriv (NA -> 4.1.2 ) [CRAN]
pbkrtest (NA -> 0.5-0.1 ) [CRAN]
usethis (1.6.3 -> 2.0.0 ) [CRAN]
renv (NA -> 0.12.5 ) [CRAN]
openxlsx (NA -> 4.2.3 ) [CRAN]
doBy (NA -> 4.6.8 ) [CRAN]
Skipping 2 packages not available: rrtools, holepunch
Installing 57 packages: rlang, R6, fansi, jsonlite, gitcreds, cli, rstudioapi, rprojroot, digest, pillar, generics, cpp11, vctrs, tibble, magrittr, dplyr, ps, xfun, tinytex, htmltools, processx, withr, rmarkdown, callr, hms, Rcpp, BH, backports, broom, DBI, colorspace, labeling, diffobj, pkgbuild, waldo, brio, testthat, isoband, RcppEigen, statmod, nloptr, minqa, numDeriv, lme4, gh, gert, lubridate, ggplot2, dbplyr, Deriv, pbkrtest, usethis, rrtools, renv, openxlsx, holepunch, doBy
Installing packages into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
Error: (converted from warning) packages ‘rrtools’, ‘holepunch’ are not available (for R version 4.0.2)
Execution halted
Removing intermediate container 93c02b86bd99
The command '/bin/sh -c wget https://github.com/tracer-monrepos/SSFAcomparisonPaper/raw/master/DESCRIPTION && R -e "options(repos = list(CRAN = 'http://mran.revolutionanalytics.com/snapshot/2021-01-26/')); devtools::install_deps()"' returned a non-zero code: 1Built image, launching...
Failed to connect to event stream

missing namespace definition in function build_binder

Running build_binder() generated an error associated with the plan() function:

Error in plan("list") : could not find function "plan"

Looking at the script we noticed that two occurrences of plan were not preceded by future:: We fixed this locally, and were going to make a PR. But then we noticed an additional (new) error was generated (see next issue).

Example of ISO date format in write_dockerfile documentation

In the docs for write_dockerfile the r_date parameter is described as:

Date you need R to lock down to. By default it picks the most recent date a file was touched in this project but you can override this by specifying this explicitly. Date must be in ISO 8601 format.

I suggest adding an example of ISO format too, just in case a user isn't familiar with it eg:

Date you need R to lock down to. By default it picks the most recent date a file was touched in this project but you can override this by specifying this explicitly. Date must be in ISO 8601 format, e.g. 2019-06-27

Guidance on when/how to update the binder

I am new to binder and I found holepunch extremely useful to get me started. I was wondering if the README of holepunch could offer some advice in terms of when and how to update the binder as the repository evolves or is updated. Thanks!

docker with R and Python

Hello,
I have a project with one script that uses both R and Python through the reticulate package and the holepunch functions fail with this specific project.
Is there a way to solve this problem?
Thank you.

Running projects on a newer R version

Thank you for a great package.

I'm using today's date where the newest R version is 3.6.0 and still get a much older R version when launching the server

Is there a way to control the R version installed in the Docker container?

image

compatibility with renv

hi @karthik, thanks for the great package! I'm trying it out and expect tight integration with renv.

Now on R-4.0.1 but R version "discovery" is based on date and seems not to have been updated :-/
You wrote on #45 that you would do it in the same day (Apr 9th but the last date in this table is Feb 29th 😅). So I guess a project using the most version of R at any time would work fine once this is fixed.

But integration with renv would require reading the R version from renv.lock, no?

Error with `write_compendium_description()`

What I did

  1. I created a new package in RStudio and added three folders: Data, R and Analysis:

Screenshot from 2020-05-22 14-03-33

(tried on R 3.6.3 and R 4.0.0)

  1. In the R folder I added an R script:

Screenshot from 2020-05-22 14-05-27

  1. I tried to generate a DESCRIPTION file
> holepunch::write_compendium_description()
Finding R package dependencies ... Done!
Error: text is not a character vector

What happened

No DESCRIPTION file generated

What you expected to happen

A DESCRIPTION file ;-)

Some breadcrumbs that might help (hopefully)

I tried to track down where in the write_compendium_description() function the error occurs. It seems to be here:

desc <- desc::description$new(text = desc)

Apparently, the function desc::description expects a character vector as input and complains about it. desc is indeed not a vector:

> class(desc)
[1] "description" "R6"     

The desc object looks like this (Depends: is missing)

> desc
Package: CompendiumCompendium title0.0.1Compendium
    descriptionlandscapemetrics
Title: What the Package Does (One Line, Title Case)
Version: 0.0.0.9000
Authors@R (parsed):
    * First Last <[email protected]> [aut, cre] (<https://orcid.org/YOUR-ORCID-ID>)
Description: What the package does (one paragraph).
License: `use_mit_license()`, `use_gpl3_license()` or friends to
    pick a license
Encoding: UTF-8
LazyData: true
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.1.0

I hope you can help me :-)

Thanks,

Sebastian

lunching Binder failed

Hi Karthik,

Thanks for developing this great tool for making it ridiculously easy to build Docker images for R projects and make them Binder-ready.

I followed the instructions and built a Binder badge for my small R project, but failed to launch it online, possibly due to the inability to install a Bioconductor package in the Rstudio server.

Below is part of the log text:

> options(repos = list(CRAN = 'http://mran.revolutionanalytics.com/snapshot/2019-08-15/')); devtools::install_deps()
cowplot      (NA    -> 1.0.0     ) [CRAN]
ggpubr       (NA    -> 0.2.2     ) [CRAN]
ggrepel      (NA    -> 0.8.1     ) [CRAN]
ggsignif     (NA    -> 0.6.0     ) [CRAN]
influence.ME (NA    -> 0.9-9     ) [CRAN]
lme4         (NA    -> 1.1-21    ) [CRAN]
ordinal      (NA    -> 2019.4-25 ) [CRAN]
pbkrtest     (NA    -> 0.4-7     ) [CRAN]
ggplot2      (3.2.0 -> 3.2.1     ) [CRAN]
ggsci        (NA    -> 2.9       ) [CRAN]
polynom      (NA    -> 1.4-0     ) [CRAN]
Rcpp         (1.0.1 -> 1.0.2     ) [CRAN]
minqa        (NA    -> 1.2.4     ) [CRAN]
nloptr       (NA    -> 1.2.1     ) [CRAN]
RcppEigen    (NA    -> 0.3.3.5.0 ) [CRAN]
ucminf       (NA    -> 1.1-4     ) [CRAN]
numDeriv     (NA    -> 2016.8-1.1) [CRAN]
hms          (0.4.2 -> 0.5.0     ) [CRAN]
httr         (1.4.0 -> 1.4.1     ) [CRAN]
modelr       (0.1.4 -> 0.1.5     ) [CRAN]
xml2         (1.2.0 -> 1.2.2     ) [CRAN]
vctrs        (0.1.0 -> 0.2.0     ) [CRAN]
clipr        (0.6.0 -> 0.7.0     ) [CRAN]
curl         (3.3   -> 4.0       ) [CRAN]
openssl      (1.4   -> 1.4.1     ) [CRAN]
callr        (3.3.0 -> 3.3.1     ) [CRAN]
rmarkdown    (1.13  -> 1.14      ) [CRAN]
processx     (3.4.0 -> 3.4.1     ) [CRAN]
knitr        (1.23  -> 1.24      ) [CRAN]
tinytex      (0.14  -> 0.15      ) [CRAN]
markdown     (1.0   -> 1.1       ) [CRAN]
Skipping 1 packages not available: ComplexHeatmap
Installing 32 packages: ComplexHeatmap, cowplot, ggpubr, ggrepel, ggsignif, influence.ME, lme4, ordinal, pbkrtest, ggplot2, ggsci, polynom, Rcpp, minqa, nloptr, RcppEigen, ucminf, numDeriv, hms, httr, modelr, xml2, vctrs, clipr, curl, openssl, callr, rmarkdown, processx, knitr, tinytex, markdown
Installing packages into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
Error: (converted from warning) package ‘ComplexHeatmap’ is not available (for R version 3.6.0)
Execution halted
Removing intermediate container 9d2d8064dab9
The command '/bin/sh -c wget https://github.com/KrogdahlLab/AquaFly-SeawaterGutHealth-Aquaculture-2018/raw/master/DESCRIPTION && R -e "options(repos = list(CRAN = 'http://mran.revolutionanalytics.com/snapshot/2019-08-15/')); devtools::install_deps()"' returned a non-zero code: 1

Wrong R version

I am using R 4.0.3 but when I build the Docker image using write_dockerfile(), I get a warning telling me that the date (2020-11-19) corresponds to 4.0.2, which I cannot explain since the current R version is 4.0.3.

Do you have an idea what the reason could be?

Error during `build_binder` when files are uncommitted

Throwing an error and refusing to build if there is any uncommitted file seems a bit strict to me. Perhaps it's just my messy working but sometimes I do have uncommitted files that I might never commit but don't want in my gitignore either.

I feel like it should either be a warning or warn you of the fact that there are uncommitted changes and ask you whether you'd like to proceed. What do you reckon?

In addition, using the package seems to add files to the workspace that are usually gitignored, for example the .Rhistory file.

Specifying package versions

I love this package and how easy it was to set up an initial instance, but now I'd like to go one step further...

When writing the docker file I set the r_date to a year ago just to ensure that the R version that gets loaded matches that of the example project I'm working with.

I figure that the package versions loaded will align to the specified r_date, but is it possible to read the output of a file generated from sessionInfo() so that the exact package versions could be incorporated into the Binder instance?

I'm thinking of faithfully replicating the R environment for downstream integrity of the research.

Permission denied issue

Hi @karthik, many thanks for a great package! I'm having issues with the latest version though, I see this message after launching the binder instance associated with this commit: https://github.com/Robinlovelace/geocompr/commit/5a66c712a5f936f5bb123d1305e7f7a64c84e9d2

FROM rocker/binder:4.0.2
LABEL maintainer='Robin Lovelace'
USER root
COPY . ${HOME}
RUN chown -R ${NB_USER} ${HOME}
USER ${NB_USER}

Reproducible example (assuming I've not updated the .binder/Dockerfile since then): https://mybinder.org/v2/gh/robinlovelace/geocompr/master?urlpath=rstudio

holepunch:::r_version_table outdated

Thank you for a very helpful package with straightforward documentation.

I noticed that r_version_table only covers R up to version 3.6.0. Would it be possible to update the file?

Many thanks in advance!

Ability to install functionality contained in compendium itself in DOCKERFILE

Often the repository itself might contain packaged functionality in which case it needs to be installed itself. Currently, in this demo research compendium, (repo), all dependencies are installed correctly but the additional functionality contained in the package itself is not and rendering of paper.Rmd fails

It would be great if there was either an option or even auto-installation of the repo if a DESCRIPTION file is present.

Installing packages from GitHub failed

Hi!

I've used the polepunch to make my analyses binder-ready in a previous project and it was a really nice experience! I was trying to do that for a new project but some R packages can't be installed from the GitHub. These R packages are under development and have not been submitted to the CRAN.

Here's the error message from the build:

Skipping 9 packages not available: biomformat, dada2, gt, Maaslin2, MicrobeR, microbiome, philr, phyloseq, qiime2R
Installing 124 packages: cowplot, DT, EMAtools, emmeans, factoextra, ggResidpanel, ggsignif, gt, here, knitr, lmerTest, lsr, Maaslin2, MicrobeR, PerformanceAnalytics, picante, plotly, qiime2R, rmarkdown, scales, tidyverse, venn, Rcpp, ggplot2, rlang, htmltools, htmlwidgets, jsonlite, crosstalk, promises, DataCombine, sjstats, estimability, numDeriv, plyr, mvtnorm, dendextend, FactoMineR, ggpubr, ggrepel, tidyr, qqplotr, markdown, yaml, xfun, lme4, xts, zoo, httr, digest, hexbin, dplyr, purrr, data.table, mime, tinytex, farver, R6, lifecycle, broom, cli, forcats, haven, hms, modelr, pillar, rstudioapi, rvest, xml2, admisc, glue, isoband, testthat, fansi, pkgconfig, vctrs, ellipsis, pkgbuild, callr, prettyunits, backports, processx, ps, later, BH, tidyselect, minqa, nloptr, RcppEigen, bayestestR, effectsize, insight, parameters, performance, sjlabelled, sjmisc, stringi, clipr, car, ellipse, flashClust, leaps, scatterplot3d, carData, pbkrtest,quantreg, maptools, rio, sp, SparseM, MatrixModels, curl, openxlsx, zip, ggsci, polynom, openssl, sys, robustbase, DEoptimR, DBI, fs, whisker, selectr
Installing packages into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
Error: (converted from warning) packages ‘gt’, ‘Maaslin2’, ‘MicrobeR’, ‘qiime2R’ are not available (for R version 3.6.0)
Execution halted

-Yanxian

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.