$npx skillfedfor your agent

polyfactory

Mock data generation factories

Worth itPyPI Software DevelopmentReleased Feb 202611.3M downloads / moMITPure Python

Decision gist · record as of 2026-08-14

pure-Python wheel — polyfactory-3.3.0-py3-none-any.whl
v3.3.0 · released 2026-02-22 · Python <4.0,>=3.9 · 2 runtime deps: faker, typing-extensions

Yes. Polyfactory is actively maintained, has no known vulnerabilities, low install friction, and solves a real testing problem—eliminating manual fixture boilerplate. It's well-suited for any project using typed Python models that needs realistic mock data for tests.AI-flagged interpretation of the facts on this page — verify before relying

Before you install

  • Low friction install with only two runtime dependencies (faker and typing-extensions).
  • Actively maintained as part of the Litestar project with recent activity and no known vulnerabilities.

License · maintenance · safety

MIT (permissive) — MIT license is permissive; you can use, modify, and distribute this package freely in both open-source and commercial projects with minimal restrictions.

last release 2026-02-22 (173 days) · last repo commit 2026-08-04 · 1,501 stars

0 known vulnerabilities (OSV.dev, 2026-08-14) · 11,299,823 downloads/mo, #1,401 on PyPI

Verify before relying

pip install polyfactory

from dataclasses import dataclass
from polyfactory.factories import DataclassFactory

@dataclass
class Person:
    name: str
    age: float

class PersonFactory(DataclassFactory[Person]):
    pass

person = PersonFactory.build()
  • Whether the library supports generating data for custom classes beyond the documented types (dataclasses, Pydantic, typed-dicts, msgspec, attrs, SQLAlchemy).
  • Performance characteristics when generating large volumes of mock objects or deeply nested structures.
Same gist for agents: .md · .json

What it is and what it does

Polyfactory is a mock data generation library that reads type hints from your data models and automatically generates realistic test objects without manual configuration. It works with dataclasses, Pydantic models, typed-dicts, msgspec structs, and other typed structures, making it straightforward to create test fixtures that match your schema.

You define a factory class that inherits from the appropriate factory type for your model, and then call `.build()` to generate a populated instance. The library uses faker under the hood to produce realistic values (names, addresses, dates, etc.) that respect the types declared in your model. This eliminates boilerplate fixture code and keeps your test data generation in sync with your schema as it evolves.

Use it for

  • Generate realistic test data for unit tests without writing fixture factories by hand for each model.
  • Create mock Pydantic or dataclass instances for integration tests with pre-populated fields matching your schema.
  • Populate test databases with diverse, type-correct sample data for testing queries and business logic.
  • Build mock API responses during development when the real service is unavailable or not yet implemented.
  • Generate synthetic data for performance testing or load testing with properly typed, realistic values.

Worth the install?

AI-flagged interpretation of the facts on this page. Verify before relying on it.

Worth it

Yes.

Polyfactory is actively maintained, has no known vulnerabilities, low install friction, and solves a real testing problem—eliminating manual fixture boilerplate. It's well-suited for any project using typed Python models that needs realistic mock data for tests.

Install

polyfactory on PyPI

Before you install

Low friction install with only two runtime dependencies (faker and typing-extensions). Actively maintained as part of the Litestar project with recent activity and no known vulnerabilities.

License in practice

MIT license is permissive; you can use, modify, and distribute this package freely in both open-source and commercial projects with minimal restrictions.

Quickstart

pip install polyfactory

from dataclasses import dataclass
from polyfactory.factories import DataclassFactory

@dataclass
class Person:
    name: str
    age: float

class PersonFactory(DataclassFactory[Person]):
    pass

person = PersonFactory.build()

Verify before relying

  • Whether the library supports generating data for custom classes beyond the documented types (dataclasses, Pydantic, typed-dicts, msgspec, attrs, SQLAlchemy).
  • Performance characteristics when generating large volumes of mock objects or deeply nested structures.

Package facts

LicenseMIT permissive
Python supportSupports the current Python release <4.0,>=3.9
Install frictionLow. Pure-Python wheel
Runtime dependencies
2 packages
fakertyping-extensions
MaintenanceActively maintained 173 days since the last release
Last repo commit
First released
Downloads11,299,823 / month, #1,401 on PyPI 30-day window, as of 2026-08-14
Known vulnerabilitiesNone known OSV.dev, checked 2026-08-14
Classifiers
Development Status :: 5 - Production/StableEnvironment :: Web EnvironmentFramework :: PytestIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseNatural Language :: EnglishOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.9Topic :: Software DevelopmentTopic :: Software Development :: LibrariesTopic :: Software Development :: TestingTopic :: Software Development :: Testing :: UnitTopic :: UtilitiesTyping :: Typed

Evidence: polyfactory-3.3.0-py3-none-any.whl

Tags

Capabilities
mock data generationtest fixture factorydataclass mock builderpydantic model factorytype-hint based test datafake data from typestesting data generator
Topics
testingfixturesmock-data
PyPI keywords
attrsdataclassesmsgspecpydanticsqlalchemy

Let your AI agent find packages like this

Example. Real query, live index.

You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.

wish › “mock data generation”

  • polyfactoryPolyfactory generates mock data objects from type hints, supporting…
  • pydantic-factoriesGenerates mock data objects that conform to pydantic models,…
  • mimesisMimesis generates realistic fake data across 47 locales—names,…

Give your agent the search over MCP, or paste the wish link into any chat.

More Software Development packages

typing-extensions Worth it
PyPI · Software Development · released Jul 2026

Provides backported and experimental type hints for Python 3.9+, allowing use of newer typing features on older Python versions and enabling early experimentation with type system PEPs before they enter the standard library.

PSF-2.0pure Python · 3.9+
1.9Bdownloads / mo
numpy Worth it
PyPI · Software Development · released Aug 2026

NumPy provides an N-dimensional array object and a comprehensive suite of mathematical, linear algebra, Fourier transform, and random number functions for scientific computing in Python.

BSD-3-Clause AND 0BSD AND MIT AND Zlib AND CC0-1.0compiled wheel · 3.12+
1.1Bdownloads / mo
fastapi Worth it
PyPI · Software Development · released Jul 2026

FastAPI is a Python web framework for building REST APIs using type hints, with automatic request validation, serialization, and interactive API documentation.

MITpure Python · 3.10+
568.6Mdownloads / mo
annotated-doc With conditions
PyPI · Software Development · released Jul 2026

Provides a way to document function parameters, class attributes, return types, and variables inline using Python's `Annotated` type hint syntax instead of traditional docstrings.

MITpure Python · 3.9+
456.2Mdownloads / mo
typer Worth it
PyPI · Software Development · released Aug 2026

Typer builds command-line applications from Python functions using type hints, automatically generating help text, argument parsing, and shell completion.

Install it if you are building CLIs in Python.

MITpure Python · 3.10+
369.3Mdownloads / mo
distlib With conditions
PyPI · Software Development · released Jun 2026

Distlib provides low-level packaging utilities for building, distributing, and managing Python software—including metadata handling, version specifiers, wheel support, script installation, and dependency resolution.

permissive licensepure Python
323.3Mdownloads / mo

See also pydantic-factories · datamodel-code-generator · django-clone · coqpit · dataclass-factory · dataclasses-jsonschema · dydantic · jsonschema-pydantic · desert · wagtail-factories