Skip to content

leynier/python-template

Repository files navigation

Python Template

License: MIT Last commit GitHub commit activity Github Stars Github Forks Github Watchers Website GitHub contributors

Python template with CI/CD ready for production

Branches

  • main: For libraries and/or console applications
  • typer: Command line interfaces implemented with Typer
  • fastapi: For web applications implemented with FastAPI

Features

Main Features

FastAPI Features

  • Configuration for deploy on Heroku
  • Configuration for deploy with Docker

All of the above via GitHub Actions and GitHub Pages

Tutorial

Install cookiecutter (Official Instructions)

At the command line:

python3 -m pip install --user cookiecutter

Or, if you do not have pip:

easy_install --user cookiecutter

Though, pip is recommended.

Or, if you are using conda, first add conda-forge to your channels:

conda config --add channels conda-forge

Once the conda-forge channel has been enabled, cookiecutter can be installed with:

conda install cookiecutter

Alternate installations

Homebrew (Mac OS X only):

brew install cookiecutter

Pipx (Linux, OSX and Windows):

pipx install cookiecutter

Debian/Ubuntu:

sudo apt-get install cookiecutter

Upgrading from 0.6.4 to 0.7.0 or greater

First, read History in detail. There are a lot of major changes. The big ones are:

Cookiecutter no longer deletes the cloned repo after generating a project.

Cloned repos are saved into ~/.cookiecutters/.

You can optionally create a ~/.cookiecutterrc config file.

Upgrade Cookiecutter either with easy_install:

easy_install --upgrade cookiecutter

Or with pip:

python3 -m pip install --upgrade cookiecutter

Usage

Then, after you have installed cookiecutter, execute the following command in the terminal of your choice:

cookiecutter gh:leynier/python-template --checkout <branch>

Where <branch> can be main, fastapi, typer, etc.

Example using FastAPI template

cookiecutter gh:leynier/python-template --checkout fastapi

License

This project is collaborative and open source under the MIT license. Contributions are super appreciated.