Mimesis generates high-performance fake data. pip install mimesis. Provider: from mimesis import Person, Address, Finance, Internet. p = Person(); p.first_name() → “Alice”. p.last_name(), p.email(), p.username(), p.password(), p.phone(), p.age(). Address: a = Address(); a.city(), a.street_name(), a.zip_code(), a.country(), a.state(). Finance: f = Finance(); f.price(), f.currency(), f.currency_symbol(), f.credit_card_number(), f.company(). Internet: i = Internet(); i.ip_v4(), i.uri(), i.slug(), i.user_agent(), i.hostname(). Datetime: dt = Datetime(); dt.date(), dt.datetime(), dt.timestamp(). Transport: t = Transport(); t.car(), t.manufacturer(). Text: tx = Text(); tx.word(), tx.sentence(), tx.title(). Food: fd = Food(); fd.dish(), fd.spices(). Locale: from mimesis import Locale; Person(Locale.DE) — German names. Locale.JA, Locale.ZH, Locale.FR, Locale.ES, Locale.RU. Generic: from mimesis import Generic; g = Generic(Locale.EN); g.person.full_name(). Seed: from mimesis import Person; p = Person(seed=42) — reproducible. Field: from mimesis import Field; _ = Field(Locale.EN); _("person.email"). _("address.city"). Fieldset: from mimesis import Fieldset; f = Fieldset(Locale.EN, i=10); f("person.email") → 10 unique emails. Schema: from mimesis.schema import Schema. schema = Schema(schema=lambda: {"name": _("person.full_name"), "email": _("person.email")}). schema.create(iterations=100) → list of 100 dicts. Custom provider: from mimesis.providers.base import BaseProvider. class SkuProvider(BaseProvider): class Meta: name="sku". def sku(self): return f"PROD-{self.random.randint(1000,9999)}". g.add_provider(SkuProvider). g.sku.sku(). pytest: @pytest.fixture def fake_user(): return Schema(schema=lambda: {"email": _("person.email")}).create(1)[0]. Claude Code generates Mimesis schemas, locale-aware fixtures, and Schema batch factories.
CLAUDE.md for Mimesis
## Mimesis Stack
- Version: mimesis >= 17.0 | pip install mimesis
- Provider: Person | Address | Finance | Internet | Datetime | Text | Transport
- Locale: Person(Locale.DE) | Generic(Locale.FR) for 30+ languages
- Seed: Person(seed=42) — reproducible test data across runs
- Field: from mimesis import Field; _ = Field(Locale.EN); _("person.email")
- Schema: Schema(schema=lambda: {...}).create(iterations=N) — batch factory
- Custom: class P(BaseProvider): class Meta: name="x"; method returns fake data
Mimesis Fake Data Pipeline
# tests/conftest_mimesis.py — Mimesis providers, Schema, and pytest fixtures
from __future__ import annotations
from decimal import Decimal
from typing import Any
import pytest
from mimesis import Address, Datetime, Finance, Generic, Internet, Person, Text
from mimesis import Field, Fieldset, Locale
from mimesis.providers.base import BaseProvider
from mimesis.schema import Schema
# ─────────────────────────────────────────────────────────────────────────────
# 1. Individual providers — direct usage
# ─────────────────────────────────────────────────────────────────────────────
_person = Person(Locale.EN, seed=42)
_address = Address(Locale.EN, seed=42)
_finance = Finance(Locale.EN, seed=42)
_internet= Internet(seed=42)
_dt = Datetime(seed=42)
_text = Text(Locale.EN, seed=42)
def demo_providers() -> None:
print("=== Person ===")
print(f" full_name: {_person.full_name()}")
print(f" email: {_person.email()}")
print(f" username: {_person.username()}")
print(f" phone: {_person.telephone()}")
print(f" age: {_person.age()}")
print("=== Address ===")
print(f" city: {_address.city()}")
print(f" state: {_address.state()}")
print(f" zip_code: {_address.zip_code()}")
print(f" country: {_address.country()}")
print(f" address: {_address.address()}")
print("=== Finance ===")
print(f" price: {_finance.price()}")
print(f" company: {_finance.company()}")
print(f" currency: {_finance.currency_symbol()} {_finance.currency()}")
print("=== Internet ===")
print(f" ip_v4: {_internet.ip_v4()}")
print(f" uri: {_internet.uri()}")
print(f" user_agent: {_internet.user_agent()}")
print("=== Datetime ===")
print(f" date: {_dt.date()}")
print(f" datetime: {_dt.datetime()}")
print("=== Text ===")
print(f" word: {_text.word()}")
print(f" sentence: {_text.sentence()}")
# ─────────────────────────────────────────────────────────────────────────────
# 2. Field — dot-notation shortcuts
# ─────────────────────────────────────────────────────────────────────────────
_ = Field(Locale.EN, seed=0)
def make_user_dict() -> dict:
"""Quick dict using Field dot paths."""
return {
"id": _("numeric.integer_number", start=1, end=99_999),
"email": _("person.email"),
"first_name": _("person.first_name"),
"last_name": _("person.last_name"),
"username": _("person.username"),
"role": _("choice", items=["user", "moderator", "admin"]),
"age": _("person.age", minimum=18, maximum=80),
"is_active": _("development.boolean"),
"city": _("address.city"),
"country": _("address.country_code"),
"created_at": _("datetime.datetime"),
}
# ─────────────────────────────────────────────────────────────────────────────
# 3. Fieldset — multiple unique values
# ─────────────────────────────────────────────────────────────────────────────
_fs = Fieldset(Locale.EN, i=20, seed=1)
def make_email_list(n: int = 20) -> list[str]:
"""Generate n unique emails with Fieldset."""
fs = Fieldset(Locale.EN, i=n, seed=99)
return list(fs("person.email"))
def make_ip_list(n: int) -> list[str]:
fs = Fieldset(Locale.EN, i=n)
return list(fs("internet.ip_v4"))
# ─────────────────────────────────────────────────────────────────────────────
# 4. Schema — structured batch factory
# ─────────────────────────────────────────────────────────────────────────────
_f = Field(Locale.EN)
def user_schema() -> Schema:
return Schema(
schema=lambda: {
"id": _f("numeric.integer_number", start=1, end=99_999),
"email": _f("person.email"),
"first_name": _f("person.first_name"),
"last_name": _f("person.last_name"),
"role": _f("choice", items=["user", "moderator", "admin"]),
"age": _f("person.age", minimum=18, maximum=80),
"is_active": _f("development.boolean"),
"address": {
"street": _f("address.street_name"),
"city": _f("address.city"),
"state": _f("address.state"),
"country": _f("address.country_code"),
},
}
)
def order_line_schema() -> Schema:
return Schema(
schema=lambda: {
"product_id": _f("cryptographic.uuid"),
"sku": _f("choice", items=["PROD-1001","BOOK-2005","ELEC-3010","HOME-4020"]),
"quantity": _f("numeric.integer_number", start=1, end=20),
"unit_price": str(round(_f("numeric.float_number", start=1.0, end=500.0, precision=2), 2)),
}
)
def order_schema() -> Schema:
return Schema(
schema=lambda: {
"id": _f("cryptographic.uuid"),
"user_id": _f("cryptographic.uuid"),
"status": _f("choice", items=["pending","paid","shipped","delivered"]),
"lines": order_line_schema().create(iterations=_f("numeric.integer_number", start=1, end=5)),
"notes": _f("text.sentence") if _f("development.boolean") else None,
}
)
# ─────────────────────────────────────────────────────────────────────────────
# 5. Custom provider
# ─────────────────────────────────────────────────────────────────────────────
class SkuProvider(BaseProvider):
"""Custom provider for product SKU generation."""
class Meta:
name = "sku_provider"
def product_sku(self, prefix: str = "PROD") -> str:
return f"{prefix}-{self.random.randint(1000, 9999)}"
def category(self) -> str:
return self.random.choice(["Electronics", "Clothing", "Books", "Home", "Sports"])
def ean13(self) -> str:
digits = [self.random.randint(0, 9) for _ in range(12)]
check = (10 - sum((3 if i % 2 else 1) * d for i, d in enumerate(digits)) % 10) % 10
return "".join(map(str, digits + [check]))
_generic = Generic(Locale.EN)
_generic.add_provider(SkuProvider)
def make_product_dict() -> dict:
return {
"id": _f("cryptographic.uuid"),
"sku": _generic.sku_provider.product_sku(),
"ean13": _generic.sku_provider.ean13(),
"name": _f("text.title"),
"price": str(round(_f("numeric.float_number", start=0.99, end=999.99, precision=2), 2)),
"stock": _f("numeric.integer_number", start=0, end=500),
"category": _generic.sku_provider.category(),
}
# ─────────────────────────────────────────────────────────────────────────────
# 6. Locale-aware data
# ─────────────────────────────────────────────────────────────────────────────
def localized_users(count: int = 3) -> dict[str, list[dict]]:
"""Generate user records in multiple locales."""
result = {}
for locale in [Locale.EN, Locale.DE, Locale.JA, Locale.FR]:
f = Field(locale)
schema = Schema(
schema=lambda f=f: {
"name": f("person.full_name"),
"email": f("person.email"),
"city": f("address.city"),
}
)
result[locale.value] = schema.create(iterations=count)
return result
# ─────────────────────────────────────────────────────────────────────────────
# 7. pytest fixtures
# ─────────────────────────────────────────────────────────────────────────────
@pytest.fixture
def fake_user() -> dict:
"""Single fake user dict for a test."""
return user_schema().create(iterations=1)[0]
@pytest.fixture
def fake_users() -> list[dict]:
"""10 fake users for a test."""
return user_schema().create(iterations=10)
@pytest.fixture
def fake_order() -> dict:
return order_schema().create(iterations=1)[0]
@pytest.fixture
def fake_product() -> dict:
return make_product_dict()
# ─────────────────────────────────────────────────────────────────────────────
# Demo
# ─────────────────────────────────────────────────────────────────────────────
if __name__ == "__main__":
demo_providers()
print("\n=== Schema ===")
users = user_schema().create(iterations=3)
for u in users:
print(f" {u['first_name']} {u['last_name']} <{u['email']}> role={u['role']}")
print("\n=== Order ===")
orders = order_schema().create(iterations=2)
for o in orders:
print(f" order {o['id'][:8]}... status={o['status']} lines={len(o['lines'])}")
print("\n=== Custom SKU Provider ===")
for _ in range(3):
p = make_product_dict()
print(f" {p['sku']} {p['category']} ${p['price']}")
print("\n=== Fieldset (10 unique emails) ===")
emails = make_email_list(5)
for e in emails:
print(f" {e}")
print("\n=== Localized ===")
locales = localized_users(2)
for locale, users in locales.items():
print(f" [{locale}] {users[0]['name']} / {users[0]['city']}")
For the Faker alternative — Faker is the most popular fake data library and has the largest provider ecosystem, while Mimesis generates data 5–20× faster than Faker because it reads pre-compiled locale data into memory once and serves values from it without parsing or formatting overhead — the Schema(schema=lambda: {...}).create(iterations=10_000) call generates 10,000 user dicts in under a second, making Mimesis the right choice for large-scale data seeding scripts, database load testing, or property-based test data pipelines where generation speed matters. For the factory_boy alternative — factory_boy creates full Python object instances (ORM models, dataclasses) with Factory.create() and Factory.build(), persists them to the database, and handles SubFactory relationships, while Mimesis generates plain dicts or primitives with zero ORM dependency — the two complement each other: use mimesis.Schema to generate raw field values and feed them into a factory_boy Factory via LazyAttribute(lambda o: Field(Locale.EN)("person.email")). The Claude Skills 360 bundle includes Mimesis skill sets covering Person/Address/Finance/Internet/Datetime providers, locale selection for 30+ languages, seed for reproducible data, Field dot-notation shortcuts, Fieldset for n unique values, Schema batch factory, custom BaseProvider extension, localized multi-language data, pytest fixture patterns, and Mimesis + factory_boy integration for ORM seeding. Start with the free tier to try high-performance fake data generation.