/python-template

Python project and library template for clean, reliable, open-source projects.

Primary LanguagePythonApache License 2.0Apache-2.0

Python compat GHA Status

A template to quickly get you creating an open-source python library or project with linting, static analysis, CI, and CD to PyPi.

Usage

To use this template, click the green "Use this template" button in the github web interface. Then run:

git clone YOUR_REPO
./bootstrap

And follow the on-screen prompts. bootstrap uses some git data (like detecting your username and repository name), so cloning the repo generated from the template is necessary.

Compatibility

This template only works on MacOS/Linux/WSL, it will not work natively on windows.

Features

  • Features dependent if project is a library or a standalone project.
  • Poetry support.
    • If not installed, Poetry will automatically be installed when running bootstrap.
  • Optional CLI boilerplate using typer.
  • Sphinx + ReadTheDocs.
  • Pre-commit linting and static analysis.
  • Docker support for standalone projects.
  • GitHub actions for:
    • Run pre-commit on pull requests and commits to main.
    • Run unit tests, coverage, and verify docs build on pull requests and commits to main.
    • Build and upload wheels to PyPi on semver tags vX.Y.Z.
    • Build and upload docker images to Dockerhub.
      • Add your Dockerhub username and token to your GitHub secrets DOCKERHUB_USERNAME and DOCKERHUB_TOKEN.

Reference

If you find this in the git history of a project and you like the structure, visit this template at https://github.com/BrianPugh/python-template .