{"library":"pydantic-factories","title":"Pydantic Factories","description":"Pydantic Factories (pydantic-factories) is a Python library designed to generate mock data for Pydantic models and Python dataclasses. Its features include custom field builders, nested model support, and type-safe data generation, making it suitable for testing and prototyping. Version 1.17.3 is the final release; all future development and maintenance have transitioned to the `polyfactory` library.","language":"python","status":"deprecated","last_verified":"Fri Apr 17","install":{"commands":["pip install pydantic-factories"],"cli":null},"imports":["from pydantic_factories import ModelFactory","from pydantic_factories.fields import FactoryField"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"from pydantic import BaseModel\nfrom pydantic_factories import ModelFactory\nfrom datetime import date\n\nclass User(BaseModel):\n    id: int\n    name: str\n    email: str\n    birth_date: date\n\n# Define a factory for your Pydantic model\nclass UserFactory(ModelFactory):\n    __model__ = User\n\n# Generate a single instance\nuser_instance = UserFactory.build()\nprint(f\"Generated User: {user_instance}\")\n\n# Generate a batch of instances\nusers_batch = UserFactory.batch(size=3)\nprint(f\"Generated Batch of Users: {len(users_batch)}\")\n","lang":"python","description":"Demonstrates defining a simple Pydantic model and creating a corresponding `ModelFactory` to generate single instances or batches of mock data. This is the primary usage pattern for `pydantic-factories`.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}