🌐
GitHub
github.com › microsoft › vscode-dev-containers › blob › main › containers › python-3 › .devcontainer › devcontainer.json
vscode-dev-containers/containers/python-3/.devcontainer/devcontainer.json at main · microsoft/vscode-dev-containers
November 30, 2023 - // Update 'VARIANT' to pick a Python version: 3, 3.10, 3.9, 3.8, 3.7, 3.6 · // Append -bullseye or -buster to pin to an OS version. // Use -bullseye variants on local on arm64/Apple Silicon. "VARIANT": "3.10-bullseye", // Options · "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.
Author   microsoft
🌐
GitHub
github.com › devcontainers › features › blob › main › src › python › devcontainer-feature.json
features/src/python/devcontainer-feature.json at main · devcontainers/features
"text": "This dev container includes `python3` and `pip3` pre-installed and available on the `PATH`, along with the Python language extensions for Python development."
Author   devcontainers
Discussions

python - devcontainer.json for VScode using existing Container - Stack Overflow
How to use existing container in VSCode? I have a file called .devcontainer.json. The path is /home/myname/Documents/ABC/.devcontainer. { "name": "Kaggle Dev CPU", "... More on stackoverflow.com
🌐 stackoverflow.com
docker - VSCode remote-container default python interpreter - Stack Overflow
I then open a python file and hit ... 64-bit"(/usr/bin/python3) to "3.10.4 ('base':conda)" (/opt/conda/bin/python). Is there a way to avoid this last step? Perhaps adding something to the devcontainer.json file?... More on stackoverflow.com
🌐 stackoverflow.com
How fix Python import error in VS Code editor when using a Dev Container? - Stack Overflow
I've opened a project with the following structure in VS Code (1.71.0 on macOS, Intel) and activated a Dev Container (I've tried the default Python 3.9 and 3.10 containers from Microsoft, with and without using python3 -m venv ...): project/ .devcontainer/ devcontainer.json Dockerfile foo/ ... More on stackoverflow.com
🌐 stackoverflow.com
Python Devcontainer Setup for VSCode
You don't really need a separate virtualenv if you're using a container. More on reddit.com
🌐 r/vscode
2
1
September 28, 2023
🌐
Docker Hub
hub.docker.com › r › microsoft › devcontainers-python
microsoft/devcontainers-python - Docker Image
Develop Python 3 applications. See history⁠ for information on the contents of published images. You can directly reference pre-built versions of Dockerfile by using the image property in .devcontainer/devcontainer.json or updating the FROM statement in your own Dockerfile with one of the ...
🌐
GitHub
github.com › microsoft › vscode-remote-try-python
GitHub - microsoft/vscode-remote-try-python: Python sample project for trying out Dev Containers · GitHub
Notice that the Python extension is already installed in the container since the .devcontainer/devcontainer.json lists "ms-python.python" as an extension to install automatically when the container is created.
Starred by 919 users
Forked by 1.8K users
Languages   Python 73.7% | HTML 26.3%
🌐
Xebia
xebia.com › home › blog › how to create a devcontainer for your python project
How To Create A Devcontainer For Your Python Project | Xebia
November 21, 2022 - What files are required to create a devcontainer for a Python project? A typical setup includes a .devcontainer/devcontainer.json configuration file and optionally a Dockerfile. These define the runtime, dependencies, and tools required for the development environment.
🌐
Medium
andypickup.com › developing-in-python-with-dev-containers-part-1-setup-f1aeb89cbfed
Developing in Python with Dev Containers — Part 1: Setup | by Andy Pickup | Medium
April 15, 2024 - VSCode Command Palette — select Python container image · This will create a .devcontainer folder with a devcontainer.json file inside. This json file is super basic and just gives the container a name and the path to the container image.
🌐
Towards Data Science
towardsdatascience.com › home › latest › setting a dockerized python environment – the elegant way
Setting A Dockerized Python Environment - The Elegant Way | Towards Data Science
January 21, 2025 - In the next section, we will start ... Python image (python:3.10). The below devcontainer.json file provides a simple example for setting up a Python environment....
Find elsewhere
🌐
Stack Overflow
stackoverflow.com › questions › 73520003 › devcontainer-json-for-vscode-using-existing-container
python - devcontainer.json for VScode using existing Container - Stack Overflow
I have a file called .devcontainer.json. The path is /home/myname/Documents/ABC/.devcontainer. { "name": "Kaggle Dev CPU", "image": "gcr.io/kaggle-images/python:v100", "extensions": [ "ms-python.python", ], "settings": { "terminal.integrated.shell.linux": "/bin/bash", "python.pythonPath": "/opt/conda/bin/python" }, "devPort": 8888, "shutdownAction": "none" }
🌐
Medium
medium.com › @dexterwilliams04 › getting-started-with-python-3-dev-containers-4f14821fec6b
Getting Started with Python 3 Dev Containers | by Dexter Williams | Medium
October 1, 2020 - The code snippet below shows a list of Python folder projects that come directly from the VS Code dev container gallery repo: $ tree vs-code-dev-containers vs-code-dev-containers ├── containers │ ├── dotnetcore │ │ └── devcontainer.json # dev container definition │ ├── python-3-anaconda │ │ └── devcontainer.json # dev container definition │ ├── python-3-device-simulator-express │ │ └── devcontainer.json # dev container definition │ ├── python-3-miniconda │ │ └── devcontainer.json # dev container definition │ ├── python-3-postgres │ │ └── devcontainer.json # dev container definition │ ├── python-3 │ │ └── devcontainer.json # dev container definition │ ├── ...
🌐
Visual Studio Code
code.visualstudio.com › docs › devcontainers › create-dev-container
Create a Dev Container
November 3, 2021 - Python & PostgreSQL - A Python container that connects to PostgreSQL in a different container. Docker-Outside-of-Docker Compose - Includes the Docker CLI and illustrates how you can use it to access your local Docker install from inside a dev ...
🌐
Future-architect
future-architect.github.io › articles › 20231212a
Dev Containersの始め方(2) : Python環境 | フューチャー技術ブログ
December 12, 2023 - アプリ開発で必要なライブラリを追加するときは、pyproject.tomlのproject/dependenciesのリストに追加した後に、インストールしてlockファイル相当のrequirements.txtを作ります。このファイルはコンテナ作成やデプロイに使えます。このままだとdevセクションのものも入ってしまうのですが・・・このあたりもPythonツールチェーンが良くなって欲しいところの1つ。 · プロジェクトの雛形ができたら開発ツール類を整備します。必要な拡張、あとは設定などはdevcontainer.jsonに書いておくと環境を作った瞬間にチーム内で同じ設定を共有できます。
🌐
Medium
medium.com › data-science › setting-a-dockerized-python-environment-the-elegant-way-f716ef85571d
Setting A Dockerized Python Environment — The Elegant Way | by Rami Krispin | TDS Archive | Medium
April 6, 2024 - In the next section, we will start ... Python image (python:3.10). The below devcontainer.json file provides a simple example for setting up a Python environment....
🌐
GitHub
github.com › microsoft › vscode-dev-containers › blob › main › containers › python-3 › README.md
vscode-dev-containers/containers/python-3/README.md at main · microsoft/vscode-dev-containers
While the definition itself works unmodified, you can select the version of Python the container uses by updating the VARIANT arg in the included devcontainer.json (and rebuilding if you've already created the container).
Author   microsoft
🌐
Medium
medium.com › @rami.krispin › setting-a-dockerized-python-development-environment-template-de2400c4812b
Setting a Dockerized Python Development Environment Template | by Rami Krispin | Medium
January 13, 2024 - The template was created to enable seamless customization and modification of the Python environment using environment variables. That includes the Python version, the virtual environment name, installation libraries, setting environment variables, etc. Once you clone the template, you can customize devcontainer.json file according to your environment requirements:
🌐
Medium
medium.com › marvelous-mlops › how-to-start-with-dev-containers-1e92bf0e0f78
How to start with Dev Containers. Using a virtual environment to isolate… | by Başak Tuğçe Eskili | Marvelous MLOps | Medium
January 3, 2024 - All container configuration is stored in a standard devcontainer.json file in the .devcontainer folder. This packages instructions for your environment. You can start with any base image of a specific language, generate a new development environment, and start developing with it. Let’s create a new development container for a Python project from a base image.
🌐
DEV Community
dev.to › jajera › python-development-in-vscode-using-devcontainer-2ao1
Python Development in VSCode Using Devcontainer - DEV Community
December 1, 2024 - Build the Docker container as specified in the devcontainer.json configuration file. Install any dependencies (e.g., Python packages) listed in requirements.txt or other project files.
🌐
Reddit
reddit.com › r/vscode › python devcontainer setup for vscode
r/vscode on Reddit: Python Devcontainer Setup for VSCode
September 28, 2023 -

I'm starting to look into devcontainers with VSCode and I am looking for a container configuration (Dockerfile/devcontainer.json) that sets up a good Python development environment with some recommended extensions and settings (e.g. paths, venv, fromatting, linting) for beginners (its been some time since I was doing Python development), but that's not over-complicated.

I have the following resources that I have pieced together as a starting point and could use some input and feedback on these (I'm not sure if everything makes sense) and what to improve for a good development experience. Particularly I'm looking for input on the VSCode extensions / settings.

docker-compose.dev.yaml

version: '3.9'

networks: app-dev-network: 
    driver: bridge 
    name: app-dev-network

services:

backend:

    image: backend-dev-image
    container_name: backend-dev-container
    build:
        context: ./
        dockerfile: ./Dockerfile.dev
    volumes:
        - ..:/workspace:cache
    networks:
        - app-dev-network
    ports:
        - target: 5000 
          published: 5000

    command: sleep infinity

Dockerfile.dev

ARG VARIANT="3.11-bookworm" 
FROM mcr.microsoft.com/devcontainers/python:${VARIANT}

RUN apt-get update && \    
apt-get upgrade --yes --no-install-recommends && \    
apt-get clean

ENV PYTHONUNBUFFERED=1

devcontainer.json

{
    "name": "Backend",
    "dockerComposeFile": [
        "./docker-compose.dev.yaml"
    ],
    "service": "backend",
    "workspaceFolder": "/workspace",

    "customizations": {  
        "vscode": {  
            "extensions": [  
                "ms-python.python",  
            ],  
            "settings": {  
                "python.pythonPath": "${workspaceFolder}/.venv/bin/python",             
                "python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python",  
            }  
        }  
    },

    "postCreateCommand": "pip3 install --user -r requirements.txt"
}