TL;DR;

Checkout this Gitlab repo if you need a python project skeleton that includes sample tests for CLI/API applications, and tools that measure your code quality. It is a good candidate if you need to develop fast and share the source later.

Update on 2022-02-10: Since writing, I came across Poetry which made me re-consider this skeleton app content, so I will follow-up with an update.

Update on 2022-05-30: Decided not to add yet another tool to the mix (i.e. Poetry), and focused on incorporating PEP-621 to the skeleton. Dropped requirements-dev.txt and moved most of setup.cfg to pyproject.toml.


I like following good development practices and using readily available tools to develop a solution. For the past few years, Python has been a good companion (for me) to work with cloud, build CLI tools, and write micro services. The more I used it, it became clear that I need to standardize my scripts and packages, and present them as ready-to-use. Normally, I would start with a fresh folder, and add pieces one by one - ignore file, setup file, test configs and so on. Tedious and time consuming. I could clone an existing project, but then would need to spend time removing stuff.

It was time for me to create a "blueprint" project to source from, that needed to meet following criteria:

  • has a test suite - I have been using pytest, and it helped me keep my applications working as expected. Plus, it made me write better code because each function or class I put needed to be tested, so that would automatically create de-coupled logic and meet the S of SOLID. There is also coverage that shows, well, the test coverage.
  • follows known coding standard aka PEP8 - flake8 and black made it easy to add that. Paired with pre-commit, I now have that out-of-the-box and don't need to do anything special.
  • ready to package - obvious step, assuming the earlier ones are put in place

That is how I came up with this Python skeleton project 🎉. Now when I need to create a Python application, I will clone the repo, make small tweaks and get going quickly.

For next steps, I will be evolving it with CI/CD configuration files for various providers.

I hope the repository will be helpful for others 🤓.