Starter template for python projects
- environment management with Conda
- project metadata and dependency management with Poetry
- preconfigured continuous integration tasks
- code formatting with isort and Black
- code linting with isort, Black, Flake8, Bandit and Mypy
- unit tests with pytest
- pre-commit hooks
- CICD pipelines with GitHub Actions
- application
- logging with standard logging and python-json-logger
- configuration with standard configparser, python-dotenv and pydantic
- command line with Typer
- web service with FastAPI, Uvicorn and Gunicorn
- deployment with Docker images
- development image based on
python:latest
- lightweight production image based on
python:slim
using multi-stage build
- development image based on
- Make formula for common development tasks
- install dependencies
- run continuous integration tasks
- run application
- build Docker images
Clone this repository or use it as a template to generate a new repository.
Update the project name and metadata in pyproject.toml
and configs/main.ini
.
Use Conda to create a virtual environment and activate it for the project.
PROJECT_NAME = python-project-template
PYTHON_VERSION = 3.8
conda create --name $PROJECT_NAME --yes python=$PYTHON_VERSION
conda activate $PROJECT_NAME
Install Poetry with pip. Then install project dependencies with Poetry.
make deps-install
Use Poetry to add project and development dependencies into pyproject.toml
.
NOTE: Poetry must be included as a development dependency to prevent Poetry from uninstalling itself and its dependencies.
# development dependency
poetry add --dev poetry
# project dependency
poetry add pydantic
- Environment management
- Linting & Testing
- Application