Skip to content

A Highly Configurable Python Template: Optionally use FastAPI, SQLAlchemy 2, Pydantic, Typer, Celery, and more depending on your application's needs!

License

Notifications You must be signed in to change notification settings

tedivm/robs_awesome_python_template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

72 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rob's Awesome Python Template

Rob's Awesome Python Template is extremely customizable- it can work for the smallest library to the largest application.

Usage

  1. Install cookiecutter.
  2. Install pyenv if you haven't already.
  3. Run the cookiecutter command.
cookiecutter gh:tedivm/robs_awesome_python_template

The rest of the process is interactive- you'll be asked for a project name and about which features you want enabled, after which the project will be setup.

Core Functionality

  • Development Management using Makefiles.
  • Configuration Management with Pydantic Settings.
  • PyPI Publishing from Github Tags using setuptools-scm.
  • Formatting and Linting with Ruff.
  • Typing with mypy.
  • Lockfiles (requirements.txt) with uv.
  • Testing with pytest.
  • CI/CD using Github Actions.
  • Precommit Hooks using the precommit framework.
  • Multiple license options.
  • Modern pyproject.toml without any legacy files.

Optional Libraries

This template can also configure and setup a variety of optional services. Each optional service adds its own dependencies, configuration, handlers, and everything else needed to jump right into development.

Features that are not selected get completely cleaned up and will not pollute the newly created project.

FastAPI

FastAPI is one of the easiest ways to develop REST Based APIs. When enabled a "Hello World" application will be setup.

Celery

Celery is the standard for Queue Management systems with Python.

QuasiQueue

QuasiQueue is a high performance multiprocessing library that is also very simple to use.

Typer and Click

Typer, which is built on top of the Click Framework, is one of the easiest ways to build command line applications. When enabled this template will create an initial CLI handler and register it with python for easy installation.

SQLAlchemy and Alembic

SQLAlchemy is one of the most used SQL ORM frameworks in python. It is regularly paired with Alembic to handle database migrations.

This template configures SQLAlchemy and Alembic to work together using a unified configuration. Alembic will automatically discover all models in the models directory.

Projects with this template will have access to the Async SQLAlchemy engine.

Paracelsus

Paracelsus is a library that automatically generates diagrams of SQLAlchemy database schemas and injects them into documentation.

Docker

Docker Images are the standard for distributing and running applications. The Docker extensions to this project create containers for the other services that are enabled, such as FastAPI and Celery.

The images made by this template come from the Multi-Py project and support both AMD and ARM architectures.

Github Actions

Github Action Workflows are optionally created for a variety of tasks-

  • Formatting Python, JSON, YAML, and TOML
  • Testing
  • Typing
  • Publishing Packages to PyPI
  • Pushing Images to GHCR
  • Updating Dependency (requirements.txt) Files
  • Updating Documentation

Examples

Project examples are available in the example repository.

These are just some options, as features can be mixed and matched to create numerous permutations.

About

A Highly Configurable Python Template: Optionally use FastAPI, SQLAlchemy 2, Pydantic, Typer, Celery, and more depending on your application's needs!

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project