AppVeyor and python formatting

Xavier Jouvenot
3 min readMar 30, 2022

Hello ! I’m Xavier Jouvenot and in this small post, I am going to explain how to automatically check if your python code is well formatted with AppVeyor.

Self promotion: Here are a few social networks where you can follow me and check my work as a programmer and a writer 😉 personal website, Twitter, Dev.to, CodeNewbie, Medium, GitHub

Problematic

Today, we are going to focus on how we can automatically check if the python code you are versioning is well formatted, and more specifically, how you can use AppVeyor to do so. To automate this process will make your team more efficient and the code more consistent since everyone will have to be on board and format their code each time they want to contribute.

If you are not convinced that you should format you code, I really encourage you to go look at the previous article I did on Formatting and Automation, where I go in detail on why you should definitively format your code, and do it in a automatic way, to make your code more readable and make your team more productive since they won’t have to spend time arguing about Spaces VS Tabs, for example.

Solution

The short answer, for the people who don’t want to read through the entire article (I know you do that! I do it too 😆) is to insert the following steps in your AppVeyor process:

install:
- pip3 install black

build_script:
- black --check .

--

--