Mixer: A Powerful Fixture Replacement for Python ORMs and ODMs
This repository profile is provided by osrepos.com, an open source repository discovery platform.

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.
Repository Information
Topics
Click on any tag to explore related repositories
Use at your own risk
OSRepos shares public repositories for knowledge and discovery only. Any installation, execution, configuration, or use of code from these repositories is the user's own responsibility. Always review the repository, source code, dependencies, licenses, and security implications before running or installing anything. OSRepos is not responsible for issues, damages, or losses resulting from third-party repositories.
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:
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
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
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:
Related repositories
Similar repositories that may be relevant next.

HTTPretty: Intercepting HTTP Requests for Python Testing
August 3, 2026
HTTPretty is a powerful Python library designed to intercept HTTP requests at the socket level, effectively faking the entire socket module. It provides a robust solution for mocking external HTTP services, making it ideal for test-driven development and reliable API integration testing. Developers can use HTTPretty to simulate various HTTP responses, ensuring comprehensive and isolated testing environments.

fake2db: Generate Custom Test Databases with Fake Data
August 2, 2026
fake2db is a powerful Python utility designed to create custom test databases populated with fake, yet valid, data. It supports a wide array of popular database systems, including SQLite, MySQL, PostgreSQL, MongoDB, Redis, and CouchDB. This tool is ideal for developers and testers needing quick, realistic data for testing and development environments.

Mimesis: A Powerful Python Library for Realistic Fake Data Generation
August 2, 2026
Mimesis is a robust Python library designed for generating fake yet realistic data across various languages and locales. It simplifies the creation of diverse data types, from personal information to financial details. This makes it an invaluable tool for development, testing, and anonymization tasks.

chardet: A Fast and Accurate Python Character Encoding Detector
August 2, 2026
chardet is a powerful Python library designed for universal character encoding detection. The recently rewritten version 7 offers significant improvements in accuracy and speed, making it a robust solution for identifying text encodings. It provides features like language and MIME type detection, along with a flexible API for various use cases.
Source repository
Open the original repository on GitHub.