--- id: types-mock version: "5.2.0.20260518" license: Apache-2.0 license_treatment: permissive maintenance: active --- # types-mock — Typing stubs for mock License: permissive · Maintenance: active · Downloads: 5.3M/mo ## What it is and what it does types-mock is a type stub package that bridges the gap between the mock library and static type checkers. It provides type annotations for mock's public API, allowing mypy, pyright, and other type checkers to understand and validate code that uses mock for unit testing. The stubs are generated from typeshed, a community-maintained repository of type information for Python packages. This package is useful when you want type safety in test code. Without it, type checkers see mock as untyped, which can hide bugs in test setup or assertions. The stubs are kept in sync with mock==5.2.* releases and have been validated against mypy 2.1.0 and pyright 1.1.409. Use it for: - Enable type checking in test files that use mock.patch, mock.Mock, and other mock utilities. - Catch typos or incorrect mock configuration before runtime in CI/CD pipelines. - Provide IDE autocomplete and inline documentation for mock's API in test code. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Provides type stubs for the mock library, enabling type checkers like mypy and pyright to validate code that uses mock for unit testing. Yes, if you use mock in typed test code and want your type checker to validate test setup. It has no runtime dependencies, low friction, and is actively maintained. If you don't use a type checker or don't test with mock, it adds no value. ## Install pip install types-mock uv add types-mock poetry add types-mock ## Installing types-mock Before you install: Low friction: pure Python wheel with no runtime dependencies. Actively maintained as part of typeshed; last release 88 days ago. License in practice: Apache-2.0 permissive license allows use in most projects without restriction. Quickstart: pip install types-mock # Then use mock in your code; type checkers will now understand it import mock with mock.patch('module.function'): pass Requires Python 3.10 or later. Verify before relying: - Whether this package is required for type checking mock, or if mock itself now includes inline types in recent versions. ## Package facts - License: Apache-2.0 (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 5.3M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags type stubs for mock, mock type hints, type checking mock library, mypy mock annotations, pyright mock stubs, type-stubs, testing [View on SkillFed](https://skillfed.io/packages/types-mock) · [View on PyPI](https://pypi.org/project/types-mock/)