skillfed

model-bakery

Smart object creation facility for Django.

model-bakery v1.24.0 2.1M downloads/30d#3,311 on PyPI1,002
Permissive license Apache-2.0 Active released

What it is and what it does

Model Bakery is a Django testing utility that automatically generates model instances with realistic, randomized data. Instead of manually constructing test objects with all required fields, you call baker.make() with a model name or class and receive a fully populated, saved instance. It introspects your model's fields and generates appropriate values—integers for IntegerField, email addresses for EmailField, dates for DateField, and so on—eliminating boilerplate in test setup.

The package is designed for developers writing Django unit tests who need quick, realistic fixtures without writing verbose factory code. It follows Django and Python release cycles, supporting current versions of both. With a single runtime dependency (django) and low install friction, it integrates directly into your test suite.

Use it for:

  • Rapidly populate test databases with valid model instances during unit test setup.
  • Generate test data for integration tests without manually specifying every field value.
  • Create related object hierarchies in tests with minimal code.
  • Prototype and validate Django model schemas during development.
  • Reduce test boilerplate when testing model methods and business logic.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Model Bakery creates test fixtures for Django models automatically, generating realistic data for object instances with a single line of code.

Yes. Model Bakery is actively maintained, has no known vulnerabilities, carries a permissive license, and solves a real pain point in Django testing. The low install friction and single dependency make it a safe, practical addition to any Django project's test suite.

Install

model-bakery on PyPI

pip

pip install model-bakery

uv

uv add model-bakery

poetry

poetry add model-bakery

Installing model-bakery

Before you install

Low install friction; pure Python wheel with only django as a runtime dependency. Actively maintained with a recent release and steady commit history.

License in practice

Apache-2.0 permissive license allows commercial and private use with minimal restrictions; suitable for most projects.

Quickstart

pip install model-bakery

from model_bakery import baker

# In a test
customer = baker.make('shop.Customer')
print(customer.name)  # auto-generated value

Requires Django to be installed; requires Python 3.10 or later.

Verify before relying

  • Whether the package supports custom field generation strategies beyond the built-in defaults.
  • Performance characteristics when creating large numbers of related objects.

Package facts

License Apache-2.0 (permissive)
Python support supports the current Python release (>=3.10)
Install friction low — pure-Python wheel
Runtime dependencies 1 — django
Maintenance actively maintained — 52 days since the last release
Last repo commit
First released
Downloads 2,076,886/month — #3,311 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: model_bakery-1.24.0-py3-none-any.whl

Keywords: django, factory, python, testing

Development Status :: 5 - Production/StableFramework :: DjangoFramework :: Django :: 5.2Framework :: Django :: 6.0Intended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: Software Development

Tags

django test fixturesmodel factory djangoautomatic test data generationdjango object mockingsmart fixture creationdjango testing helpersgenerate test objects django
django-testingfixturestest-data

More Software Development packages