--- id: pytest-mypy version: "1.0.1" license: The MIT License (MIT) Copyright (c) 2016 Daniel Bader Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the… (full text in the JSON record) license_treatment: permissive maintenance: active --- # pytest-mypy — A Pytest Plugin for Mypy License: permissive · Maintenance: active · Downloads: 557.3K/mo ## What it is and what it does pytest-mypy is a pytest plugin that runs mypy's static type checker on your source files as part of your normal pytest test runs. Instead of running type checks separately, you invoke mypy checks through pytest using the --mypy flag, making type validation part of your continuous test workflow. The plugin works by integrating mypy into pytest's test discovery and execution, similar to how pytest-flake8 integrates flake8. You can configure mypy behavior through a mypy.ini file or programmatically in conftest.py, and you can filter test runs to only perform type checks using pytest's -m option. It depends on pytest, mypy, and filelock, all of which are common tools in Python development environments. Use it for: - Run type checks automatically as part of your CI/CD pipeline without a separate mypy invocation step. - Enforce type checking discipline in test suites by failing the build when type errors are detected. - Configure mypy options per-project in conftest.py to apply custom type-checking rules during test runs. - Restrict test execution to only type checks using pytest markers when you want to validate types without running functional tests. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Integrates mypy static type checking into pytest, running type checks on your source files as part of your test suite. Yes. The package is actively maintained, has low install friction, carries a permissive MIT license, and solves a real workflow problem—integrating type checking into your existing pytest test runs. It's well-suited for teams that want type validation as a first-class part of their test suite rather than a separate tool invocation. ## Install pip install pytest-mypy uv add pytest-mypy poetry add pytest-mypy ## Installing pytest-mypy Before you install: Low friction install with three straightforward runtime dependencies (pytest, mypy, filelock). The package is actively maintained with recent commits and has been stable since its early releases. License in practice: MIT license permits free use, modification, and distribution with minimal restrictions—suitable for both open-source and commercial projects. Quickstart: pip install pytest-mypy py.test --mypy test_*.py # Or configure in conftest.py: def pytest_configure(config): plugin = config.pluginmanager.getplugin('mypy') plugin.mypy_argv.append('--check-untyped-defs') Requires mypy and pytest to be installed; mypy configuration can be read from mypy.ini or set programmatically via conftest.py. Verify before relying: - Whether the plugin supports all mypy configuration options or only a subset - Performance impact when running type checks on large codebases during test execution ## Package facts - License: The MIT License (MIT) Copyright (c) 2016 Daniel Bader Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the… (full text in the JSON record) (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 557.3K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags pytest mypy plugin, static type checking pytest, mypy integration testing, type checking in test runs, pytest type checker, mypy pytest integration, type-checking, pytest-plugin, ci-integration [View on SkillFed](https://skillfed.io/packages/pytest-mypy) · [View on PyPI](https://pypi.org/project/pytest-mypy/)