Metadata-Version: 2.4
Name: pyfake
Version: 0.0.7
Summary: A fake data generator that is pydantic compatible.
Author-email: Pranesh Mukhopadhyay <praneshmukherjee7@gmail.com>
License: MIT License
        
        Copyright (c) 2025-26 Pranesh Mukhopadhyay
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Keywords: pydantic,fake data,data generation,data validation,data modeling
Classifier: Intended Audience :: Information Technology
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python
Classifier: Framework :: Pydantic
Classifier: Framework :: Pydantic :: 2
Classifier: Intended Audience :: Developers
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pydantic[email,timezone]>=2.12.5
Dynamic: license-file

<p align="center">
  <a href="https://github.com/Mukhopadhyay/pyfake">
    <img src="https://raw.githubusercontent.com/Mukhopadhyay/pyfake/refs/heads/master/docs/assets/logo.png" alt="Pyfake" width="180">
  </a>
</p>

<h1 align="center">Pyfake</h1>

<p align="center">
  <i>A flexible, schema-driven fake data generator built on top of <b>Pydantic v2</b>.</i>
</p>

<p align="center">
  <a href="https://pypi.org/project/pyfake/">
    <img src="https://img.shields.io/pypi/v/pyfake?style=for-the-badge">
  </a>
  <img src="https://img.shields.io/badge/python-3.9+-3670A0?style=for-the-badge&logo=python&logoColor=ffdd54"/>
  <img src="https://img.shields.io/badge/pydantic-v2-4B8BBE?style=for-the-badge"/>
  <img src="https://img.shields.io/github/stars/Mukhopadhyay/pyfake?style=for-the-badge"/>
</p>

---

<p align="center">
  <b>Docs</b>: https://pyfake.readthedocs.io/en/latest &nbsp;•&nbsp;
  <b>Source</b>: https://github.com/Mukhopadhyay/pyfake
</p>

---

## ✨ Why Pyfake?

Most fake data generators are either:
- ❌ Random but not structured  
- ❌ Structured but not realistic  
- ❌ Hard to extend  

**Pyfake fixes that.**

It leverages **Pydantic models** as the single source of truth to generate:
- ✅ Validated data  
- ✅ Schema-aware fake data  
- ✅ Easily extensible generators  
- ✅ Strong typing + IDE autocomplete  

---

## ⚡ Quick Example

```python
import uuid
from typing import Annotated
from pydantic import BaseModel, Field
from pyfake import Pyfake


class User(BaseModel):
    id: uuid.UUID = Field(default_factory=uuid.uuid4)
    name: Annotated[str, Field(min_length=3, max_length=20)]
    address: Annotated[str, Field(max_length=255)]
    age: Annotated[int, Field(ge=18)]
    is_deleted: bool


users = Pyfake.from_schema(User, num=5)

print(users)
```


### 🧠 How It Works

Pyfake reads your Pydantic schema and:

* Inspects field types and constraints
* Applies intelligent generators
* Produces validated fake data


```mermaid
flowchart LR
    A[Pydantic Model] --> B[Schema Parser]
    B --> C[Generator Engine]
    C --> D[Validated Fake Data]
```

### Installation

**Using `uv` (Recommended)**

```bash
uv add pyfake
```

**Using `pip`*

```bash
python -m venv .venv
source .venv/bin/activate
pip install pyfake
```
