How to setup modern python projects
I have created lots of python projects in professional and private life and have come to a couple of tools, structures and overall setups that work really well for me. I am sharing it so that maybe you have an easier time just doing things!
There is this tool called cookiecutter you can use to boostraps folders and files with. You need to have cookiecutter installed in order to use my python project template. Then you can just it like this:
cookiecutter https://github.com/meandor/python-poetry-cookiecutter.git
It will ask you a a couple of questions and create a folder with python and a couple of opinionated defaults installed. These are:
- Build and dependency management tool with poetry
- Makefile for automating tasks
- Dockerfile
- Testing setup with pytest
- Unit and integration tests (check testing pyramid)
- Code checks
- Type checks with mypy
- Lint checks with pylint
- Auto formatting with black
- Command line interface using Click, Argparse (optional)
I especially like the usage of poetry in favor of any other python virtualenvironment and dependency management tool.
Give it a spin and let me know how it works for you!