Adopt devcontainer from https://github.com/jbcoe/pytorch-sandbox#16
Adopt devcontainer from https://github.com/jbcoe/pytorch-sandbox#16
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds devcontainer support to enable consistent development environments using Docker and VS Code's devcontainer feature. The configuration is copied from the pytorch-sandbox repository and adapted for this project.
Changes:
- Added devcontainer configuration with Python 3.12 base image
- Configured VS Code extensions for Python development (Ruff, Pylance, Jupyter, mypy)
- Set up non-root user environment with uv package manager
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| .devcontainer/devcontainer.json | Defines the devcontainer configuration including VS Code extensions, settings, mounts, and environment variables |
| .devcontainer/Dockerfile | Creates a Python 3.12-slim based container with essential development tools and uv package manager |
| .devcontainer/.dockerfilelintrc | Configures dockerfile linting to allow sudo usage |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
.devcontainer/devcontainer.json
Outdated
| }, | ||
| "mounts": [ | ||
| "source=${localWorkspaceFolder},target=/workspace,type=bind,consistency=cached", | ||
| "source=${localEnv:HOME}${localEnv:USERPROFILE}/.ssh,target=/home/vscode/.ssh,type=bind,consistency=cached" |
There was a problem hiding this comment.
The SSH mount attempts to support both Unix (HOME) and Windows (USERPROFILE) by concatenating environment variables. However, if both variables are set (which can happen on Windows with Git Bash or WSL), this will concatenate both paths creating an invalid path. A more robust approach would be to use conditional mounting or test this configuration on both platforms to ensure it works as intended.
| "source=${localEnv:HOME}${localEnv:USERPROFILE}/.ssh,target=/home/vscode/.ssh,type=bind,consistency=cached" | |
| "source=${localEnv:HOME}/.ssh,target=/home/vscode/.ssh,type=bind,consistency=cached" |
There was a problem hiding this comment.
I'll just use the UNIX-compliant path.
.devcontainer/devcontainer.json
Outdated
| @@ -0,0 +1,52 @@ | |||
| { | |||
| "name": "py_cppmodel Dev Container", | |||
There was a problem hiding this comment.
The container name uses an underscore ("py_cppmodel Dev Container") while the project name in pyproject.toml uses a hyphen ("py-cppmodel"). For consistency with the project naming conventions, consider using "py-cppmodel Dev Container" instead.
| "name": "py_cppmodel Dev Container", | |
| "name": "py-cppmodel Dev Container", |
Closes #6