Skip to main content

Model Bakery: Smart fixtures for better tests

Build Coverage Latest PyPI version Documentation Status

Model Bakery offers you a smart way to create fixtures for testing in Django. With a simple and powerful API, you can create many objects with a single line of code.

Installation

pip install model-bakery

Supported Versions

Model Bakery follows the Python and Django release and support cycles. We drop support for Python and Django versions when they reach end-of-life.

Basic usage

# models.py
from django.db import models

class Customer(models.Model):
    name = models.CharField(max_length=30)
    email = models.EmailField()
    age = models.IntegerField()
    is_jards_macale_fan = models.BooleanField()
    bio = models.TextField()
    birthday = models.DateField()
    last_shopping = models.DateTimeField()

# test_models.py
from django.test import TestCase
from model_bakery import baker

class TestCustomerModel(TestCase):
    def setUp(self):
        self.customer = baker.make('shop.Customer')
        print(self.customer.__dict__)

"""
{'_state': <django.db.models.base.ModelState object at 0x1129a3240>,
 'age': 3841,
 'bio': 'vUFzMUMyKzlnTyiCxfgODIhrnkjzgQwHtzIbtnVDKflqevczfnaOACkDNqvCHwvtWdLwoiKrCqfppAlogSLECtMmfleeveyqefkGyTGnpbkVQTtviQVDESpXascHAluGHYEotSypSiHvHzFteKIcUebrzUVigiOacfnGdvijEPrZdSCIIBjuXZMaWLrMXyrsUCdKPLRBRYklRdtZhgtxuASXdhNGhDsrnPHrYRClhrSJSVFojMkUHBvSZhoXoCrTfHsAjenCEHvcLeCecsXwXgWJcnJPSFdOmOpiHRnhSgRF',
 'birthday': datetime.date(2019, 12, 3),
 'email': 'rpNATNsxoj@example.com',
 'is_jards_macale_fan': True,
 'id': 1,
 'last_shopping': datetime.datetime(2019, 12, 3, 21, 42, 34, 77019),
 'name': 'qiayYnESvqcYLLBzxpFOcGBIfnQEPx'}
"""

Documentation

For more detailed information, check out the full documentation.

Contributing

As an open-source project, Model Bakery welcomes contributions of many forms:

  • Code patches
  • Documentation improvements
  • Bug reports

Take a look at our contribution guidelines for instructions on how to set up your local environment.

Maintainers

Contributors

Model Bakery is built by its community. See the full list of contributors.

Project history

Model Bakery was originally created by Vanderson Mota as Model Mommy. The project was previously maintained in the berinhard/model_mommy repository before being renamed and moved here.

Sponsors

Sponsors

License

Model Bakery is licensed under Apache License 2.0. See the LICENSE file for more information.

Metadata

Release files for model-bakery 1.25.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for model-bakery 1.25.0
File Size Uploaded Provenance Actions
model_bakery-1.25.0.tar.gz 31.3 kB With provenance Details for model_bakery-1.25.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for model-bakery 1.25.0
File Interpreter ABI Platform Actions
model_bakery-1.25.0-py3-none-any.whl Python 3 none any Details for model_bakery-1.25.0-py3-none-any.whl

Total release size: 64.0 kB

Release files / model_bakery-1.25.0.tar.gz

Download URL model_bakery-1.25.0.tar.gz
Size 31.3 kB
Tags Source
SHA-256 checksum
How to use checksums
64b021c948f7da0ffdcd1629effcfde4235b75d23ccd939811e37c016d969a47
BLAKE2b-256 checksum
How to use checksums
d886d0cce6375c1142e557e38a5d7d54f4ea670218597ef1468b767fed84978c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.

Transparency log

Release files / model_bakery-1.25.0-py3-none-any.whl

Download URL model_bakery-1.25.0-py3-none-any.whl
Size 32.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
66c335a42c9759ecf50fd3e94a0ddd7a4e5110cc4ca2736cad9abb7615c7ba51
BLAKE2b-256 checksum
How to use checksums
7fe081cb3240f513fae4ca874e319af96e1fe90f6eb5370899f589a9f613fda6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.

Transparency log

Security for model-bakery 1.25.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for model_bakery-1.25.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.25.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page