$npx skillfedfor your agent

factory-boy

A versatile test fixtures replacement based on thoughtbot's factory_bot for Ruby.

Worth itPyPI Python ModulesReleased Feb 202522.9M downloads / moMITPure Python

Decision gist · record as of 2026-08-14

pure-Python wheel — factory_boy-3.3.3-py2.py3-none-any.whl
v3.3.3 · released 2025-02-03 · Python >=3.8 · 1 runtime deps: Faker

Yes. factory_boy is a mature, widely-used testing library (top 1000 PyPI, 22937878 monthly downloads) with no known vulnerabilities, permissive MIT license, and low install friction. Its aging maintenance status (557 days since release) is offset by a stable, well-documented codebase and active repository. Install it if you write tests for ORM-backed applications or complex object hierarchies.AI-flagged interpretation of the facts on this page — verify before relying

Before you install

  • ORM integration (Django, SQLAlchemy, MongoEngine) required for .create() strategy; .build() and .stub() work without external ORMs.
  • Low install friction with a single runtime dependency (Faker).
  • Maintenance status is aging—557 days since last release—but the repository remains active with 3806 stars.

License · maintenance · safety

MIT (permissive) — MIT license (permissive) allows unrestricted use, modification, and distribution in commercial and private projects with minimal obligations.

last release 2025-02-03 (557 days) · last repo commit 2026-01-01 · 3,806 stars

0 known vulnerabilities (OSV.dev, 2026-08-14) · 22,937,878 downloads/mo, #963 on PyPI

Verify before relying

pip install factory-boy

import factory

class UserFactory(factory.Factory):
    class Meta:
        model = User
    first_name = 'John'
    last_name = 'Doe'

user = UserFactory.build()  # Unsaved instance
user = UserFactory.create()  # Saved instance (requires ORM)
  • Whether Faker integration is automatic or requires explicit configuration for realistic value generation.
  • Performance characteristics when generating large batches of objects in test suites.
  • Compatibility details with specific ORM versions beyond Django 4.2, 5.0, 5.1.
Same gist for agents: .md · .json

What it is and what it does

factory_boy is a test fixture library that replaces hard-coded, static test data with declarative factory classes. Instead of manually constructing complex nested objects with all their dependencies for each test, you define a factory once and then instantiate customized instances by specifying only the fields relevant to the current test. It integrates with popular ORMs and supports multiple instantiation strategies: build (unsaved), create (saved), and stub (plain attributes).

The library reduces boilerplate in test setup by allowing you to chain factory calls, override attributes inline, generate batches of objects, and use lazy attributes or sequences for computed or unique values. It relies on Faker for generating realistic random data, and provides helpers for reproducible random seeding in tests. This makes test code more readable and maintainable, especially for complex domain models with many relationships.

Use it for

  • Define reusable factories for models to avoid repeating address, user, and order setup across test files.
  • Generate batches of test records with realistic names and emails using Faker integration for demos or load testing.
  • Create nested object hierarchies using SubFactory without manually instantiating each level.
  • Override specific fields per test while keeping defaults for unchanged attributes.
  • Build unsaved instances for unit tests and saved instances for integration tests using the same factory.

Worth the install?

AI-flagged interpretation of the facts on this page. Verify before relying on it.

Worth it

Yes.

factory_boy is a mature, widely-used testing library (top 1000 PyPI, 22937878 monthly downloads) with no known vulnerabilities, permissive MIT license, and low install friction. Its aging maintenance status (557 days since release) is offset by a stable, well-documented codebase and active repository. Install it if you write tests for ORM-backed applications or complex object hierarchies.

Install

factory-boy on PyPI

Before you install

Low install friction with a single runtime dependency (Faker). Maintenance status is aging—557 days since last release—but the repository remains active with 3806 stars.

ORM integration (Django, SQLAlchemy, MongoEngine) required for .create() strategy; .build() and .stub() work without external ORMs.

License in practice

MIT license (permissive) allows unrestricted use, modification, and distribution in commercial and private projects with minimal obligations.

Quickstart

pip install factory-boy

import factory

class UserFactory(factory.Factory):
    class Meta:
        model = User
    first_name = 'John'
    last_name = 'Doe'

user = UserFactory.build()  # Unsaved instance
user = UserFactory.create()  # Saved instance (requires ORM)

Verify before relying

  • Whether Faker integration is automatic or requires explicit configuration for realistic value generation.
  • Performance characteristics when generating large batches of objects in test suites.
  • Compatibility details with specific ORM versions beyond Django 4.2, 5.0, 5.1.

Package facts

LicenseMIT permissive
Python supportSupports the current Python release >=3.8
Install frictionLow. Pure-Python wheel
Runtime dependencies
1 package
Faker
MaintenanceAging 557 days since the last release
Last repo commit
First released
Downloads22,937,878 / month, #963 on PyPI 30-day window, as of 2026-08-14
Known vulnerabilitiesNone known OSV.dev, checked 2026-08-14
Classifiers
Development Status :: 5 - Production/StableFramework :: DjangoFramework :: Django :: 4.2Framework :: Django :: 5.0Framework :: Django :: 5.1Intended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Software Development :: Libraries :: Python ModulesTopic :: Software Development :: Testing

Evidence: factory_boy-3.3.3-py2.py3-none-any.whl

Tags

Capabilities
test fixtures replacementfactory pattern for testinggenerate test dataORM model factoriesmock object creationtest object buildersfixture alternative
Topics
testingfixturesorm-integration
PyPI keywords
factory_boyfactoryfixtures

Let your AI agent find packages like this

Example. Real query, live index.

You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.

wish › “test fixtures replacement”

  • factory-boyfactory_boy replaces static test fixtures with declarative factories…
  • mixerMixer generates test data and model instances for Django, SQLAlchemy,…
  • rtestA Python test runner built in Rust that uses static AST analysis for…

Give your agent the search over MCP, or paste the wish link into any chat.

More Python Modules packages

idna Worth it
PyPI · Python Modules · released Jun 2026

Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.

Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.

BSD-3-Clausepure Python · 3.9+
1.8Bdownloads / mo
setuptools Worth it
PyPI · Python Modules · released Aug 2026

Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.

MITpure Python · 3.10+
1.6Bdownloads / mo
PyYAML Worth it
PyPI · Python Modules · released Sep 2025

PyYAML parses and emits YAML 1.1 data format, enabling serialization and deserialization of configuration files and Python objects to and from human-readable YAML text.

MITcompiled wheel · 3.8+
1.2Bdownloads / mo
pydantic Worth it
PyPI · Python Modules · released May 2026

Pydantic validates Python data structures against type hints, coercing and checking input at runtime to ensure it matches a declared schema.

MITpure Python · 3.9+
1.1Bdownloads / mo
annotated-types Worth it
PyPI · Python Modules · released Jul 2026

Provides reusable metadata objects for use with PEP-593 `typing.Annotated` to express common constraints like bounds, collection sizes, and predicates on types.

Install it if you use or build libraries that need to express type constraints in a standardized, inspectable way—or if you want to annotate your own types with…

MITpure Python · 3.10+
871.3Mdownloads / mo
typing-inspection Worth it
PyPI · Python Modules · released Aug 2026

Provides runtime tools to inspect and introspect Python type annotations, enabling programmatic examination of type hints at execution time.

MITpure Python · 3.10+
783.0Mdownloads / mo

See also async-factory-boy · pytest-factoryboy · wagtail-factories · model-mommy · types-factory-boy · objectory · mixer · pytest-docker-tools · fake-factory · pytest-rabbitmq