Release v3 (What’s new?).

Documentation Status https://img.shields.io/badge/Release_History!--None.svg?style=social https://img.shields.io/badge/STAR_Me_on_GitHub!--None.svg?style=social

cookiecutter-pyproject#

FULL DOCUMENT IS HERE

Summary#

This is an Python open source library project template I used for years. You can easily generate a folder structure with everything you need and start development, then publish to PyPI.

Best practices and automation features included in this template:

  • Virtualenv management

  • Dependencies management

  • Local unit test and code coverage test

  • Build and preview documentation site locally

  • Use GitHub Action for CI

  • Use Codecov for code coverage report

  • Use Read the Docs for documentation site hosting

Disclaimer#

All the best practice used in this repo is based on my career experience, and my personal opinion. I have done over 90+ open source Python library projects and 50+ internal Python libraries for Enterprise. It is the best practice I am using for years. It allow me to publish a new Python library to PyPI in one hour when I got an idea. Again, it is my personal best practice, please use it at your own risk.

Usage#

Enter the following command, it will use the latest template.

pip install cookiecutter && cookiecutter https://github.com/MacHu-GWU/cookiecutter-pyproject

Or, you can use a specific released version, you can find full list of release at here.

# use specific version
cookiecutter https://github.com/MacHu-GWU/cookiecutter-pyproject --checkout tags/${version}
# for example (v3 is the latest as of 2023-09-25)
cookiecutter https://github.com/MacHu-GWU/cookiecutter-pyproject --checkout tags/v3

Then fill in some information:

package_name [your_package_name_with_underscore]: ...
package_name_slug [your-package-name-with-hyphen]: ...
github_username [your-github-username]: ...
author_name [Firstname Lastname]: ...
author_email [firstname.lastname@email.com]: ...
...

Then it will generate a Git repo folder structures like this:

  • /.github/: GitHub action configuration

  • /${package_name}/... your python project source code

  • /tests/...: unit test

  • /.coveragerc: code coverage test config

  • /pyproject_ops.json: the pyproject_ops CLI automation tool config file

We have an example project generated from this template my_package-project. Please take a look at it.

Table of Content#