2024-05-28 08:00:26 +02:00
|
|
|
# mypy
|
|
|
|
|
|
|
|
> Type check Python code.
|
|
|
|
> More information: <https://mypy.readthedocs.io/en/stable/running_mypy.html>.
|
|
|
|
|
|
|
|
- Type check a specific file:
|
|
|
|
|
|
|
|
`mypy {{path/to/file.py}}`
|
|
|
|
|
2025-03-28 05:26:23 +02:00
|
|
|
- Type check a specific module:
|
2024-05-28 08:00:26 +02:00
|
|
|
|
2025-03-28 05:26:23 +02:00
|
|
|
`mypy {{[-m|--module]}} {{module_name}}`
|
2024-05-28 08:00:26 +02:00
|
|
|
|
2025-03-28 05:26:23 +02:00
|
|
|
- Type check a specific package:
|
2024-05-28 08:00:26 +02:00
|
|
|
|
2025-03-28 05:26:23 +02:00
|
|
|
`mypy {{[-p|--package]}} {{package_name}}`
|
2024-05-28 08:00:26 +02:00
|
|
|
|
|
|
|
- Type check a string of code:
|
|
|
|
|
2025-03-28 05:26:23 +02:00
|
|
|
`mypy {{[-c|--command]}} "{{code}}"`
|
2024-05-28 08:00:26 +02:00
|
|
|
|
|
|
|
- Ignore missing imports:
|
|
|
|
|
|
|
|
`mypy --ignore-missing-imports {{path/to/file_or_directory}}`
|
|
|
|
|
|
|
|
- Show detailed error messages:
|
|
|
|
|
2025-03-28 05:26:23 +02:00
|
|
|
`mypy {{[--tb|--show-traceback]}} {{path/to/file_or_directory}}`
|
2024-05-28 08:00:26 +02:00
|
|
|
|
|
|
|
- Specify a custom configuration file:
|
|
|
|
|
|
|
|
`mypy --config-file {{path/to/config_file}}`
|
|
|
|
|
2025-03-28 05:26:23 +02:00
|
|
|
- Display help:
|
2024-05-28 08:00:26 +02:00
|
|
|
|
2025-03-28 05:26:23 +02:00
|
|
|
`mypy {{[-h|--help]}}`
|