Skip to content

Opinionated set of tools for developing in Python and best practices around building python applications.

License

Notifications You must be signed in to change notification settings

solita/production-ready-python-template

Repository files navigation

Python project-template with VSCode Devcontainer

Note on tooling: Reproducible, robust, and yet simple development setup for Python. Developing in VSCode Dev Containers.

Prerequisites

Getting started

  1. Clone or Use Template:
# Clone the repo
git clone <this-repo> <your-project-name>
cd <your-project-name>
# Or use GitHub's "Use this template" button
# Or use GitHub CLI: gh repo create <your-project-name> --template <this-repo>
# just ensure to `git init`, otherwise pre-commit fails
  1. Configure Environment
# Copy sample environment file
cp .env.sample .env
# Edit .env if needed (e.g., set DEVELOPMENT=False)
  1. Replace Placeholders
  • Search and replace my-project in docker-compose.yml and python-project-template in pyproject.toml with your project name
  • Update name, version in pyproject.toml
  • Update the year and copyright holder in LICENSE
  • update this README.md for your project.
  1. Open in VS Code & Dev Container
# Open project folder in VS Code
code .
# When prompted, or using the Command Palette (Ctrl+Shift+P), select:
# > Dev Containers: Open Folder in Container (or similar)
  1. Develop
  • Add dependencies: uv add <package-name> (runs inside the container)
  • pre-commit (linting, formatting, testing) runs automatically on commit

Background

This template uses VSCode's Dev Containers (devcontainers) to provide a consistent, isolated development environment. The setup leverages Docker Compose with an extension pattern:

  • docker-compose.yml defines the base service configuration
  • .devcontainer/docker-compose.extend.yml extends the base configuration specifically for development
  • The extension mounts your local project directory to /app in the container, enabling real-time file synchronization
  • This allows you to work on code locally in VSCode while running it in a container environment

This approach ensures that all developers work with identical dependencies and configurations, regardless of their local setup, while maintaining the ability to edit files directly on the host system.

Tooling

  • uv for dependency management
  • VS Code devcontainers with docker compose-file
  • Multi-stage build with builder, also used for development, and production
  • debugging: debugpy
  • testing: pytest
  • linting & formatting: ruff
  • type-checking: mypy
  • environment variables: python-dotenv
  • pre-commit hooks

Development practices & style

About

Opinionated set of tools for developing in Python and best practices around building python applications.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published