Welcome to Cookiecutter Python Package documentation!

Python Package Generator

Python Package Generator supporting 3 different Project types to scaffold.
Emphasizing on CI/CD, Testing and Automation, built with Cookiecutter.
GitHub Workflow Status (branch) Read the Docs (version) Codecov OpenSSF Maintainability Better Code Hub Codacy Code Climate technical debt Black
Production Version PyPI - Wheel Supported Python versions GitHub GitHub commits since tagged version (branch) GitHub commits since latest release (by SemVer)

Features

module: 24 module+cli: 28 pytest-plugin: 26

  1. Scaffold a modern ready-to-develop Python Package (see Quickstart)

  2. Generate over 24 files, to setup Test Suite, build scripts & CI Pipeline

  3. Python Package Template (source code at src/cookiecutter_python/) implemented as a Cookiecutter

  4. Extensively Tested on various systems, factoring the below:

    1. System’s platform: “Linux”, “MacOS” & “Windows”

    2. System’s Python: 3.6, 2.7, 3.8, 3.9 & 3.10

    See the Test Workflow on the CI server.

Auto Generated Sample Package Biskotaki

Check the Biskotaki Python Package Project, for a taste of the project structure and capabilities this Template can generate!

It it entirely generated using this Python Package Template:

Source Code hosted on Github at https://github.com/boromir674/biskotaki
Python Package hosted on pypi.org at https://pypi.org/project/biskotaki/
CI Pipeline hosted on Github Actions at https://github.com/boromir674/biskotaki/actions

Generated Python Package Features

  1. Test Suite, using pytest, located in tests dir

  2. Parallel Execution of Unit Tests, on multiple cpu’s

  3. Documentation Pages, hosted on readthedocs server, located in docs dir

  4. Automation, using tox, driven by single tox.ini file

    1. Code Coverage measuring

    2. Build Command, using the build python package

    3. Pypi Deploy Command, supporting upload to both pypi.org and test.pypi.org servers

    4. Type Check Command, using mypy

    5. Lint Check and Apply commands, using isort and black

  5. CI Pipeline, running on Github Actions, defined in .github/

    1. Job Matrix, spanning different platform’s and python version’s

      1. Platforms: ubuntu-latest, macos-latest

      2. Python Interpreters: 3.6, 3.7, 3.8, 3.9, 3.10

    2. Parallel Job execution, generated from the matrix, that runs the Test Suite

Quickstart

Installation

Usage

Open a console/terminal and run:

generate-python

Now, you should have generated a new Project for a Python Package, based on the Template!

Just ‘enter’ (cd into) the newly created directory, ie cd <my-great-python-package>.

Develop your package’s Source Code (business logic) inside src/my_great_python_package dir :)
Develop your package’s Test Suite (ie unit-tests, integration tests) inside tests dir :-)

Try Running the Test Suite!

tox

Read the Documentation’s Use Cases section for more on how to leverage your generated Python Package features.

License

GitHub

Free/Libre and Open Source Software (FLOSS)

OpenSSF

Notes

Currently, since the actual cookiecutter template does not reside on the root directory of the repository (but rather in src/cookiecutter_python), ‘cloning’ the repository locally is required at first.

This was demonstrated in the Quickstart section, as well.

For more complex use cases, you can modify the Template and also leverage all of cookiecutter’s features, according to your needs.

Indices and tables