Python Project Template
[![](https://img.shields.io/badge/Documentation-main-blue)][docs] [![](https://img.shields.io/badge/Example-Sample_Project-blue)][sample project] [![PyPI - Version](https://img.shields.io/pypi/v/init-python-project)][pypi]A customizable template for new Python projects to get you up and running with current best practices faster.
Features#
- Each project has a README and CHANGELOG file and includes further documentation based on Material for MkDocs or Sphinx.
- Testing and continuous integration tooling are included from the very beginning
- Test coverage is collected and displayed as a badge
- Coverage report is integrated with Gitlab's coverage report artifact
- Projects use pre-commit for sanity checks on each commit or push
- Projects use bumpversion to increase their version according to semantic versioning guidelines
- Python projects are installable by default and provide a simple command-line interface
Everything comes pre-configured with sensible defaults so you can focus on your implementation and let the template handle the rest.
See the sample project to see how projects generated from this template using default values look like.
Getting Started#
Prerequisites#
- Python3.11 or newer
Installation#
Note: If you have pipx installed (you should, it is good), you can skip this step and instead run it directly using pipx run init-python-project
Usage#
User Guide#
The first part of the user guide consists of tutorials on how to answer the template questions for Your First Project, what Next Steps there are after your project is created and why the Project Structure looks like it does.
The second part of the user guide explains how best practices, like testing, documentation, and continuous integration, are implemented in this template.
Known Issues#
- Do not name your project
test
. It will mess withpytest
's automatic test discovery mechanism. - If running on Windows in git-bash, you may receive a
NoConsoleScreenBufferError
error. One solution is to run usingwinpty
. For example,winpty init-python-project my-project
.