A fake data generator that is pydantic compatible.
Project description
Pyfake
A flexible, schema-driven fake data generator built on top of Pydantic v2.
Docs: mukhopadhyay.github.io/pyfake • Source: github.com/Mukhopadhyay/pyfake
✨ 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
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
flowchart LR
A[Pydantic Model] --> B[Schema Parser]
B --> C[Generator Engine]
C --> D[Validated Fake Data]
Installation
Using uv (Recommended)
uv add pyfake
Using pip
python -m venv .venv
source .venv/bin/activate
pip install pyfake
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyfake-0.0.8.tar.gz.
File metadata
- Download URL: pyfake-0.0.8.tar.gz
- Upload date:
- Size: 12.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.24 {"installer":{"name":"uv","version":"0.9.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c28dbecdf751ecb06cd98ff3e03cb4ec041096d8cc01d84f5b69fe08496eb3cc
|
|
| MD5 |
4534c36f495c40518171cfdc4f832234
|
|
| BLAKE2b-256 |
580b838ac994b3f5e47f8281c33f9063581a270781f153e10e55b511cf14e604
|
File details
Details for the file pyfake-0.0.8-py3-none-any.whl.
File metadata
- Download URL: pyfake-0.0.8-py3-none-any.whl
- Upload date:
- Size: 13.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.24 {"installer":{"name":"uv","version":"0.9.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8f17f6b2036d3169db33e7b78ef299b695c3558f82d73c6dff465a447f904091
|
|
| MD5 |
7449d38b8f5369bd0f935fd32ccf97a7
|
|
| BLAKE2b-256 |
6e40199732c87c89f172fff44dbba62a43862b72aa2974c960966cfa005cf1aa
|