--- id: model-bakery version: "1.24.0" license: Apache-2.0 license_treatment: permissive maintenance: active --- # model-bakery — Smart object creation facility for Django. License: permissive · Maintenance: active · Downloads: 2.1M/mo ## 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 above — 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 pip install model-bakery uv add model-bakery 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_current - Install friction: low - Maintenance: active - Downloads: 2.1M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags django test fixtures, model factory django, automatic test data generation, django object mocking, smart fixture creation, django testing helpers, generate test objects django, django-testing, fixtures, test-data [View on SkillFed](https://skillfed.io/packages/model-bakery) · [View on PyPI](https://pypi.org/project/model-bakery/)