escaped / cookiecutter-pypackage

Modern cookiecutter template for libraries or applications, support Django based projects (includes pre-commit hooks, poetry, etc.)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cookiecutter PyPackage

A modern opinionated Cookiecutter template for Python packages and applications using Poetry.

Features

  • Poetry: Dependency management and packaging

  • Tox: Easily run tests for different python versions

  • Github Actions: Ready for Continous Integration testing

    • Run tests for different python versions using tox
    • Test for PEP8 compliance
    • Enforce the usage of black
    • Preconfigured coveralls
  • Tests using Pytest including support for

  • pre-commit hook to automatically run

    • autoflake - automatically removes unused imports and variables,
    • isort - automatically sorts imports alphabetically, and automatically separated into sections and by type,
    • black - automatically formats your code,
    • flake8 - checks code against code style (PEP8), programming errors and complexity,
    • mypy - static type checker,
  • Debugging tools

    • pdbpp - better debugger,
    • [better_exceptions] - Pretty and more helpful exceptions in Python, automatically
  • (optional) Preconfigured for Django applications

  • Simple pull request template with checklist

Quickstart

Get the latest version of Cruft (or Cookiecutter) I recommend pipx to install it into a global isolated environment.

pipx install cruft

Generate a new python package

cruft create https://github.com/escaped/cookiecutter-pypackage.git
cd <chosen project slug>
git init
git add .
git commit -m "feat: initial project structure"

Publish releases to pypi

In order get automatic releases to pypi you need to add your pypi access token to the github secrets (named PYPI_TOKEN). Instructions can be found here: python.org.

Autoupdate template

This cookiecutter template comes with an auto update feature if the project was created using cruft. A GitHub action automatically checks for updates and creates a pull request.

It is required to add a personal access token as github secret to the repository (named AUTO_UPDATE_GITHUB_TOKEN). While creating the access token, the following permissions have to be granted

  • repo
  • workflow

About

Modern cookiecutter template for libraries or applications, support Django based projects (includes pre-commit hooks, poetry, etc.)

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:Python 100.0%