Pour tout problème contactez-nous par mail : support@froggit.fr | La FAQ :grey_question: | Rejoignez-nous sur le Chat :speech_balloon:

Skip to content
Snippets Groups Projects

Objective

Run mypy on your Python code to perform static typing checks, ensuring better code reliability and readability. mypy is a Python tool that checks the types of variables, function return values, and more.

How to use it

  1. Configure the mypy.ini, setup.cfg or pyproject.toml file in your repository's root directory with your desired rules.
  2. Include the mypy template in your CI/CD configuration (see quick use above).
  3. If you need to customize the job, check the jobs customization.

Variables

Name Description Default
PROJECT_PATH The path to the project root directory. "."
IMAGE_TAG The default tag for the docker image. See Python Docker Official Image for supported tags and respective Dockerfile links. "latest"
PYTHON_SETUP Bash commands to setup your python environment. "pip install mypy"

Global Configuration of mypy

To add configuration to mypy shared with any other usage of mypy (such as manual run, pre-commit, etc), you can use mypy.ini, setup.cfg or pyproject.toml configuration file. Learn more about mypy configuration files.

Add a Checked with mypy badge to your project README.md

To display the use of mypy in your project, you can add the following badge to your README.md:

[![Checked with mypy](https://img.shields.io/badge/mypy-checked-blue)](https://mypy.readthedocs.io/)