Skip to content

Commit 6704a71

Browse files
authored
Add claude code install to devcontainer (#1427)
Adds the claude cli tool to the devcontainer Signed-off-by: Peter St. John <pstjohn@nvidia.com>
1 parent 78ace5d commit 6704a71

4 files changed

Lines changed: 129 additions & 10 deletions

File tree

.devcontainer/recipes/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@ RUN --mount=type=cache,target=/root/.cache/pip \
1313
COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/
1414
USER ubuntu
1515
RUN curl https://cursor.com/install -fsS | bash # Install cursor-agent CLI tool
16+
RUN curl -fsSL https://claude.ai/install.sh | bash # Install Claude CLI tool
1617
RUN uv tool install pre-commit --with pre-commit-uv --force-reinstall

.devcontainer/recipes/devcontainer.json

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@
66
"dockerfile": "Dockerfile"
77
},
88
"mounts": [
9+
"source=${localEnv:HOME}/.bash_history_devcontainer,target=/home/ubuntu/.bash_history,type=bind,consistency=cached",
910
"source=${localEnv:HOME}/.cache,target=/home/ubuntu/.cache,type=bind,consistency=cached",
11+
"source=${localEnv:HOME}/.claude,target=/home/ubuntu/.claude,type=bind,consistency=cached",
12+
"source=${localEnv:HOME}/.claude.json,target=/home/ubuntu/.claude.json,type=bind,consistency=cached"
13+
"source=${localEnv:HOME}/.config,target=/home/ubuntu/.config,type=bind,consistency=cached",
14+
"source=${localEnv:HOME}/.cursor,target=/home/ubuntu/.cursor,type=bind,consistency=cached",
15+
"source=${localEnv:HOME}/.gnupg,target=/home/ubuntu/.gnupg,type=bind,consistency=cached",
1016
"source=${localEnv:HOME}/.netrc,target=/home/ubuntu/.netrc,type=bind,consistency=cached",
11-
"source=${localEnv:HOME}/.bash_history_devcontainer,target=/home/ubuntu/.bash_history,type=bind,consistency=cached",
1217
"source=${localEnv:HOME}/.ssh,target=/home/ubuntu/.ssh,readonly,type=bind,consistency=cached",
13-
"source=${localEnv:HOME}/.gnupg,target=/home/ubuntu/.gnupg,type=bind,consistency=cached",
14-
"source=${localEnv:HOME}/.config,target=/home/ubuntu/.config,type=bind,consistency=cached",
15-
"source=${localEnv:HOME}/.cursor,target=/home/ubuntu/.cursor,type=bind,consistency=cached"
1618
],
1719
"postCreateCommand": ".devcontainer/recipes/postCreateCommand.sh",
1820
"initializeCommand": ".devcontainer/recipes/initializeCommand.sh",
@@ -27,14 +29,15 @@
2729
"customizations": {
2830
"vscode": {
2931
"extensions": [
30-
"ms-python.python",
32+
"Anthropic.claude-code",
3133
"charliermarsh.ruff",
32-
"redhat.vscode-yaml",
33-
"ms-toolsai.jupyter",
3434
"eamodio.gitlens",
35-
"tamasfe.even-better-toml",
35+
"ms-azuretools.vscode-docker",
36+
"ms-python.python",
37+
"ms-toolsai.jupyter",
38+
"redhat.vscode-yaml",
3639
"streetsidesoftware.code-spell-checker",
37-
"ms-azuretools.vscode-docker"
40+
"tamasfe.even-better-toml"
3841
]
3942
}
4043
}

.devcontainer/recipes/initializeCommand.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ mkdir -p ~/.cache/pre-commit-devcontainer
77
mkdir -p ~/.gnupg
88
mkdir -p ~/.config
99
mkdir -p ~/.cursor
10+
mkdir -p ~/.claude
1011
[ ! -f ~/.netrc ] && touch ~/.netrc
1112

12-
# Create the ~/.bash_history_devcontainer file if it doesn't exist
1313
[ ! -f ~/.bash_history_devcontainer ] && touch ~/.bash_history_devcontainer
14+
[ ! -f ~/.claude.json ] && touch ~/.claude.json
1415

1516
exit 0

