--- id: pydantic-factories version: "1.17.3" license: MIT license_treatment: permissive maintenance: abandoned --- # pydantic-factories — Mock data generation for pydantic based models and python dataclasses License: permissive · Maintenance: abandoned · Downloads: 166.6K/mo ## 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 above — verify before relying. Generates mock data objects that conform to pydantic models, dataclasses, and TypedDicts by parsing type annotations and field constraints. 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 pip install pydantic-factories uv add pydantic-factories poetry add pydantic-factories ## Installing pydantic-factories 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_current - Install friction: low - Maintenance: abandoned - Downloads: 166.6K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags pydantic mock data generation, factory for pydantic models, test data fixtures pydantic, dataclass mock factory, generate fake pydantic instances, testing data builders, pydantic model mocking, test-fixtures, abandoned-project [View on SkillFed](https://skillfed.io/packages/pydantic-factories) · [View on PyPI](https://pypi.org/project/pydantic-factories/)