pythonpython-typingpylintpython-3.9

Enforcing type hints in a Python CI/CD


My Problem

I am a part of a team that's building a big microservice project with Python. For obvious reasons, we'd like to specifically declare the types of arguments and return values for the functions and methods that we share. However, I could not find a way to enforce Python type hinting as a part of our github actions CI/CD pipeline.

What Have I Tried

We're using black and Pylint, so I tried to find a proper PyLint configuration, but did not find any.

My Question

Is there a way to enforce Python type hints in a CI/CD process?


Solution

  • The answer is MyPy, not PyLint. It's well-maintained and has good configuration options (like ignoring specific parts of the code).