{"name":"Mixer: A Powerful Fixture Replacement for Python ORMs and ODMs","description":"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","url":"https://osrepos.com/repo/klen-mixer","source":"osrepos.com","sourceDescription":"This repository profile is provided by osrepos.com, an open source repository discovery platform.","repositoryProfile":"https://osrepos.com/repo/klen-mixer","generatedFor":"open source discovery and AI-assisted research","markdown":"https://osrepos.com/repo/klen-mixer.md","json":"https://osrepos.com/repo/klen-mixer.json","topics":["Python","Django","Flask","SQLAlchemy","Testing","Testing Tools","Data Generation","Fixtures"],"keywords":["Python","Django","Flask","SQLAlchemy","Testing","Testing Tools","Data Generation","Fixtures"],"stars":null,"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.","content":"## Introduction\n\nMixer 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.\n\n## Installation\n\nInstallation is straightforward using pip:\n\nbash\npip install mixer\n\n\nNote: From version 6.2, Mixer requires Python 3.7+. For Python 2 support, the latest version is mixer 6.1.3.\n\n## Examples\n\nMixer integrates seamlessly with various frameworks. Here are a few quick examples:\n\n### Django Workflow\n\npython\nfrom mixer.backend.django import mixer\nfrom customapp.models import User, UserMessage\n\n# Generate a random user\nuser = mixer.blend(User)\n\n# Generate an UserMessage and an User. Set username for generated user to 'testname'.\nmessage = mixer.blend(UserMessage, user__username='testname')\n\n# Generate 5 SomeModel's instances and take company field's values from custom generator\nsome_models = mixer.cycle(5).blend('somemodel', company=(name for name in company_names))\n\n\n### Flask, Flask-SQLAlchemy Workflow\n\npython\nfrom mixer.backend.flask import mixer\nfrom models import User, UserMessage\n\nmixer.init_app(self.app)\n\n# Generate a random user\nuser = mixer.blend(User)\n\n# Generate an userMessage\nmessage = mixer.blend(UserMessage, user=user)\n\n\n## Why Use Mixer\n\nMixer 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.\n\n## Links\n\nExplore Mixer further through these official links:\n\n*   [GitHub Repository](https://github.com/klen/mixer){:target=\"_blank\"}\n*   [Official Documentation](https://mixer.readthedocs.org/){:target=\"_blank\"}\n*   [PyPI Package](https://pypi.python.org/pypi/mixer){:target=\"_blank\"}\n*   [BSD License](http://www.linfo.org/bsdlicense.html){:target=\"_blank\"}","metrics":{"detailViews":0,"githubClicks":0},"dates":{"published":null,"modified":"2026-08-02T23:30:50.000Z"}}