This is my template for new Python projects in VSCode. VSCode devcontainers are used for local development. Poetry is used for Python dependency management.
- Install Docker
- Install VSCode
- Install the VSCode Dev Containers Extension
- Copy this directory to the desired location and rename it as appropriate
- Remove the
.git
directory. Usegit init
to start a new repo - Open the directory in VSCode
- When prompted, choose "Reopen in Container". Alternatively choose
Dev Containers: Rebuild and Reopen in Container
from the command palette - If this is a brand new project, a terminal will appear with prompts to initialize Poetry
- Develop some software!
The Python environment will automatically be activated within the VSCode integrated terminal. If for some reason that doesn't work, closing the terminal and opening a new one should fix it.
The Ruff extension will automatically lint Python files. Feel free to change this if you don't like it.
The Jupyter extension is installed, and notebooks will work out of the box. Just make sure to select .venv/bin/python
as the kernel.