A Python project template that emphasizes developer experience and code quality. This repository provides a consistent, containerized development environment with best-practice tooling pre-configured.
- Dev Containers: Consistent development environment across team members using VS Code and Docker
- Modern Tooling:
uv: Fast, reliable Python package managementruff: All-in-one Python linter and formatterpyright: Static type checkingpytest: Testing framework
- Structured Logging: Pre-configured JSON-based logging setup for structured, consistent log output
- Type Safety: Built-in support for Pydantic data validation and serialization
- Quality Assurance: Comprehensive linting, formatting, and testing pipeline
git clone https://github.com/matthiaszimmermann/python-base.git- Open the project in VS Code:
code python-base- When prompted, click "Reopen in Container"
Add the local modules
uv pip install -e .Run the examples:
uv run -m main
uv run -m examples.user
uv run -m examples.flightThe project uses ruff for both linting and formatting. Run the following command to check your code:
uv run ruff format . --check --diffThe project uses pyright for type checking. Run the following command to check your code:
uv run pyrightRun the test suite with:
uv run pytestThe project provides a centralized logging configuration through logging_config.py that:
- Loads structured logging settings from
logging_config.json - Ensures the configuration is loaded only once
- Provides a convenient
get_logger()function for consistent logger creation
The JSON configuration includes:
- Structured logging with timestamp, logger name, level, and message
- Console output for development
- Configurable log levels (default: DEBUG for loggers, INFO for console output)
- Extensible format for adding custom handlers (e.g., file output, external services)
To use logging in your modules:
from logging_config import get_logger
logger = get_logger(__name__)
logger.info("Application started")This repository follows modern Python development practices. All configuration is centralized in pyproject.toml for maintainability. Before contributing:
- Ensure your code passes all linting checks (
uv run ruff check) - Ensure your code passes all existing unit tests (
uv run pytest) - Add tests for new functionality
- Update documentation as needed
- Verify all CI checks pass