forked from numpy/numpy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DEV: Add initial devcontainer config for codepaces (numpy#22722)
* initial files * STY: remove noop.txt (we have an environment.yaml) some other style fixups Co-authored-by: Sarah Kaiser <[email protected]>
- Loading branch information
1 parent
c4ce4e9
commit 4c4e803
Showing
3 changed files
with
91 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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 @@ | ||
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/python-3-anaconda/.devcontainer/base.Dockerfile | ||
|
||
FROM mcr.microsoft.com/vscode/devcontainers/anaconda:0-3 | ||
|
||
# [Choice] Node.js version: none, lts/*, 16, 14, 12, 10 | ||
ARG NODE_VERSION="none" | ||
RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi | ||
|
||
|
||
# Copy environment.yml (if found) to a temp location so we update the environment. Also | ||
# copy "noop.txt" so the COPY instruction does not fail if no environment.yml exists. | ||
COPY environment.yml* /tmp/conda-tmp/ | ||
RUN if [ -f "/tmp/conda-tmp/environment.yml" ]; then umask 0002 && /opt/conda/bin/conda env create -f /tmp/conda-tmp/environment.yml; fi \ | ||
&& rm -rf /tmp/conda-tmp | ||
|
||
# [Optional] Uncomment this section to install additional OS packages. | ||
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ | ||
# && apt-get -y install --no-install-recommends <your-package-list-here> |
This file contains 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 @@ | ||
# Display a notice when not running in GitHub Codespaces | ||
|
||
cat << 'EOF' > /usr/local/etc/vscode-dev-containers/conda-notice.txt | ||
When using "conda" from outside of GitHub Codespaces, note the Anaconda repository | ||
contains restrictions on commercial use that may impact certain organizations. See | ||
https://aka.ms/vscode-remote/conda/anaconda | ||
EOF | ||
|
||
notice_script="$(cat << 'EOF' | ||
if [ -t 1 ] && [ "${IGNORE_NOTICE}" != "true" ] && [ "${TERM_PROGRAM}" = "vscode" ] && [ "${CODESPACES}" != "true" ] && [ ! -f "$HOME/.config/vscode-dev-containers/conda-notice-already-displayed" ]; then | ||
cat "/usr/local/etc/vscode-dev-containers/conda-notice.txt" | ||
mkdir -p "$HOME/.config/vscode-dev-containers" | ||
((sleep 10s; touch "$HOME/.config/vscode-dev-containers/conda-notice-already-displayed") &) | ||
fi | ||
EOF | ||
)" | ||
|
||
echo "${notice_script}" | tee -a /etc/bash.bashrc >> /etc/zsh/zshrc |
This file contains 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,55 @@ | ||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: | ||
// https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/python-3-anaconda | ||
{ | ||
"name": "Numpy (devcontainer)", | ||
"build": { | ||
"context": "..", | ||
"dockerfile": "Dockerfile", | ||
"args": { | ||
"NODE_VERSION": "lts/*" | ||
} | ||
}, | ||
|
||
// Configure tool-specific properties. | ||
"customizations": { | ||
// Configure properties specific to VS Code. | ||
"vscode": { | ||
// Set *default* container specific settings.json values on container create. | ||
"settings": { | ||
"python.defaultInterpreterPath": "/opt/conda/bin/python", | ||
"python.linting.enabled": true, | ||
"python.linting.pylintEnabled": true, | ||
"python.formatting.autopep8Path": "/opt/conda/bin/autopep8", | ||
"python.formatting.yapfPath": "/opt/conda/bin/yapf", | ||
"python.linting.flake8Path": "/opt/conda/bin/flake8", | ||
"python.linting.pycodestylePath": "/opt/conda/bin/pycodestyle", | ||
"python.linting.pydocstylePath": "/opt/conda/bin/pydocstyle", | ||
"python.linting.pylintPath": "/opt/conda/bin/pylint" | ||
}, | ||
|
||
// Add the IDs of extensions you want installed when the container is created. | ||
"extensions": [ | ||
"ms-python.python", | ||
"ms-python.vscode-pylance", | ||
"njpwerner.autodocstring", | ||
"ms-toolsai.jupyter", | ||
"donjayamanne.python-environment-manager", | ||
"ms-azuretools.vscode-docker" | ||
] | ||
} | ||
}, | ||
|
||
// 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": "conda init", | ||
|
||
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. | ||
"remoteUser": "vscode", | ||
"features": { | ||
"ghcr.io/devcontainers/features/rust:1": { | ||
"version": "latest" | ||
} | ||
} | ||
} |