Skip to content

Conversation

@m7pr
Copy link
Contributor

@m7pr m7pr commented Aug 5, 2025

Overview

This PR adds a comprehensive development container setup for the teal.code R package development environment.

Changes

Dev Container Configuration

  • devcontainer.json: Uses rocker/verse:4.3.3 image with R and essential tools pre-installed
  • setup.sh: Automated setup script for system dependencies and R packages
  • Persistent storage: R packages are stored in a mounted volume for persistence between rebuilds

R Environment Setup

  • .Rprofile: Optimized R configuration for dev container environment
  • Package management: Automatic installation of essential R packages:
    • Development tools: devtools, testthat, roxygen2, pkgdown, remotes, renv, usethis
    • Project dependencies: dplyr, random.cdisc.data, nestcolor

VS Code Integration

  • Extensions: R language support and essential development tools
  • Settings: Optimized R terminal and editor configuration

Git Configuration

  • Updated .gitignore: Handles dev container artifacts appropriately
  • Persistent packages: R packages persist between container rebuilds

Benefits

  1. Consistent Environment: All developers get the same R version and packages
  2. Quick Setup: New contributors can start developing immediately
  3. Persistence: Installed packages persist between container rebuilds
  4. Isolation: Development environment is isolated from host system

Usage

  1. Open repository in VS Code
  2. Accept prompt to reopen in container (or use Command Palette)
  3. Wait for initial setup (first time only)
  4. Start developing!

Testing

The setup has been tested to ensure:

  • R 4.3.3 installs correctly
  • Essential packages install without issues
  • Development workflows work as expected

This addresses the need for a consistent development environment and should make it much easier for contributors to get started with teal.code development.

- Add devcontainer.json with rocker/verse R 4.3.3 image
- Configure automatic installation of essential R packages
- Set up persistent R package storage via volume mount
- Add setup script for system dependencies and R packages
- Configure .Rprofile for optimal dev container experience
- Add VS Code extensions and settings for R development
- Update .gitignore to handle dev container artifacts

This setup ensures R and all necessary packages persist between
container rebuilds, providing a consistent development environment
for the teal.code package.
Copy link
Contributor

@averissimo averissimo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the need for this PR?

Is this a trial to see if it should be implemented across all packages after?

Comment on lines +44 to +49
# Try to install teal.data if available
tryCatch({
install.packages('teal.data')
}, error = function(e) {
message('teal.data package not available from CRAN, will need to install from GitHub')
})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why install teal.data with teal.code?

Comment on lines +31 to +42
install.packages(c(
'devtools',
'testthat',
'roxygen2',
'pkgdown',
'remotes',
'renv',
'usethis',
'dplyr',
'random.cdisc.data',
'nestcolor'
), dependencies = TRUE)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is nestcolor and random.cdisc.data really necessary?

@@ -0,0 +1,37 @@
# R Configuration for teal.code development
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this enforces too many decisions on the developers and we shouldn't include .Rprofile on the repos.

This is unprecedented on the organization and tidyverse.

In pharmaverse it appears on stdm.oak, but otherwise it's not used anywhere.

Comment on lines +4 to +10
if (Sys.getenv("RSTUDIO") == "1" || file.exists("/.dockerenv")) {
# In dev container - use mounted volume for persistence
user_lib <- "/usr/local/lib/R/site-library"
} else {
# Local development - use user library
user_lib <- "~/R/library"
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this compatible with Windows and Mac OSX?

@m7pr m7pr marked this pull request as draft August 6, 2025 12:57
@m7pr
Copy link
Contributor Author

m7pr commented Aug 6, 2025

Hey @averissimo thanks for the review, but this is only POC PR that I made through copilot development environment that I showed yesterday on Slack. Probably there are too many files here anyway.

The goal is to setup .devcontainers, so that, when you open copilot development environment you would have most of the dependencies preinstalled to test the current package from this repository

@m7pr
Copy link
Contributor Author

m7pr commented Aug 6, 2025

this was just a garbage POC PR. clsoing it

@m7pr m7pr closed this Aug 6, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Aug 6, 2025
@insights-engineering-bot insights-engineering-bot deleted the devcontainer-setup branch November 9, 2025 03:56
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants