skillfed

mixer

Mixer -- Is a fixtures replacement. Supported Django ORM, SqlAlchemy ORM, Mongoengine ODM and custom python objects.

mixer v7.2.2 270.3K downloads/30d#8,238 on PyPI955
Permissive license BSD DORMANT released

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 mixer

uv

uv add mixer

poetry

poetry add mixer

Installing 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

Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: BSD LicenseProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Software Development :: Libraries :: Python ModulesTopic :: Software Development :: TestingTopic :: Utilities

Tags

django test fixturessqlalchemy model factorytest data generationorm instance generatorfixture replacementfake data for testingmodel mocking
fixturesorm-factorytest-data

More Python Modules packages