{"library":"pytest-mypy","title":"Pytest Mypy Plugin","description":"pytest-mypy is a pytest plugin that integrates the Mypy static type checker into your pytest test runs. It allows you to run Mypy checks on your Python source files as part of your existing test suite, similar to how pytest-flake8 works for Flake8. The current version is 1.0.1, and it is actively maintained, with releases as needed.","language":"python","status":"active","last_verified":"Sat May 16","install":{"commands":["pip install pytest-mypy"],"cli":null},"imports":["This is a pytest plugin and is automatically discovered upon installation; no explicit import statement is typically needed in your test files."],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"# my_project/my_module.py\ndef add_numbers(a: int, b: int) -> int:\n    return a + b\n\ndef incorrect_call():\n    # Mypy should flag this type mismatch\n    return add_numbers('hello', 5)\n\n# my_project/test_example.py (empty or with other tests)\n# This file just needs to exist for pytest to discover the project.\n\n# To run mypy with pytest (from my_project directory):\n# pip install pytest pytest-mypy mypy\n# pytest --mypy my_module.py\n\n# Example conftest.py to add extra mypy arguments (e.g., --strict):\n# # my_project/conftest.py\n# def pytest_configure(config):\n#     plugin = config.pluginmanager.getplugin('mypy')\n#     if plugin:\n#         # Example: make mypy run in strict mode\n#         plugin.mypy_argv.append('--strict')\n#         # Example: check untyped definitions\n#         plugin.mypy_argv.append('--disallow-untyped-defs')","lang":"python","description":"After installing `pytest-mypy`, enable it by passing the `--mypy` flag to pytest, specifying the files or directories you want to type check. For more granular control or to enforce stricter Mypy settings, you can add options to `plugin.mypy_argv` within a `pytest_configure` hook in your `conftest.py` file.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":{"tag":null,"tag_description":null,"last_tested":"2026-05-16","installed_version":"1.0.1","pypi_latest":"1.0.1","is_stale":false,"summary":{"python_range":"3.10–3.9","success_rate":100,"avg_install_s":4.6,"avg_import_s":null,"wheel_type":"wheel"},"results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"pytest-mypy","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"94.5M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"pytest-mypy","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":4.5,"import_time_s":null,"mem_mb":null,"disk_size":"93M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"pytest-mypy","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"101.1M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"pytest-mypy","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":4.5,"import_time_s":null,"mem_mb":null,"disk_size":"100M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"pytest-mypy","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"92.7M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"pytest-mypy","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":4.4,"import_time_s":null,"mem_mb":null,"disk_size":"92M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"pytest-mypy","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"92.7M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"pytest-mypy","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":4.4,"import_time_s":null,"mem_mb":null,"disk_size":"91M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"pytest-mypy","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"85.7M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"pytest-mypy","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":5.1,"import_time_s":null,"mem_mb":null,"disk_size":"85M"}]}}