Refining the R Dev Container - rstats-gsoc/gsoc2025 GitHub Wiki
Background
The R Dev Container provides a containerised development environment for editing and compiling the R source code. This is especially helpful for new or ad-hoc contributors to base R, as they can save the time and trouble of setting up their own system to build R and focus on code/documentation development.
The current container uses the VSCode IDE and is designed to be used on GitHub Codespaces or as a Gitpod Workspace (via a GitHub, GitLab, or Bitbucket account), so that people can work in the dev environment through their browser. It is possible to use the container with a local installation of VS Code via Docker Desktop, but this is currently only recommended for Linux users.
This project aims to make the container useful for a wider range of contributors, by modifying the container to support debugging compiled code and updating the build process so that the container can be used locally by macOS and Windows users. Improved support for local use will provide the foundation to use the container with alternative IDEs, including Positron.
Related work
The R Dev Container was first developed for GitHub Codespaces under the Containerized Development Environments for R Google Summer of Code (GSoC) project in 2023. The follow-on project Enhancing the R Dev Container adapted the container to work on Gitpod, as well as implementing a number of enhancements such as using an HTTP graphics device, adding helper scripts to work with multiple builds of R and extending the documentation.
See the project reports from 2023 and 2024 for more detail.
Details of your coding project
There are three improvements we would like to prioritise for this GSoC project:
- Modifying the container configuration to enable debugging with LLDB (issue #96).
- Modify the build process and the container configuration so that local use is practical at least on macOS and preferably also on Windows. (For macOS will require fixing issues #112 and #176)
- Adjust the container to work in the Positron IDE. This may be used locally or via SSH with DevPod.
Further enhancements could be worked on during the project, such as reducing the image size, which may be more important for local setup.
All aspects would involve updating the Markdown-based documentation to reflect the new functionality.
Expected impact
The R Dev Container has proved a useful tool for novice contributors, especially at R Dev Days when people want to get up and running quickly. However, the lack of support for C debugging means that the Dev Container can only be recommended for working on R code and documentation, while a large proportion of base R is written in C.
When people are working in remote or low resource environments, running the container on GitHub Codespaces or as a GitLab Workspace may not be practical. Improving the local setup for macOS and Windows users will mean that local use can be recommended as a viable option in general and may even be attractive for experienced contributors that would prefer to use an isolated dev environment.
While RStudio is still perhaps the most widely used IDE for R, we are prioritising Positron as a familiar IDE that supports C debugging. This may lay the foundation for using the container with other IDEs that support R and C such as CLion and Emacs.
Mentors
Contributors, please contact mentors below after completing at least one of the tests below.
- EVALUATING MENTOR: Heather Turner [email protected] chairs the R Contribution Working Group and is an author of several CRAN packages, notably the statistical modelling packages gnm, BradleyTerry2 and PlackettLuce. She was a GSoC co-mentor in 2021-2024.
- Iain Emsley [email protected] is a Research Software Engineer who works with containers, infrastructure and uses R in teaching. He was a GSoC co-mentor in 2024.
- Atharva Shirdhankar [email protected] was the GSoC contributor on the related GSoC projects in 2023 and 2024.
Tests
Contributors, please do one or more of the following tests before contacting the mentors above.
- Easy: Go to the R Dev Container repository and start the GitHub Codespace by clicking on the "Code" drop-down menu, clicking the "Codespaces"" tab and selecting "Create codespace on main". It will take several minutes to set up the codespace. Open a new file with a .R extension and click "R (not attached)" in the VS Code footer to attach to an active R terminal. Write a simple line of R code in your R script and run it. Take a screenshot of your R session.
- Medium: Follow the instructions in the Building R section of the R Dev Container README to build R from a checkout of the R Subversion repository, adapting step 2 to checkout revision number 86123. Create a bash script that combines all these steps and takes the Subversion revision number as an argument or option, to build R from a checkout of a specific revision. Take screenshots that show you using the script in the dev container to build R version 86122 - when you start R, it should show the message "R Under development (unstable) (2024-03-14 r86122)". Use multiple screenshots so that we can first see R version 86123 running in VS Code, then see you calling the script with the relevant option or argument, then see (some of) the output it generates, and finally R version 86122 running in VS Code.
- Hard: Follow the instructions in the Contributing to docs to compile the documentation locally. Find a small thing that needs improving in the documentation. There are some open issues that could be used as inspiration: #44, #86, #191. Edit the documentation accordingly and preview your changes. Take a screenshot to show the revised documentation on your computer. Commit your changes and open a pull request for review.
- Hard: Install DevPod and Docker Desktop on your computer. Using the DevPod documentation as a guide, create a workspace from the R Dev Container GitHub repo using Docker Desktop as the "provider" and Positron as the IDE (you will need to install Positron) if you don't yet have it. Take a screenshot of the information messages shown when creating the workspace - depending on your operating system, you may get some warnings and errors. Despite this, a Docker container should be created - try connecting to the container and working through the Running R tutorial that was written for VS Code. What works and what doesn't? Write notes on your experience using the R Dev Container this way: What needs to be fixed? Can you already suggest improvements to be made?
Solutions of tests
Contributors, please post a link to your test results here.
- EXAMPLE CONTRIBUTOR 1 NAME, LINK TO GITHUB PROFILE, LINK TO TEST RESULTS.