Skip to content

How to use Mypy

Justine West edited this page Sep 26, 2025 · 2 revisions

Mypy is a static type checker for Python and checks programs for type annotations conforming to PEP 484. In order to get useful diagnostics from Mypy, type annotations must be added to the code. More information on Mypy can be found here.

Installation

Mypy requires Python 3.9 or later to run. You can install mypy using pip: python3 -m pip install mypy

Usage

To run mypy against the entire codebase, navigate to the root directory (fprime_python_model) and run:

mypy .

To run type checking for the body of functions that are not annotated, include the --check-untyped-defs flag;

mypy . --check-untyped-defs

To run mypy against a specific file (for instance, the translators/ast_translator.py file), run:

mypy translators/ast_translator.py
Clone this wiki locally