skillfed

django-dynamic-fixture

A full library to create dynamic model instances for testing purposes.

django-dynamic-fixture v4.0.1 162.6K downloads/30d#10,596 on PyPI387
Permissive license MIT DORMANT released

What it is and what it does

Django Dynamic Fixture (DDF) is a test-data generation library that creates Django model instances on demand, saving you from writing repetitive fixture code. Instead of manually constructing test objects with all their required fields, you call G(Model) to generate a valid instance with sensible random defaults, then override only the fields that matter for your test. It handles relationships, foreign keys, and nested object creation through a simple dot-notation syntax, and provides utilities like M() for masked random strings and teach() to define reusable generation rules.

The library is designed to keep test code readable and maintainable by letting you focus on test logic rather than data setup. It works with Django's ORM directly and integrates into your existing test suite without special configuration.

Use it for:

  • Writing unit tests for Django models where you need valid instances but don't care about most field values
  • Creating related objects in tests without nested fixture boilerplate
  • Generating multiple test instances quickly for bulk test data
  • Testing model methods and querysets where the test logic matters more than the data setup
  • Defining reusable test data patterns across a test suite using teach() to configure model generation rules

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Creates dynamic Django model instances for testing without manual fixture setup, letting you generate test data with minimal boilerplate.

Yes, if you write Django tests. DDF has no runtime dependencies, low install friction, and a stable track record since its first release in 2011. The dormant maintenance status is acceptable for a mature library—it does one thing well and doesn't require frequent updates. Install it if you want to reduce test boilerplate; skip it only if your project uses minimal fixtures or a different test-data strategy.

Install

django-dynamic-fixture on PyPI

pip

pip install django-dynamic-fixture

uv

uv add django-dynamic-fixture

poetry

poetry add django-dynamic-fixture

Installing django-dynamic-fixture

Before you install

Low friction install with no runtime dependencies. Maintenance is dormant—last release was Sep 2023 and last commit Oct 2024—but the package is stable and widely used. Suitable for established projects that don't require active development.

License in practice

MIT license is permissive; you can use this in commercial and open-source projects with minimal restrictions.

Quickstart

pip install django-dynamic-fixture

from ddf import G

author = G(Author)
book = G(Book, authors=[author])

Requires Django to be installed and configured in your project; DDF generates instances for Django models only.

Verify before relying

  • Whether the package works with Django versions released after Oct 2024
  • Compatibility with Python 3.12+ (classifiers list only up to 3.11)
  • Monthly download volume and its stability over time

Package facts

License MIT (permissive)
Python support not specified
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance dormant — 1,064 days since the last release
Last repo commit
First released
Downloads 162,576/month — #10,596 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: django_dynamic_fixture-4.0.1-py3-none-any.whl

Keywords: python, django, testing, fixture

Framework :: DjangoOperating System :: OS IndependentProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: PyPyTopic :: Software Development

Tags

django test fixturesgenerate test data djangodjango model factorydynamic test instancesdjango testing helpersmock django modelsdjango test data generation
django-testingtest-fixturesorm-helpers

More Software Development packages

typing-extensions

Provides backported and experimental type hints…

permissive · top 100 on PyPI

numpy

NumPy provides an N-dimensional array object…

permissive · top 100 on PyPI

fastapi

FastAPI is a Python web framework for building…

permissive · top 100 on PyPI

annotated-doc

Provides a way to document function parameters,…

permissive · top 100 on PyPI

typer

Typer builds command-line applications from…

permissive · top 1,000 on PyPI

distlib

Distlib provides low-level packaging utilities…

permissive · top 1,000 on PyPI

pytest-unused-fixtures

A pytest plugin that identifies and reports…

permissive · top 15,000 on PyPI

pytest-factoryboy

Integrates factory_boy with pytest to register…

permissive · top 5,000 on PyPI

pytest-lazy-fixtures

Allows you to reference pytest fixtures…

permissive · top 5,000 on PyPI

django-phonenumber-field

Provides a Django model field for storing,…

permissive · top 5,000 on PyPI

django-fixture-magic

Provides Django management commands to dump…

permissive · top 15,000 on PyPI

pytest-lazy-fixture

Allows you to use pytest fixtures directly as…

permissive · top 15,000 on PyPI

pytest-fixture-config

Provides configuration objects and decorators…

permissive · top 15,000 on PyPI

marshmallow-sqlalchemy

Generates marshmallow schemas from SQLAlchemy…

permissive · top 5,000 on PyPI

pytest-postgresql

A pytest plugin that provides fixtures to…

copyleft · top 5,000 on PyPI

pytest-rng

Provides pytest fixtures that make random…

permissive · top 15,000 on PyPI