types-factory-boy
Typing stubs for factory-boy
What it is and what it does
types-factory-boy is a PEP 561 type stub package that bridges the gap between factory-boy (a popular Python fixture library) and static type checkers. It provides type annotations for factory-boy's public API, allowing tools like mypy, PyCharm, and pytype to understand and validate code that uses factory-boy for generating test fixtures.
The package is a thin, zero-runtime-cost addition to your development environment. Once installed alongside factory-boy, it enables your type checker to catch type errors in fixture definitions and usage without requiring factory-boy itself to be rewritten with inline type hints. It supports Python 3.7 through 3.11 and is maintained actively.
Use it for:
- Enable mypy or PyCharm to type-check factory-boy fixture definitions and catch type mismatches before runtime.
- Validate that test factories produce objects matching expected type signatures in a typed codebase.
- Provide IDE autocomplete and type hints for factory-boy class attributes and methods.
- Integrate factory-boy into a strict type-checking CI pipeline without modifying factory-boy itself.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides PEP 561 type stubs for factory-boy, enabling static type checkers like mypy and PyCharm to validate code that uses factory-boy for test fixture generation.
Yes, if you use factory-boy in a type-checked codebase. It has no runtime overhead, low installation friction, and permissive licensing. The only caveat is that the latest release is from March 2023, so verify stub coverage matches your factory-boy version before relying on it for strict type enforcement.
Install
types-factory-boy on PyPI
pip
pip install types-factory-boyuv
uv add types-factory-boypoetry
poetry add types-factory-boyInstalling types-factory-boy
Before you install
Low friction installation with only two runtime dependencies (factory-boy and typing-extensions). Actively maintained as of August 2026, though the latest release is from March 2023.
License in practice
MIT license permits unrestricted use, modification, and distribution in both open and closed projects with minimal obligations.
Quickstart
pip install types-factory-boy
import factory
from typing import TYPE_CHECKING
if TYPE_CHECKING:
# Type checker now understands factory-boy classes
pass
Requires factory-boy to be installed; type checking benefits only apply when using a compatible type checker like mypy, PyCharm, or pytype.
Verify before relying
- Whether stub coverage is complete for all factory-boy public APIs and recent versions.
- How frequently stubs are updated relative to factory-boy releases.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.7) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — factory-boy, typing-extensions |
| Maintenance | actively maintained — 1,251 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 457,278/month — #6,548 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: types_factory_boy-0.4.1-py3-none-any.whl
Tags
More Quality Assurance packages
Coverage.py measures which lines of Python code…
permissive · top 1,000 on PyPI
ruffRuff is a Python linter and code formatter…
permissive · top 1,000 on PyPI
pexpectPexpect spawns and controls interactive console…
permissive · top 1,000 on PyPI
blackBlack reformats Python source code to a…
permissive · top 1,000 on PyPI
pytest-xdistpytest-xdist distributes pytest tests across…
permissive · top 1,000 on PyPI
cfn-lintValidates AWS CloudFormation templates in YAML…
permissive · top 1,000 on PyPI
types-backportsProvides PEP 561 type stubs for the backports…
permissive · top 15,000 on PyPI
types-attrsProvides PEP 561 type stubs for the attrs…
permissive · top 15,000 on PyPI
factory-boyfactory_boy replaces static test fixtures with…
permissive · top 1,000 on PyPI
types-futuresProvides type stubs for the futures package,…
permissive · top 15,000 on PyPI
types-WerkzeugProvides PEP 561 type stubs for Werkzeug,…
permissive · top 5,000 on PyPI
types-tornadoProvides PEP 561 type stubs for tornado,…
permissive · top 15,000 on PyPI
wagtail-factoriesProvides factory-boy classes for generating…
permissive · top 15,000 on PyPI
types-MarkupSafeProvides type stubs for MarkupSafe, enabling…
permissive · top 5,000 on PyPI
types-orjsonProvides PEP 561 type stubs for the orjson…
permissive · top 15,000 on PyPI
types-Jinja2Provides PEP 561 type stubs for Jinja2,…
permissive · top 5,000 on PyPI