# litestar-org/polyfactory

Simple and powerful factories for mock data generation

Repository: https://github.com/litestar-org/polyfactory
Canonical: https://ross.abutalabs.com/products/polyfactory
Homepage: https://polyfactory.litestar.dev/
Language: Python
License: MIT
License Family: permissive
Topics: pydantic, python, dataclasses, starlite, hacktoberfest, typeddict, litestar, pydantic-factories, polyfactory, beanie, msgspec, odmantic
Last push: 2026-08-24T22:43:58+00:00

## Health v2 (maintenance only)
Score: 89/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 99, release rhythm 71, longevity 100
- inputs: {"age_days": 1754, "days_push": 9, "days_rel": 192, "gap_med": 28, "n_releases_24m": 16}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1501, forks 118 (observed 2026-08-28T04:04:54.333491+00:00)

## What it is
Polyfactory is a Python library that generates mock data from type hints, supporting frameworks like Pydantic, dataclasses, TypedDict, attrs, msgspec, and SQLAlchemy models. It provides simple, declarative factories for creating realistic test fixtures and sample data.

## Use cases
- generate mock data for pydantic models in tests
- create test fixtures from dataclasses automatically
- generate fake data for sqlalchemy models
- mock data generation for typeddict and msgspec
- seed databases with realistic sample data
- auto-generate test payloads for api testing

## When to choose
- you need type-aware mock data for Python models in tests
- you use Pydantic, dataclasses, attrs, msgspec, or SQLAlchemy and want automatic fixtures
- you want to replace hand-written factory boilerplate

## When to avoid
- you need mock data for non-Python typed models
- you only need simple random strings without type awareness
- you need production-grade synthetic data with strict privacy guarantees

## Facets
- artifact type: library
- maturity: active
- function: data-generation, testing, mocking
- domain: testing, developer-tools, data-science
- platform: python, cross-platform
- tags: pydantic, dataclasses, typeddict, msgspec, attrs, sqlalchemy, beanie, odmantic, fixture-generation, fake-data

## Member repositories
- litestar-org/polyfactory (main) score 89

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:04:54.333491+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T04:32:56.859878+00:00, confidence not recorded.
  - readme: https://github.com/litestar-org/polyfactory (fetched 2026-08-28T04:04:54.333491+00:00, sha 52da243c89f4)
  - homepage: https://polyfactory.litestar.dev/ (fetched 2026-08-29T11:37:52.546895+00:00, sha 7425e5cf2b07)
  - registry_pypi: https://pypi.org/pypi/polyfactory/json (fetched 2026-08-29T11:37:52.549127+00:00, sha ea03489fefb5)
- Data as of 2026-08-30T08:39:29.467469+00:00.