CLAUDE.md

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Repository Overview
6+
7+
BioNeMo Framework is a comprehensive suite for building and training biological foundation models at scale. The repository is split into three main areas:
8+
9+
1. **bionemo-recipes/** - Lightweight, self-contained training recipes using FSDP (Fully Sharded Data Parallel) with TransformerEngine and megatron-FSDP
10+
2. **sub-packages/** - 5D parallel models (tensor/pipeline/context parallel) using NeMo/Megatron-Core, and dataloading/processing tools
11+
3. **3rdparty/** - Git submodules for NeMo and Megatron-LM dependencies
12+
13+
## Code Architecture
14+
15+
### bionemo-recipes Structure
16+
17+
The recipes directory contains two types of components:
18+
19+
**Models (`bionemo-recipes/models/`)**: HuggingFace-compatible `PreTrainedModel` classes with TransformerEngine layers. These are:
20+
21+
- Distributed via Hugging Face Hub (e.g., nvidia/esm2_t48_15B_UR50D)
22+
- Drop-in replacements for standard transformers, compatible with `AutoModel.from_pretrained()`
23+
- Each model includes: conversion utilities (HF ↔ TE), golden value tests, checkpoint export scripts, and open-source license
24+
25+
**Recipes (`bionemo-recipes/recipes/`)**: Self-contained Docker environments demonstrating training patterns. Each recipe:
26+
27+
- Is completely isolated with no shared dependencies between recipes
28+
- Contains everything needed: Dockerfile, training scripts, Hydra configs, tests, sample data
29+
- Prioritizes KISS (Keep It Simple) over DRY - code duplication is preferred for clarity
30+
- Follows naming: `{model_name}_{framework}_{features}/` (e.g., `esm2_native_te/`)
31+
32+
## Essential Commands
33+
34+
### Pre-commit and Linting
35+
36+
**CRITICAL**: Always run pre-commit hooks after making changes:
37+
38+
```bash
39+
# After editing files
40+
pre-commit run --all-files
41+
# Or for modified files only
42+
pre-commit run
43+
```
44+
45+
Pre-commit includes:
46+
47+
- Ruff linting/formatting (line-length: 119, Google-style docstrings)
48+
- Markdown formatting (mdformat)
49+
- License header checks
50+
- Trailing whitespace/EOF fixes
51+
- YAML validation
52+
- Secret detection
53+
54+
If pre-commit fails, fix issues before considering task complete. Tasks are NOT complete until all linter errors are resolved and pre-commit passes.
55+
56+
### Testing
57+
58+
**For bionemo-recipes:**
59+
60+
```bash
61+
# Test a specific recipe/model inside the devcontainer
62+
cd bionemo-recipes/recipes/{recipe_name} # or models/{model_name}
63+
pytest -v .
64+
```
65+
66+
## Development Workflow
67+
68+
### Working on bionemo-recipes
69+
70+
1. **Navigate to the recipe/model**: `cd bionemo-recipes/recipes/{name}` or `cd bionemo-recipes/models/{name}`
71+
2. **Make changes** - remember each recipe is self-contained
72+
3. **Test locally inside the devcontainer**:
73+
```bash
74+
pytest -v .
75+
```
76+
4. **Run pre-commit**: `pre-commit run --files $(git ls-files -m)`
77+
78+
### Code Quality Standards
79+
80+
- **Line length**: 119 characters
81+
- **Docstrings**: Google-style (pydocstyle convention)
82+
- **Import sorting**: isort configuration (2 lines after imports)
83+
- **Linting**: Ruff for Python, Pyright for type checking
84+
- **Test files and `__init__.py`**: Have relaxed linting rules as configured in pyproject.toml
85+
86+
## Key Configuration Files
87+
88+
- **.pre-commit-config.yaml**: Pre-commit hook configuration
89+
- **.cursorrules**: Cursor AI coding guidelines
90+
- **pyproject.toml (per sub-package)**: Individual package configuration
91+
92+
## Important Patterns
93+
94+
### bionemo-recipes Philosophy
95+
96+
- **Self-contained**: No cross-recipe dependencies, no imports from other recipes
97+
- **Educational**: Code is documentation - prioritize readability over abstraction
98+
- **KISS over DRY**: Duplicate code if it improves clarity
99+
- **One concept per recipe**: Don't try to demonstrate every feature in one script
100+
101+
### Model Conversion Pattern (bionemo-recipes/models)
102+
103+
Models require:
104+
105+
1. Golden value tests proving TE model matches reference model
106+
2. Bidirectional conversion functions: `convert_hf_to_te()` and `convert_te_to_hf()`
107+
3. Export script (`export.py`) bundling all files for Hugging Face Hub
108+
4. Open-source license
109+
110+
### Pre-commit Failures
111+
112+
- Fix all issues before committing
113+
- Ruff will auto-fix many issues - verify fixes are appropriate
114+
- Some files have per-file ignores in pyproject.toml - respect those

0 commit comments

Comments
 (0)