GithubHelp home page GithubHelp logo

jameshutchison / python-dev-container-template Goto Github PK

View Code? Open in Web Editor NEW
10.0 2.0 0.0 66 KB

A template for creating a best-practice following dev container

License: MIT License

Dockerfile 3.56% Shell 50.86% Python 45.58%
dev-container python template

python-dev-container-template's Introduction

The Python Dev Container Template

An opinionated template for a Python dev container

Features

  • Likely extensions installed
  • Poetry for dependency management
  • Mypy uses the Daemon for increased performance
  • Ruff instead of flake8, uses Ruff extension which features an autofix command
  • PostStartCommand and PostCreateCommand, with background script already configured and created
  • The virtual environment is under a named volume for good performance
  • Docker-in-docker enabled
  • Line length: black wraps at the 98 soft limit, ruff errors at the 120 hard limit
  • Format on save as well as organize imports
  • Debug outside your code

Limitations

  • Currently just VS Code configurations

Roles and Responsibilities

The .devcontainer/devcontainer.json file defines the extensions, settings, etc that are the foundation.

This means .vscode/settings.json isn't generated yet. This allows for it to be used as user settings or as additional settings. If you wish to have them be user settings, add .vscode/settings.json to the .gitignore file.

Poetry is used for dependency management. The virtual environment is under .env.

  • Add production dependency: poetry add <dependency>
  • Add development dependnecy: poetry add <dependency> --group=dev

Tests are to be located under the tests directory.

Usage (inside your unconfigured dev container or codespace)

  • Step 1 - cd /workspaces/
  • Step 2 - sudo git clone https://github.com/JamesHutchison/python-dev-container-template.git
  • Step 3 - cd /workspaces/my-project
  • Step 4 - /workspaces/python-dev-container-template/py_dev_container_template.py (script runs without args)
  • Step 5 - cmd/ctrl + shift + p -> Rebuild container

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.