Python Project Setup: A Step-by-Step Guide to Industry Best Practices

Learn how to properly setup and kickstart your python project. And all the nitty-gritty details of which tools to use and how to configure them together, through building a simple CLI.

Armand Sauzay
16 min readJun 5


Photo by Chris Reid on Unsplash

As you start working on your python project, you’ll likely need to set it up in a consistent and collaboration-friendly way. In this article, I’ll describe a setup that works great for our projects at Turo, and also my personal ones. It includes many industry best practices (semantic versioning, pre-commit, linting, or how to release code to mention but a few).

In short, we’ll cover how to properly install python, structure your code, run automated checks both on local with pre-commit and the server side with GitHub Actions (aka GHA).

This article covers quite a few topics. To ease the reading, each section will usually be split in two parts:

  • 📚 for the theory part
  • 🛠️ for the practical part (i.e. the commands you need to run to reproduce).

Sometimes a 💡 section will also indicate a coding tip or trick.

Table of Contents

  1. Install a Python version manage (pyenv)
  2. Choose an environment manager (poetry)
  3. Otherwise, use Docker to isolate dependencies
  4. Add Some Code
  5. Write Some Tests
  6. Linting our code
  7. Automate checks on local with pre-commit
  8. Automate checks on remote with GitHub Actions
  9. Automate our release with GitHub Actions
  10. Enjoy the benefits of your new code practices

1. Install a Python version manager (pyenv)

📚 The first thing we’ll need to do is to install a python version manager which will enable us to have multiple versions of python installed on our machine and switch between them easily.

To illustrate this, let’s say we have a project that requires python 3.6 and another project that…



Armand Sauzay

Applied Scientist at Turo - ex Airbnb - ex Amazon - UC Berkeley