Cookiecutter PyPackage

Test

Cookiecutter template for a Python package, forked from briggySmalls/cookiecutter-pypackage.

Features

This template focus following:

  • Target Python version: 3.5 - 3.9
  • Dependency tracking using Pipenv
  • Linting provided by both pylint, flake8, mypy [executed by GitHub Actions]
  • Formatting provided by isort, pipenv-setup, black [checked by GitHub Actions]
  • Analizing complexity and maintainability provided by radon, xenon [checked by GitHub Actions]
  • All development tasks (lint, format, analize, test, etc) excluding deployment wrapped up in a python CLI by invoke
  • Omit documentation workflows since this project targets early stages of development. In the early stages of development it is better to focus on providing working software and writing README.md than providing comprehensive documentation.

    @see Manifesto for Agile Software Development

Quickstart

1.

Install the latest Cookiecutter if you haven't installed it yet (this requires Cookiecutter 1.4.0 or higher):

pip install -U cookiecutter

2.

Generate a Python package project:

cookiecutter https://github.com/yukihiko-shinoda/cookiecutter-pypackage.git --checkout master-yukihiko-shinoda

Then, you will interactively prompt some choices of templated values, for detail of templated values, see the Prompts.

Then initialized project direcotry is created in current directory.

Points to review after creating initialized project directory

1. Review support range if the one of your package is not Python 3.5 - 3.9

  • .github/workflows/test.yml
  • setup.py
    • python_requires
    • classifiers
  • docs/CONTRIBUTING.md -> Get Started! -> 5. oldest Python version

2.

Pin wheel version in Pipfle and execute pipenv lock if you prefer stability of deployment task.

Remaining task after creating initialized project directory

1.

Commit and push to GitHub repository.

2.

Activate your created repository on Code Climate.

If you prefer, Enable [Pull request comments] and [Pull request status updates] from [Repo Settings] -> [GitHub]

Copy and paste badge from [Repo Settings] -> [Badges] to this README file.

2-1.

Copy "TEST REPORTER ID" from [Test Coverages]

2-2.

register copied TEST REPORTER ID into secret in your pushed GitHub repository as name "CC_TEST_REPORTER_ID".

3.

Activate your created repository on pyup.io.

Create a new account at pyup.io or log into your existing account.

Click on the green Add Repo button in the top left corner and select repository you created in Step 1. A popup will ask you whether you want to pin your dependencies. Click on Pin to add the repo.

Once your repo is set up correctly, the pyup.io badge will show your current update status.

4.

Issue API token at PyPI and register into secret of your GitHub repository as name pypi_password

5.

Create tag v[0-9]+.[0-9]+.[0-9]+ and push to GitHub repository to deploy into PyPI.

Then, get your code on! 😎 Add your package dependencies to your pipenv with pipenv install.