Cookiecutter template for Python3 packages.
Clone or download
Pull request Compare This branch is 142 commits ahead, 81 commits behind audreyr:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Python 3 Package Cookiecutter

An opinionated, dead-simple cookiecutter for modern Python 3 packages.

Adapted from Audrey's cookiecutter-pypackage


  • Testing setup with py.test
  • Future-proof use of Pipfile as opposed to requirements.txt [see pipenv]
  • Tox testing: Setup to easily test
  • Sphinx docs: Documentation ready for generation and hosting on GitHub Pages
  • Bumpversion: Pre-configured version bumping with a single command
  • Command line interface with Click


Install the latest Cookiecutter and pipenv (optional, but highly recommended) if you haven't installed it yet.

brew install cookiecutter pipenv

Generate a Python package project

cookiecutter --checkout cloudfoundry

# answer questions to generate project template

cd your_new_project

# generate the virtual environment and activate it

pipenv shell # or whatever you use to manage your venvs

# install package dependencies within venv

pip install -e .[dev]

The last step will install the task runner at the root of the repo, as a command-line utility {{project_slug}} dev.

# to run the development server locally

{{project_slug}} runserver

# deploy

{{project_slug}} dev deploy


You should now have a command-line tool {{project_slug}} dev which you can use to execute common tasks.

This is just a shortcut to the file at the root of your project, meaning you have 3 ways of executing the task runner:

{{project_slug}} dev

# or, from project root


# or

python -m run

The following are some of the sub-commands you may find:

  autopep8      Autopep8 modules.
  clean         Remove all build, test, coverage and Python...
  coverage      Check code coverage quickly with the default...
  dist          Build source and wheel package.
  docs          Generate Sphinx HTML documentation, including...
  install       Install Python dependencies.
  publish_docs  Compile docs and publish to GitHub Pages.
  test          Run tests quickly with default Python.
  test_readme   Test README.rst to ensure it will render...
  tox           Run tests in isolated environments using tox.
  uninstall     Uninstalls all Python dependencies.

Additional Options

  • Create a GitHub repo for your generated project.
  • Add the repo to your Travis-CI account.
  • Activate your project on (if using pipenv, you can generate requirements.txt with pipenv lock -r)