Skip to content

Commit

Permalink
feat: Add devcontainer configuration
Browse files Browse the repository at this point in the history
This will allow folks to easily use devcontainers to
develop aider.
  • Loading branch information
mikegehard committed Jan 19, 2025
1 parent a8b2726 commit 07e398b
Show file tree
Hide file tree
Showing 4 changed files with 93 additions and 2 deletions.
31 changes: 31 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"name": "Aider Development",
"image": "paulgauthier/aider-full:latest",
"customizations": {
"vscode": {
"extensions": [
"ms-python.python",
"ms-python.vscode-pylance",
"ms-python.flake8"
],
"settings": {
"python.defaultInterpreterPath": "/home/appuser/venv/bin/python",
"python.linting.enabled": true,
"python.linting.flake8Enabled": true,
"python.formatting.provider": "none",
"editor.formatOnSave": true,
"editor.rulers": [
100
]
}
}
},
"postCreateCommand": "pip install -e . && pip install -r requirements/requirements-dev.txt && pre-commit install",
"postAttachCommand": "aider",
"workspaceMount": "source=${localWorkspaceFolder},target=/home/appuser/app,type=bind",
"workspaceFolder": "/home/appuser/app",
"remoteEnv": {
"OPENAI_API_KEY": "${localEnv:OPENAI_API_KEY}",
"ANTHROPIC_API_KEY": "${localEnv:ANTHROPIC_API_KEY}"
}
}
5 changes: 5 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copy this file to .env and adjust values as needed
# The values will be loaded into the devcontainer
# and can be used to configure Aider.
OPENAI_API_KEY=your_api_key_here
ANTHROPIC_API_KEY=your_api_key_here
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ aider/_version.py
.venv/
.#*
.gitattributes
tmp.benchmarks/
tmp.benchmarks/
.env
56 changes: 55 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ For development, at least install the development dependencies:
pip install -r requirements/requirements-dev.txt
```

Consider installing other optional dependencies from the `requirements/` directory, if your development work needs them.
Consider installing other optional dependencies from the `requirements/` directory, if your development work needs them.

Note that these dependency files are generated by `./scripts/pip-compile.sh` and then committed. See [Managing Dependencies](#managing-dependencies).

Expand Down Expand Up @@ -151,6 +151,60 @@ The project's documentation is built using Jekyll and hosted on GitHub Pages. To

The built documentation will be available in the `aider/website/_site` directory.

### Devcontainers as a development environment

The project includes a `.devcontainer` configuration that provides a fully configured development environment. You can use this either through VS Code or the devcontainer CLI.

#### Using VS Code

1. Install the "Remote - Containers" extension in VS Code
2. Open the project folder in VS Code
3. When prompted to "Reopen in Container", click yes
- Or use the Command Palette (F1) and select "Remote-Containers: Reopen in Container"
4. VS Code will build and start the development container
5. The container includes all dependencies and tools needed for development

#### Using Devcontainer CLI

1. Install the devcontainer CLI:
```bash
npm install -g @devcontainers/cli
```

2. Build and start the development container:
```bash
devcontainer up --workspace-folder .
```

The development container provides:
- All Python dependencies pre-installed
- Pre-commit hooks configured
- Development tools like git, pytest, etc.
- Proper Python version and environment

### Using GitHub Codespaces

You can use GitHub Codespaces as a development environment:

1. Click the "Code" button on the repository page
2. Select the "Codespaces" tab
3. Click "Create codespace on main"

The codespace will automatically:
- Set up the development container
- Install all dependencies
- Configure pre-commit hooks
- Set up the Python environment

#### Environment Variables

You'll need to set up environment variables in your codespace:

1. Go to [codespace Settings](https://github.com/settings/codespaces)
2. Add the following Secrets from your `.env` file:
- OPENAI_API_KEY
- ANTHROPIC_API_KEY

## Coding Standards

### Python Compatibility
Expand Down

0 comments on commit 07e398b

Please sign in to comment.