Skip to content
This repository was archived by the owner on Feb 15, 2024. It is now read-only.

yxtay/python-project-template

Repository files navigation

Python Project Template

Starter template for python projects

Features

  • 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
  • Make formula for common development tasks
    • install dependencies
    • run continuous integration tasks
    • run application
    • build Docker images

Usage

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.

External dependencies

Create environment

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 dependencies

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

Tools

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy