# Mixer: A Powerful Fixture Replacement for Python ORMs and ODMs

This repository profile is provided by osrepos.com, an open source repository discovery platform.

Source: osrepos.com
Repository profile: https://osrepos.com/repo/klen-mixer
Generated for open source discovery and AI-assisted research.

Mixer is a versatile Python library designed to replace fixtures and generate test data efficiently. It supports various ORMs and ODMs, including Django, SQLAlchemy, Flask-SQLAlchemy, Mongoengine, and Marshmallow, making it an invaluable tool for testing and development workflows.

GitHub: https://github.com/klen/mixer
OSRepos URL: https://osrepos.com/repo/klen-mixer

## Summary

Mixer is a versatile Python library designed to replace fixtures and generate test data efficiently. It supports various ORMs and ODMs, including Django, SQLAlchemy, Flask-SQLAlchemy, Mongoengine, and Marshmallow, making it an invaluable tool for testing and development workflows.

## Topics

- Python
- Django
- Flask
- SQLAlchemy
- Testing
- Testing Tools
- Data Generation
- Fixtures

## Repository Information

Last analyzed by OSRepos: Mon Aug 03 2026 00:30:50 GMT+0100 (Western European Summer Time)
Detail views: 0
GitHub clicks: 0

## Safety Notice

OSRepos shares public repositories for knowledge and discovery only. Review source code, dependencies, licenses, and security implications before running or installing anything.

## Content

## Introduction

Mixer is a robust Python library that simplifies the generation of test data and acts as a powerful fixture replacement. It's designed to create instances of Django, SQLAlchemy, Flask-SQLAlchemy, Peewee, Pony, Mongoengine, and Marshmallow models, as well as custom Python objects. This tool is particularly useful for streamlining your testing process by providing fast and convenient test-data generation.

## Installation

Installation is straightforward using pip:

bash
pip install mixer


Note: From version 6.2, Mixer requires Python 3.7+. For Python 2 support, the latest version is mixer 6.1.3.

## Examples

Mixer integrates seamlessly with various frameworks. Here are a few quick examples:

### Django Workflow

python
from mixer.backend.django import mixer
from customapp.models import User, UserMessage

# Generate a random user
user = mixer.blend(User)

# Generate an UserMessage and an User. Set username for generated user to 'testname'.
message = mixer.blend(UserMessage, user__username='testname')

# Generate 5 SomeModel's instances and take company field's values from custom generator
some_models = mixer.cycle(5).blend('somemodel', company=(name for name in company_names))


### Flask, Flask-SQLAlchemy Workflow

python
from mixer.backend.flask import mixer
from models import User, UserMessage

mixer.init_app(self.app)

# Generate a random user
user = mixer.blend(User)

# Generate an userMessage
message = mixer.blend(UserMessage, user=user)


## Why Use Mixer

Mixer stands out for its flexibility and power in generating test data. It eliminates the need for manual fixture creation, saving significant development time. Its support for a wide array of Python ORMs and ODMs, including Django, SQLAlchemy, Flask-SQLAlchemy, Peewee, Pony, Mongoengine, and Marshmallow, makes it a versatile choice for diverse projects. Features like custom field generators, middlewares, and locale support further enhance its adaptability, allowing developers to create realistic and specific test scenarios with minimal effort.

## Links

Explore Mixer further through these official links:

*   [GitHub Repository](https://github.com/klen/mixer){:target="_blank"}
*   [Official Documentation](https://mixer.readthedocs.org/){:target="_blank"}
*   [PyPI Package](https://pypi.python.org/pypi/mixer){:target="_blank"}
*   [BSD License](http://www.linfo.org/bsdlicense.html){:target="_blank"}