Polyfactory logo

Polyfactory

Simple and powerful mock data generation library for Python based on type hints, supporting Pydantic, dataclasses, TypedDicts, attrs and msgspec.

-

Our Verdict

The right mock data tool for typed Python codebases, far ahead of factory_boy when you already use Pydantic.

Pros

  • Generates mocks from Python type hints
  • Supports Pydantic, dataclasses, TypedDict, attrs
  • Reduces fixture boilerplate significantly
  • Works well with pytest and FastAPI tests

Cons

  • Random data can mask deterministic bugs
  • Complex nested types need custom factories
  • Smaller community than factory_boy
Best for: Python teams using Pydantic or typed models who need fast fixture generation Not for: Projects without type hints where factory_boy patterns fit better

When to Use Polyfactory

Good fit if you need

  • Generate mock data from Pydantic models with one call
  • TypedDict and dataclass factories for Python test fixtures
  • Override specific fields while auto-filling the rest
  • Bulk fixture generation for performance test seeding

Lock-in Assessment

Low 5/5
Lock-in Score
5/5

Polyfactory Pricing

Pricing Model
free
Free Tier
Yes
Entry Price
Enterprise Available
No
Transparency Score

Beta — estimates may differ from actual pricing

1,000
1001K10K100K1M

Estimated Monthly Cost

$25

Estimated Annual Cost

$300

Estimates are approximate and may not reflect current pricing. Always check the official pricing page.

Project Health

B

Health Score

1.4k 113
Bus Factor

9

Last Commit

21 days

Release Freq

25d

Open Issues

67

Issue Response

N/A

License

MIT

Last checked: 2026-04-21

Community Discussion

Comments powered by Giscus (GitHub Discussions). You need a GitHub account to comment.