pydantic-factories
Mock data generation for pydantic based models and python dataclasses
Decision gist · record as of 2026-08-14
No. The project is archived and abandoned as of April 2023, with maintainers explicitly directing users to migrate to polyfactory. While the code may still work with current pydantic versions, there will be no fixes for compatibility issues with future releases. Start with polyfactory instead unless you are maintaining legacy code already using this package.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Low friction install with three straightforward runtime dependencies.
- However, the repository is archived and the project is abandoned; the maintainers have explicitly migrated to polyfactory as the successor.
- No updates since April 2023.
License · maintenance · safety
MIT (permissive) — MIT license permits commercial and private use with minimal restrictions, making it safe to adopt from a licensing standpoint.
last release 2023-04-03 (1229 days) · last repo commit 2023-04-03 · 16 stars · archived
0 known vulnerabilities (OSV.dev, 2026-08-14) · 166,645 downloads/mo, #10,485 on PyPI
Alternatives
Verify before relying
pip install pydantic-factories
from pydantic import BaseModel
from pydantic_factories import ModelFactory
class Person(BaseModel):
name: str
age: int
class PersonFactory(ModelFactory):
__model__ = Person
result = PersonFactory.build()- Whether existing code using pydantic-factories will continue to work with future pydantic versions without maintenance.
- Compatibility with pydantic v2 and later versions, given the project's abandoned status.
What it is and what it does
Pydantic-factories is a mock data generator that inspects pydantic model definitions, dataclasses, and TypedDicts to automatically create realistic test instances. It uses type hints and field constraints as a blueprint, delegating to faker for realistic string and date generation. You define a factory class pointing to your model, call `.build()`, and receive a fully populated instance ready for testing—no manual field assignment needed.
The library integrates faker and pydantic to handle both built-in Python types and pydantic-specific types, respecting field constraints. It's designed for unit testing and test-driven development workflows where you need representative mock objects quickly. The project is no longer maintained; the authors have moved development to polyfactory.
Use it for
- Generate realistic test fixtures for pydantic models in unit tests without manually populating every field.
- Create mock data for dataclass-based APIs during development and testing phases.
- Populate TypedDict instances with valid random data for integration test scenarios.
- Quickly prototype test suites for pydantic-based applications during TDD workflows.
- Generate bulk test data for validation and constraint-testing of model fields.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
No.
The project is archived and abandoned as of April 2023, with maintainers explicitly directing users to migrate to polyfactory. While the code may still work with current pydantic versions, there will be no fixes for compatibility issues with future releases. Start with polyfactory instead unless you are maintaining legacy code already using this package.
Install
pydantic-factories on PyPI
Before you install
Low friction install with three straightforward runtime dependencies. However, the repository is archived and the project is abandoned; the maintainers have explicitly migrated to polyfactory as the successor. No updates since April 2023.
License in practice
MIT license permits commercial and private use with minimal restrictions, making it safe to adopt from a licensing standpoint.
Quickstart
pip install pydantic-factories
from pydantic import BaseModel
from pydantic_factories import ModelFactory
class Person(BaseModel):
name: str
age: int
class PersonFactory(ModelFactory):
__model__ = Person
result = PersonFactory.build()
Verify before relying
- Whether existing code using pydantic-factories will continue to work with future pydantic versions without maintenance.
- Compatibility with pydantic v2 and later versions, given the project's abandoned status.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.8,<4.0 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 3 packagesfakerpydantictyping-extensions |
| Maintenance | Abandoned 1,229 days since the last release |
| Last repo commit | repository archived |
| First released | |
| Downloads | 166,645 / month, #10,485 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Environment :: Web EnvironmentFramework :: PytestIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseNatural Language :: EnglishOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Software DevelopmentTopic :: Software Development :: LibrariesTopic :: Software Development :: TestingTopic :: Software Development :: Testing :: UnitTopic :: UtilitiesTyping :: Typed |
Evidence: pydantic_factories-1.17.3-py3-none-any.whl
Tags
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 › “pydantic mock data generation”
- pydantic-factoriesGenerates mock data objects that conform to pydantic models,…
- polyfactoryPolyfactory generates mock data objects from type hints, supporting…
- patitoPatito combines pydantic models with polars DataFrames to provide…
Give your agent the search over MCP, or paste the wish link into any chat.
More Software Development packages
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.
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.
FastAPI is a Python web framework for building REST APIs using type hints, with automatic request validation, serialization, and interactive API documentation.
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.
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.
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.
See also polyfactory · pydantic-collections · pydantic · mimesis · dydantic · pydantic-to-typescript2 · pydantic-to-typescript · graphene-pydantic · datamodel-code-generator · pydantic_yaml