Skip to content

kpetremann/python_template

Repository files navigation

Code style: black

What it includes

Set for python3.9

  • Linters: pylint, mypy, pycodestyle, pydocstyle
  • Code analysis: pytest, bandit
  • Auto format: black, isort, unimport
  • Build: tox, setuptools, pex
  • Pretty stacktraces: pretty-errors

Bootstrap

python -m venv .venv
source .venv/bin/activate
pip install -r requirements/dev.txt

Or using invoke (you need invoke package to be installed on your system):

invoke install

Put your code in app/

⚠️ NOTE: If you add or rename the packages at root level (app/), you need to update the following files:

  • tox.ini
  • setup.py

Run your app

Run the start script:

python start.py

Install the PEX in your environment, and run it:

pip install -e .  # To do only once
run-app

Run from invoke:

invoke start

Autoformat script

The template configuration includes: black, isort and unimport.

They can all be executed in the righ order thanks to tox:

tox -e format

It can also be triggered with invoke:

invoke reformat

Lint and build

Simply use tox:

tox  # check your code
tox -e bundle  # build the python PEX in dist/

About

Python project template

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages