Skip to content

Commit

Permalink
build: add devcontainer setup (#1725)
Browse files Browse the repository at this point in the history
Add devcontainer configuration with special customizations for VS Code.

---------

Co-authored-by: Enrique Gonzalez Paredes <[email protected]>
  • Loading branch information
havogt and egparedes authored Nov 25, 2024
1 parent 0a01597 commit 1cb29e3
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 1 deletion.
24 changes: 24 additions & 0 deletions .devcontainer/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File (just my code)",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"justMyCode": true
},
{
"name": "Python: Current File (all)",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"justMyCode": false
}
]
}
5 changes: 5 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM mcr.microsoft.com/devcontainers/python:1-3.10-bookworm
RUN apt-get update \
&& export DEBIAN_FRONTEND=noninteractive && apt-get install -y libboost-dev \
&& apt-get clean && rm -rf /var/cache/apt/* && rm -rf /var/lib/apt/lists/* && rm -rf /tmp/*
RUN curl -LsSf https://astral.sh/uv/install.sh | env UV_INSTALL_DIR="/bin" sh
49 changes: 49 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/python
{
"name": "Python 3",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"build": {
"dockerfile": "Dockerfile"
},

// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "bash .devcontainer/setup.sh",

"containerEnv": {
"PRE_COMMIT_HOME": "/workspaces/gt4py/.caches/pre-commit"
},

// Configure tool-specific properties.
"customizations": {
// Configure properties specific to VS Code.
"vscode": {
// Set *default* container specific settings.json values on container create.
"settings": {
"python.formatting.provider": "ruff",
"python.testing.pytestEnabled": true,
"python.defaultInterpreterPath": "/workspaces/gt4py/.venv/bin/python",
"files.insertFinalNewline": true,
"python.terminal.activateEnvironment": true,
"cmake.ignoreCMakeListsMissing": true
},
"extensions": [
"charliermarsh.ruff",
"donjayamanne.githistory",
"github.vscode-github-actions",
"lextudio.restructuredtext",
"ms-python.python",
"ms-vsliveshare.vsliveshare",
"swyddfa.esbonio"
]
}
}
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
10 changes: 10 additions & 0 deletions .devcontainer/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh

ln -sfn /workspaces/gt4py/.devcontainer/.vscode /workspaces/gt4py/.vscode
uv venv .venv
source .venv/bin/activate
uv pip install -r requirements-dev.txt
uv pip install -e .
uv pip install -i https://test.pypi.org/simple/ atlas4py
pre-commit install --install-hooks
deactivate
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -159,5 +159,5 @@ venv.bak/

### Others ###
.obsidian

coverage.json
.caches

0 comments on commit 1cb29e3

Please sign in to comment.