Skip to content

klein2ms/python-devcontainer

Repository files navigation

python-devcontainer

A Python development container for Visual Studio Code.

Motivation

The intention behind this project is to create a base development container that can be used in individual project repositories to setup an out-of-the-box development experience so that developers can get going quickly.

Prerequisites

Features

  • Access and manage Docker on the Host machine from within the dev container
  • Starship is installed as the default shell prompt
  • GitHub CLI is installed

Basic Usage

The easiest way to get started is to download the /templates/.devcontainer folder into your current project.

curl -L https://github.com/klein2ms/python-devcontainer/archive/master.tar.gz | tar -xz --strip=2 python-devcontainer-master/template/.devcontainer

The templates folder also contains a launch.json file which adds a nice F5 keyboard shortcut to run django. You can grab the whole .vscode folder using the following.

curl -L https://github.com/klein2ms/python-devcontainer/archive/master.tar.gz | tar -xz --strip=2 python-devcontainer-master/template/.vscode

In VSCode, open the Command Palette F1 and select Remote-Containers: Reopen in Container.

Advanced Usage

The base devcontainer image accepts build arguments that can be set when building a derived image to extend the base image with additional packages and configurations.

This prevents the need of having to author additional code in the Dockerfile for a derived image. But, obviously that can be done as well.

Install additional Debian packages

Add DEBIAN_DEPS with a list of space separated packages to the list of build arguments.

# .devcontainer/docker-compose.yml
app:
    build:
        args:
            DEBIAN_DEPS: "nano tree"

Install nodejs and npm packages

Add NPM_DEPS with a list of space separated packages to the list of build arguments.

# .devcontainer/docker-compose.yml
app:
    build:
        args:
            NPM_DEPS: "yarn gulp"

Install additional pip packages

Add PIP_DEPS with a list of space separated packages to the list of build arguments.

# .devcontainer/docker-compose.yml
app:
    build:
        args:
            PIP_DEPS: "pylint pylint-django"

Prior Art and Acknowledgements

  • This project is highly influenced by the godevcontainer created by @qdm12.

License

This repository is under an MIT license unless otherwise indicated.

About

A Python development container for Visual Studio Code

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •