Skip to content

Commit 3666fd3

Browse files
authored
chore: add vscode devcontainer configuration (#79)
1 parent 470cccc commit 3666fd3

File tree

2 files changed

+68
-0
lines changed

2 files changed

+68
-0
lines changed

.devcontainer/Dockerfile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.191.1/containers/python-3/.devcontainer/base.Dockerfile
2+
3+
# [Choice] Python version: 3, 3.9, 3.8, 3.7, 3.6
4+
ARG VARIANT="3.9"
5+
FROM mcr.microsoft.com/vscode/devcontainers/python:${VARIANT}
6+
7+
# [Choice] Node.js version: none, lts/*, 16, 14, 12, 10
8+
ARG NODE_VERSION="none"
9+
RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
10+
11+
# [Optional] If your pip requirements rarely change, uncomment this section to add them to the image.
12+
# COPY requirements.txt /tmp/pip-tmp/
13+
# RUN pip3 --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/requirements.txt \
14+
# && rm -rf /tmp/pip-tmp
15+
16+
# [Optional] Uncomment this section to install additional OS packages.
17+
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
18+
# && apt-get -y install --no-install-recommends <your-package-list-here>
19+
20+
# [Optional] Uncomment this line to install global node packages.
21+
# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1

.devcontainer/devcontainer.json

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
2+
// https://github.com/microsoft/vscode-dev-containers/tree/v0.191.1/containers/python-3
3+
{
4+
"name": "Python 3",
5+
"build": {
6+
"dockerfile": "Dockerfile",
7+
"context": "..",
8+
"args": {
9+
// Update 'VARIANT' to pick a Python version: 3, 3.6, 3.7, 3.8, 3.9
10+
"VARIANT": "3.9",
11+
// Options
12+
"NODE_VERSION": "none"
13+
}
14+
},
15+
16+
// Set *default* container specific settings.json values on container create.
17+
"settings": {
18+
"python.pythonPath": "/usr/local/bin/python",
19+
"python.languageServer": "Pylance",
20+
"python.linting.enabled": true,
21+
"python.linting.pylintEnabled": true,
22+
"python.formatting.autopep8Path": "/usr/local/py-utils/bin/autopep8",
23+
"python.formatting.blackPath": "/usr/local/py-utils/bin/black",
24+
"python.formatting.yapfPath": "/usr/local/py-utils/bin/yapf",
25+
"python.linting.banditPath": "/usr/local/py-utils/bin/bandit",
26+
"python.linting.flake8Path": "/usr/local/py-utils/bin/flake8",
27+
"python.linting.mypyPath": "/usr/local/py-utils/bin/mypy",
28+
"python.linting.pycodestylePath": "/usr/local/py-utils/bin/pycodestyle",
29+
"python.linting.pydocstylePath": "/usr/local/py-utils/bin/pydocstyle",
30+
"python.linting.pylintPath": "/usr/local/py-utils/bin/pylint"
31+
},
32+
33+
// Add the IDs of extensions you want installed when the container is created.
34+
"extensions": [
35+
"ms-python.python",
36+
"ms-python.vscode-pylance"
37+
],
38+
39+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
40+
// "forwardPorts": [],
41+
42+
// Use 'postCreateCommand' to run commands after the container is created.
43+
"postCreateCommand": "pip3 install --user -r requirements-dev.txt",
44+
45+
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
46+
"remoteUser": "vscode"
47+
}

0 commit comments

Comments
 (0)