Skip to content

matthewfeickert/Python-library-template

Repository files navigation

Python library template

A template repository for a modern Python library

GitHub Actions Status Code Coverage Language grade: Python CodeFactor Code style: black

Docs Binder

PyPI version Supported Python versions

The template library is libname to make it clear what is needed for replacement

Setting up the template for your library

  1. Edit setup.py to reflect all of your library's needs and requirements
  2. Edit the paths to badges in the README to match your library's locations
    • Change libame to your library's name
    • Change matthewfeickert to your username or org name on GitHub
    • Change python-library-template to your project name on GitHub (probably the same as the library name)
  3. Replace the rest of the README contents with your information
  4. Run git grep "libname" to make sure that you have changed all instances of libame (it is easy to miss the dotfiles)
  5. Setup accounts with Codecov, LGTM, and CodeFactor
    • Also add the Codecov and LGTM GitHub marketplace apps
  6. Generate a Codecov token and add it to your GitHub repo's secrets with name CODECOV_TOKEN

Controlling the version number with bumpversion

When you want to increment the version number for a new release use bumpversion to do it correctly across the whole library. For example, to increment to a new patch release you would simply run

bumpversion patch

which given the .bumpversion.cfg makes a new commit that increments the release version by one patch release.