-
Notifications
You must be signed in to change notification settings - Fork 36
Package installation #434
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
Open
anshisax
wants to merge
11
commits into
master
Choose a base branch
from
package-installation
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Package installation #434
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
6fe52b6
Add comprehensive package installation guide for Workbench apps
anshisax 7755652
Add common-packages feature for easy package pre-installation
anshisax 7d87039
Simplify common-packages feature - just list your packages
anshisax 3dbde28
Add test app for common-packages feature
anshisax 4d702c6
Add Claude skill for generating R apps with custom packages
anshisax 69c3999
Rename anshicustomapp to customapp
anshisax 0f0cc86
Update skill to support ALL app types (Jupyter, VSCode, R)
anshisax f9d738f
Fix common-packages feature path to be inside .devcontainer
anshisax 68ebb5e
Add llm-context feature to R app for Claude
anshisax 17f38c5
Fix invalid JSON in .devcontainer.json - remove line breaks in strings
anshisax 2aef6f4
Simplify package installation to natural language approach
anshisax File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,189 @@ | ||
| # Pre-installing Packages in Workbench Apps | ||
|
|
||
| Users often want specific packages pre-installed in their apps to avoid running `pip install` or `install.packages()` every time. This guide shows two simple approaches. | ||
|
|
||
| --- | ||
|
|
||
| ## Approach 1: Natural Language with Claude (Easiest!) | ||
|
|
||
| Just ask Claude what you need, and it will help you install packages: | ||
|
|
||
| **Examples:** | ||
| - "I need ggplot2" | ||
| - "Set me up for machine learning" | ||
| - "I want tools for genomics analysis" | ||
| - "Install deep learning packages" | ||
|
|
||
| Claude understands natural language and will either: | ||
| - Generate an installation command for you to run | ||
| - Pre-configure your app with the packages | ||
|
|
||
| **Supported domains:** | ||
| - Machine Learning, Deep Learning, NLP | ||
| - Data Visualization, Dashboards | ||
| - Bioinformatics, Genomics, Single-cell | ||
| - BigQuery/GCP, Statistics, Time Series | ||
| - And more... | ||
|
|
||
| --- | ||
|
|
||
| ## Approach 2: Pre-install with common-packages Feature | ||
|
|
||
| Use the built-in `common-packages` feature in your `.devcontainer.json`: | ||
|
|
||
| ```json | ||
| { | ||
| "features": { | ||
| "ghcr.io/verily-src/workbench-app-devcontainers/common-packages": { | ||
| "pythonPackages": "tensorflow scikit-learn pandas numpy matplotlib", | ||
| "rPackages": "Seurat,DESeq2,ggplot2,tidyverse" | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| **Python packages:** Space-separated | ||
| **R packages:** Comma-separated (NO SPACES) | ||
|
|
||
| **When to use this:** | ||
| - You know exactly which packages you need | ||
| - You want packages available immediately at app startup | ||
| - You're creating a new app | ||
|
|
||
| See [`features/src/common-packages/README.md`](features/src/common-packages/README.md) for details. | ||
|
|
||
| --- | ||
|
|
||
| ## Complete Examples | ||
|
|
||
| ### Example 1: Jupyter with Machine Learning Packages | ||
|
|
||
| **With Claude:** | ||
| Just say: "Create a Jupyter app for machine learning" | ||
|
|
||
| **Manual configuration:** | ||
| ```json | ||
| { | ||
| "name": "Jupyter - Machine Learning", | ||
| "features": { | ||
| "ghcr.io/verily-src/workbench-app-devcontainers/common-packages": { | ||
| "pythonPackages": "scikit-learn xgboost tensorflow torch pandas numpy matplotlib" | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ### Example 2: R Analysis for Genomics | ||
|
|
||
| **With Claude:** | ||
| Just say: "I need R packages for genomics analysis" | ||
|
|
||
| **Manual configuration:** | ||
| ```json | ||
| { | ||
| "name": "R Analysis - Genomics", | ||
| "features": { | ||
| "ghcr.io/verily-src/workbench-app-devcontainers/common-packages": { | ||
| "rPackages": "Seurat,DESeq2,GenomicRanges,tidyverse,ggplot2" | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ### Example 3: On-Demand Installation (Already in Jupyter) | ||
|
|
||
| If you're already working and realize you need more packages: | ||
|
|
||
| **Ask Claude:** "I need plotly for visualization" | ||
|
|
||
| **Claude will show you:** | ||
| ```python | ||
| !pip install plotly | ||
| ``` | ||
|
|
||
| Or for R: | ||
| ```python | ||
| %%R | ||
| install.packages("plotly") | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## Comparison | ||
|
|
||
| | Approach | When Available | Requires Rebuild | Natural Language | | ||
| |----------|---------------|------------------|------------------| | ||
| | **Ask Claude** | On-demand or pre-build | No (on-demand) / Yes (pre-build) | ✅ Yes | | ||
| | **common-packages feature** | At app startup | Yes | ❌ No | | ||
|
|
||
| **Best practice:** | ||
| - Use `common-packages` for packages you know you'll need | ||
| - Ask Claude when you discover new needs while working | ||
|
|
||
| --- | ||
|
|
||
| ## Common Package Lists | ||
|
|
||
| ### Python | ||
|
|
||
| **Data Science:** pandas, numpy, scipy, matplotlib, seaborn | ||
| **Machine Learning:** scikit-learn, xgboost, lightgbm | ||
| **Deep Learning:** tensorflow, torch, transformers, keras | ||
| **NLP:** transformers, spacy, nltk, gensim | ||
| **Bioinformatics:** biopython, scanpy, anndata | ||
| **BigQuery:** google-cloud-bigquery, google-cloud-storage, db-dtypes | ||
| **Visualization:** matplotlib, seaborn, plotly, dash, streamlit | ||
|
|
||
| ### R | ||
|
|
||
| **Core Data Science:** tidyverse, dplyr, tidyr, readr, ggplot2 | ||
| **Visualization:** ggplot2, plotly, shiny, shinydashboard | ||
| **Machine Learning:** caret, randomForest, xgboost | ||
| **Bioinformatics:** Seurat, DESeq2, edgeR, limma | ||
| **Genomics:** GenomicRanges, AnnotationDbi, biomaRt | ||
| **BigQuery:** bigrquery, googleCloudStorageR | ||
|
|
||
| --- | ||
|
|
||
| ## FAQ | ||
|
|
||
| ### Q: How do I install packages I discover I need while working? | ||
|
|
||
| **A:** Just ask Claude! Say "I need <package>" or "I need tools for <task>", and Claude will generate the installation command for you. | ||
|
|
||
| ### Q: Can I use both Python and R packages? | ||
|
|
||
| **A:** Yes! Just specify both: | ||
| ```json | ||
| { | ||
| "pythonPackages": "pandas numpy", | ||
| "rPackages": "ggplot2,tidyverse" | ||
| } | ||
| ``` | ||
|
|
||
| ### Q: What if I need a package that's not in the common lists? | ||
|
|
||
| **A:** Just ask Claude or add it explicitly to the `pythonPackages` or `rPackages` field. For example: | ||
| - "I need the 'polars' package" | ||
| - Or add: `"pythonPackages": "polars duckdb"` | ||
|
|
||
| ### Q: How do I install Bioconductor packages? | ||
|
|
||
| **A:** Ask Claude "I need Bioconductor packages for RNA-seq", or use: | ||
| ```json | ||
| { | ||
| "rPackages": "BiocManager,DESeq2,edgeR,limma" | ||
| } | ||
| ``` | ||
|
|
||
| The `common-packages` feature automatically handles Bioconductor installation. | ||
|
|
||
| --- | ||
|
|
||
| ## Summary | ||
|
|
||
| **Easiest way:** Ask Claude in natural language | ||
| **For known needs:** Use `common-packages` feature in `.devcontainer.json` | ||
| **Both work together:** Pre-install common packages, ask Claude for additional ones | ||
|
|
||
| No more manual `pip install` or `install.packages()` every time! 🎉 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| # Pre-install Packages Feature | ||
|
|
||
| Pre-install your Python and R packages so you don't have to run `pip install` or `install.packages()` every time you create an app. | ||
|
|
||
| ## Usage | ||
|
|
||
| Just list the packages you want in your `.devcontainer.json`: | ||
|
|
||
| ```json | ||
| { | ||
| "features": { | ||
| "ghcr.io/verily-src/workbench-app-devcontainers/common-packages": { | ||
| "pythonPackages": "pandas numpy scikit-learn matplotlib", | ||
| "rPackages": "tidyverse,ggplot2,dplyr,plotly,shiny" | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| That's it! Packages will be pre-installed when the app is built. | ||
|
|
||
| ## Examples | ||
|
|
||
| ### R Analysis with 15 packages | ||
|
|
||
| ```json | ||
| { | ||
| "features": { | ||
| "ghcr.io/verily-src/workbench-app-devcontainers/common-packages": { | ||
| "rPackages": "tidyverse,ggplot2,dplyr,tidyr,readr,plotly,shiny,DT,data.table,caret,randomForest,bigrquery,googleCloudStorageR,arrow,lubridate" | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ### Jupyter with Python packages | ||
|
|
||
| ```json | ||
| { | ||
| "features": { | ||
| "ghcr.io/verily-src/workbench-app-devcontainers/common-packages": { | ||
| "pythonPackages": "pandas numpy matplotlib seaborn scikit-learn google-cloud-bigquery google-cloud-storage" | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ### Both Python and R | ||
|
|
||
| ```json | ||
| { | ||
| "features": { | ||
| "ghcr.io/verily-src/workbench-app-devcontainers/common-packages": { | ||
| "pythonPackages": "pandas numpy", | ||
| "rPackages": "ggplot2,dplyr" | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ## Format | ||
|
|
||
| - **Python packages:** Space-separated (e.g., `"pandas numpy scikit-learn"`) | ||
| - **R packages:** Comma-separated (e.g., `"tidyverse,ggplot2,dplyr"`) | ||
|
|
||
| ## How It Works | ||
|
|
||
| - Packages install during container build (one-time) | ||
| - Apps launch instantly with packages ready | ||
| - Users can still install more packages at runtime if needed | ||
| - Much simpler than creating custom app configs | ||
|
|
||
| ## Performance | ||
|
|
||
| - **First build:** Takes time to install packages | ||
| - **Every app after:** Instant - packages already there | ||
| - **vs. manual install every time:** Saves 5-10 minutes per app launch |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| { | ||
| "id": "common-packages", | ||
| "version": "1.0.0", | ||
| "name": "Pre-install Packages", | ||
| "description": "Pre-install Python and R packages so users don't have to run pip install or install.packages() every time", | ||
| "documentationURL": "https://github.com/verily-src/workbench-app-devcontainers/tree/main/features/src/common-packages", | ||
| "options": { | ||
| "pythonPackages": { | ||
| "type": "string", | ||
| "default": "", | ||
| "description": "Python packages to install (space-separated, e.g., 'pandas numpy scikit-learn')" | ||
| }, | ||
| "rPackages": { | ||
| "type": "string", | ||
| "default": "", | ||
| "description": "R packages to install (comma-separated, e.g., 'tidyverse,ggplot2,dplyr')" | ||
| } | ||
| } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we add installsAfter to make sure features that install python or r are installed first? "installsAfter": [
"ghcr.io/devcontainers/features/python",
"ghcr.io/rocker-org/devcontainer-features/r-packages",
"./.devcontainer/features/workbench-tools"
] |
||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| #!/bin/bash | ||
| set -e | ||
|
|
||
| echo "Installing user-specified packages..." | ||
|
|
||
| # Install Python packages | ||
| if [ -n "${PYTHONPACKAGES}" ] && command -v pip &> /dev/null; then | ||
| echo "Installing Python packages: ${PYTHONPACKAGES}" | ||
| pip install --no-cache-dir ${PYTHONPACKAGES} | ||
| fi | ||
|
|
||
| # Install R packages | ||
| if [ -n "${RPACKAGES}" ] && command -v R &> /dev/null; then | ||
| echo "Installing R packages: ${RPACKAGES}" | ||
| R --quiet -e "install.packages(strsplit('${RPACKAGES}', ',')[[1]], repos='https://cran.rstudio.com/', quiet=TRUE)" | ||
| fi | ||
|
|
||
| echo "Package installation complete!" |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this file seems like a duplicate of the two skills, is it still needed?
it's also outside of any devcontainer feature, should it be in llm-context?