GithubHelp home page GithubHelp logo

yxtay / python-project-template Goto Github PK

View Code? Open in Web Editor NEW
18.0 3.0 3.0 440 KB

Starter template for python projects

License: MIT License

Python 63.98% Makefile 20.37% Dockerfile 15.65%
python python-template fastapi pydantic flake8 python-black mypy pytest pre-commit isort

python-project-template's Introduction

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.