-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add basic VS Code dev container config #4517
base: maintenance
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.234.0/containers/python-3/.devcontainer/base.Dockerfile | ||
|
||
# [Choice] Python version (use -bullseye variants on local arm64/Apple Silicon): 3, 3.10, 3.9, 3.8, 3.7, 3.6, 3-bullseye, 3.10-bullseye, 3.9-bullseye, 3.8-bullseye, 3.7-bullseye, 3.6-bullseye, 3-buster, 3.10-buster, 3.9-buster, 3.8-buster, 3.7-buster, 3.6-buster | ||
ARG VARIANT="3.10-bullseye" | ||
FROM mcr.microsoft.com/vscode/devcontainers/python:0-${VARIANT} | ||
|
||
# [Optional] If your pip requirements rarely change, uncomment this section to add them to the image. | ||
# COPY requirements.txt /tmp/pip-tmp/ | ||
# RUN pip3 --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/requirements.txt \ | ||
# && rm -rf /tmp/pip-tmp |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
{ | ||
"name": "OctoPrint - Python 3", | ||
"build": { | ||
"dockerfile": "Dockerfile", | ||
"context": "..", | ||
"args": { | ||
"VARIANT": "3.10-bullseye" | ||
} | ||
}, | ||
"settings": { | ||
"python.defaultInterpreterPath": "/usr/local/bin/python", | ||
"python.formatting.provider": "black", | ||
"python.formatting.blackArgs": ["--config", "black.toml"], | ||
"editor.formatOnSave": true, | ||
"python.sortImports.args": ["--profile=black"], | ||
"[python]": { | ||
"editor.codeActionsOnSave": { | ||
"source.organizeImports": true | ||
}, | ||
"editor.defaultFormatter": "ms-python.vscode-pylance" | ||
}, | ||
"python.linting.flake8Enabled": true, | ||
"python.linting.enabled": true, | ||
"python.formatting.autopep8Path": "/usr/local/py-utils/bin/autopep8", | ||
"python.formatting.blackPath": "/usr/local/py-utils/bin/black", | ||
"python.formatting.yapfPath": "/usr/local/py-utils/bin/yapf", | ||
"python.linting.banditPath": "/usr/local/py-utils/bin/bandit", | ||
"python.linting.flake8Path": "/usr/local/py-utils/bin/flake8", | ||
"python.linting.mypyPath": "/usr/local/py-utils/bin/mypy", | ||
"python.linting.pycodestylePath": "/usr/local/py-utils/bin/pycodestyle", | ||
"python.linting.pydocstylePath": "/usr/local/py-utils/bin/pydocstyle", | ||
"python.linting.pylintPath": "/usr/local/py-utils/bin/pylint", | ||
Comment on lines
+24
to
+32
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The downside of relying on the ones that came with the container is that there is no control over which versions it uses. Especially with black, mypy & pylint; a single version difference may change behavior quite a bit. I would applaud/recommend pin/controlling QA tools on a project level; and installing and using them locally. |
||
"python.languageServer": "Pylance", | ||
"editor.formatOnSaveMode": "file" | ||
}, | ||
"extensions": ["ms-python.python", "ms-python.vscode-pylance"], | ||
"portsAttributes": { | ||
"8080": { | ||
"label": "OctoPrint", | ||
"onAutoForward": "openBrowser", | ||
"protocol": "http" | ||
} | ||
}, | ||
"postCreateCommand": "pip install --upgrade pip && pip install -e '.[develop,plugins,docs]' && pre-commit install && git config blame.ignoreRevsFile .git-blame-ignore-revs", | ||
"postAttachCommand": "octoprint serve --host=127.0.0.1 --port=8080", | ||
"remoteUser": "vscode", | ||
"customizations": { | ||
"vscode": { | ||
"extensions": ["ms-python.python", "ms-python.vscode-pylance"] | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the merger of #4511, this is no longer needed.