Skip to content
This repository has been archived by the owner on Mar 13, 2024. It is now read-only.

Latest commit

 

History

History
58 lines (44 loc) · 2.3 KB

README.md

File metadata and controls

58 lines (44 loc) · 2.3 KB

python-app-template

Test Coverage Docs PyPIPkgVersion

A template with a reasonable basic setup, including:

  • black (formatting)
  • flake8 (linting)
  • mypy (type checking)
  • isort (import sorting)
  • pre-commit (check/fix the things above and more on each commit)
  • poetry (dependency and venv management)
  • pytest (testing)
  • tox (easily test against multiple Python versions even locally)
  • pytest-cov (compute coverage, uploaded to codecov.io)
  • pdoc (generate documentation, deployed to Github Pages)
  • deployment to PyPI on Github Release (pre-configured for TestPyPI)

Inspired by Hypermodern Python and blog posts like this. You can look there for more tools and other choices.

  • If you are building a CLI app, consider using Typer
  • If you are building a web app, consider using FastAPI

Setup

  • Change the package name and path to the repository everywhere
  • enable/configure Github Pages in the settings
  • set tokens in the CI if needed (Codecov, PyPI)

Development

This project uses Poetry for dependency management.

Clone this repository and run poetry install.

Run pre-commit install to enable pre-commit hooks for linting and sanity checks.

To locally generate documentation, run pdoc -o docs python_app_template.

To locally run tests and get coverage information, use pytest --cov.

To run the tests with different Python versions, run tox. For that, you should install the Python versions in the .python-version file. You can use pyenv to do that and switch between them as you please.