mixer
Mixer -- Is a fixtures replacement. Supported Django ORM, SqlAlchemy ORM, Mongoengine ODM and custom python objects.
What it is and what it does
Mixer is a test-data factory that automatically generates instances of ORM and ODM models with realistic fake data, eliminating the need to hand-write fixtures. It works with Django, SQLAlchemy, Flask-SQLAlchemy, Peewee, Pony, Mongoengine, and Marshmallow, and can also generate instances of plain Python classes. You initialize a mixer for your backend, then call blend() to create a model instance with auto-generated fields; you can override specific fields, control whether objects are saved to the database, and chain operations like cycle() to generate multiple instances.
The package uses Faker to generate human-friendly data by default but can be configured to randomize values instead. It supports nested model generation through double-underscore syntax, field-level generators via register(), and middleware hooks to post-process generated objects. Because maintenance is dormant and the last release was in 2022, compatibility with very recent framework versions may require verification.
Use it for:
- Generate Django model instances with realistic data for unit and integration tests without writing verbose fixtures.
- Create SQLAlchemy ORM objects on-the-fly in test suites, with automatic relationship population.
- Populate test databases with bulk data using cycle() to generate multiple instances in a loop.
- Override specific fields while letting Mixer auto-generate the rest, e.g. blend(User, username='admin').
- Test Mongoengine or Marshmallow schemas by generating valid instances with required fields automatically filled.
- Mock nested relationships by using double-underscore syntax to set related object fields without manual creation.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Mixer generates test data and model instances for Django, SQLAlchemy, Flask-SQLAlchemy, Peewee, Pony, Mongoengine, and Marshmallow, replacing manual fixture creation with automatic fake-data generation.
Yes, if you are testing Django or SQLAlchemy models and want to reduce fixture boilerplate. The package is mature (Production/Stable, 955 stars) and has no known vulnerabilities. However, verify compatibility with your specific framework versions—maintenance is dormant (last release 2022-03-23), so if you use very recent Django or SQLAlchemy releases, test thoroughly or check for open issues in the repository before committing to it.
Install
mixer on PyPI
pip
pip install mixeruv
uv add mixerpoetry
poetry add mixerInstalling mixer
Before you install
Low install friction with a single runtime dependency (Faker). Maintenance is dormant—last release was 2022-03-23 and no commits since 2024-03-08—but the package is marked Production/Stable and has accumulated 955 repository stars, suggesting it is mature and widely used despite infrequent updates.
License in practice
BSD license is permissive, allowing use in commercial and open-source projects with minimal restrictions; you must include the license text in distributions.
Quickstart
from mixer.backend.django import mixer
user = mixer.blend('auth.user')
message = mixer.blend('auth.user', username='testname')
Requires Python 3.7+; Django, SQLAlchemy, or another supported ORM/ODM backend must be installed separately depending on which models you want to generate.
Verify before relying
- Whether dormant maintenance (last release 2022-03-23) poses compatibility risks with recent Django/SQLAlchemy versions.
- Whether the package's documented support for Django 3.0 and 3.1 extends to current Django LTS releases.
- Real-world compatibility testing results with Python 3.8, 3.9, and later versions.
Package facts
| License | BSD (permissive) |
| Python support | supports the current Python release (>=3.7) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — Faker |
| Maintenance | dormant — 1,605 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 270,312/month — #8,238 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: mixer-7.2.2-py3-none-any.whl
Keywords: django, flask, sqlalchemy, testing, mock, stub, mongoengine, data
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
sqlalchemy-mixinsProvides Active Record-style mixins for…
permissive · top 15,000 on PyPI
async-factory-boyExtends factory_boy to generate test fixtures…
permissive · top 15,000 on PyPI
model-mommyModel Mommy generates Django model instances…
permissive · top 15,000 on PyPI
Flask-SQLAlchemyFlask-SQLAlchemy integrates SQLAlchemy database…
permissive · top 1,000 on PyPI
factory-boyfactory_boy replaces static test fixtures with…
permissive · top 1,000 on PyPI
sqlbagsqlbag provides a collection of SQLAlchemy…
unclear · top 15,000 on PyPI
flask-mongoengineFlask-MongoEngine integrates MongoEngine…
permissive · top 15,000 on PyPI
sqlalchemy-serializerAdds a `.to_dict()` method to SQLAlchemy model…
permissive · top 15,000 on PyPI
peeweePeewee is a lightweight ORM that maps Python…
unclear · top 1,000 on PyPI
pytest-fakerProvides pytest fixtures that integrate the…
permissive · top 15,000 on PyPI