Claude Code for Mimesis: Fast Fake Data Generation in Python — Claude Skills 360 Blog
Blog / AI / Claude Code for Mimesis: Fast Fake Data Generation in Python
AI

Claude Code for Mimesis: Fast Fake Data Generation in Python

Published: January 17, 2028
Read time: 5 min read
By: Claude Skills 360

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.

Keep Reading

AI

Claude Code for email.contentmanager: Python Email Content Accessors

Read and write EmailMessage body content with Python's email.contentmanager module and Claude Code — email contentmanager ContentManager for the class that maps content types to get and set handler functions allowing EmailMessage to support get_content and set_content with type-specific behaviour, email contentmanager raw_data_manager for the ContentManager instance that handles raw bytes and str payloads without any conversion, email contentmanager content_manager for the standard ContentManager instance used by email.policy.default that intelligently handles text plain text html multipart and binary content types, email contentmanager get_content_text for the handler that returns the decoded text payload of a text-star message part as a str, email contentmanager get_content_binary for the handler that returns the raw decoded bytes payload of a non-text message part, email contentmanager get_data_manager for the get-handler lookup used by EmailMessage get_content to find the right reader function for the content type, email contentmanager set_content text for the handler that creates and sets a text part correctly choosing charset and transfer encoding, email contentmanager set_content bytes for the handler that creates and sets a binary part with base64 encoding and optional filename Content-Disposition, email contentmanager EmailMessage get_content for the method that reads the message body using the registered content manager handlers, email contentmanager EmailMessage set_content for the method that sets the message body and MIME headers in one call, email contentmanager EmailMessage make_alternative make_mixed make_related for the methods that convert a simple message into a multipart container, email contentmanager EmailMessage add_attachment for the method that attaches a file or bytes to a multipart message, and email contentmanager integration with email.message and email.policy and email.mime and io for building high-level email readers attachment extractors text body accessors HTML readers and policy-aware MIME construction pipelines.

5 min read Feb 12, 2029
AI

Claude Code for email.charset: Python Email Charset Encoding

Control header and body encoding for international email with Python's email.charset module and Claude Code — email charset Charset for the class that wraps a character set name with the encoding rules for header encoding and body encoding describing how to encode text for that charset in email messages, email charset Charset header_encoding for the attribute specifying whether headers using this charset should use QP quoted-printable encoding BASE64 encoding or no encoding, email charset Charset body_encoding for the attribute specifying the Content-Transfer-Encoding to use for message bodies in this charset such as QP or BASE64, email charset Charset output_codec for the attribute giving the Python codec name used to encode the string to bytes for the wire format, email charset Charset input_codec for the attribute giving the Python codec name used to decode incoming bytes to str, email charset Charset get_output_charset for returning the output charset name, email charset Charset header_encode for encoding a header string using the charset's header_encoding method, email charset Charset body_encode for encoding body content using the charset's body_encoding, email charset Charset convert for converting a string from the input_codec to the output_codec, email charset add_charset for registering a new charset with custom encoding rules in the global charset registry, email charset add_alias for adding an alias name that maps to an existing registered charset, email charset add_codec for registering a codec name mapping for use by the charset machinery, and email charset integration with email.message and email.mime and email.policy and email.encoders for building international email senders non-ASCII header encoders Content-Transfer-Encoding selectors charset-aware message constructors and MIME encoding pipelines.

5 min read Feb 11, 2029
AI

Claude Code for email.utils: Python Email Address and Header Utilities

Parse and format RFC 2822 email addresses and dates with Python's email.utils module and Claude Code — email utils parseaddr for splitting a display-name plus angle-bracket address string into a realname and email address tuple, email utils formataddr for combining a realname and address string into a properly quoted RFC 2822 address with angle brackets, email utils getaddresses for parsing a list of raw address header strings each potentially containing multiple comma-separated addresses into a list of realname address tuples, email utils parsedate for parsing an RFC 2822 date string into a nine-tuple compatible with time.mktime, email utils parsedate_tz for parsing an RFC 2822 date string into a ten-tuple that includes the UTC offset timezone in seconds, email utils parsedate_to_datetime for parsing an RFC 2822 date string into an aware datetime object with timezone, email utils formatdate for formatting a POSIX timestamp or the current time as an RFC 2822 date string with optional usegmt and localtime flags, email utils format_datetime for formatting a datetime object as an RFC 2822 date string, email utils make_msgid for generating a globally unique Message-ID string with optional idstring and domain components, email utils decode_rfc2231 for decoding an RFC 2231 encoded parameter value into a tuple of charset language and value, email utils encode_rfc2231 for encoding a string as an RFC 2231 encoded parameter value, email utils collapse_rfc2231_value for collapsing a decoded RFC 2231 tuple to a Unicode string, and email utils integration with email.message and email.headerregistry and datetime and time for building address parsers date formatters message-id generators header extractors and RFC-compliant email construction utilities.

5 min read Feb 10, 2029

Put these ideas into practice

Claude Skills 360 gives you production-ready skills for everything in this article — and 2,350+ more. Start free or go all-in.

Back to Blog

Get 360 skills free