Low-Hanging Fruit in Python Continuous Integration

Brandon Walker
3 min readJun 17, 2022

As a MLOps Engineer I am concerned with deploying models and applications, many of which are written in python. Since data scientists are not software engineers, my assistance is required to make code production ready. To do so, the adoption of a CI/CD pipeline is very useful as it ensures that code is well tested and deployed consistently (ie automatically). In my conversations and dealings with data scientists at most companies, test driven development is a foreign concept to them and can be a bit intimidating to begin. Therefore, I will cover here the concept of static typing in python as the easiest route of introducing data scientists to testing.

Photo by Kaleidico on Unsplash

Let’s say you have some very simple code in python.

def add(a, b):
return a + b

This works, and you know that it looks on its surface to not have any problems at all. Let’s say someone uses this function to do the following:

add("1", "3")

Even though you have written your integers as strings, the code will still run, but it will return “13” as a string instead of the desired result 4.

Unlike other languages, python doesn’t force you to define variable types. While this can feel freeing, it can also allow for the problem you’ve seen above. Many people would suggest writing code…

--

--