Mimesis is a robust fake data generator for Python that produces realistic fake data across 35 different locales with high performance and multilingual support.
npx @tessl/cli install tessl/pypi-mimesis@18.0.0Mimesis is a robust fake data generator for Python that produces realistic fake data across 35 different locales. It serves as a comprehensive testing and development library offering high-performance data generation with multilingual support, extensive customization through custom providers and field handlers, and schema-based generators for complex data structures.
pip install mimesisimport mimesisCommon provider imports:
from mimesis import Person, Address, Internet, Datetime, FinanceUsing the unified Generic provider:
from mimesis import Generic
from mimesis.locales import LocaleSchema-based generation:
from mimesis import Field, Schemafrom mimesis import Person, Address, Internet
from mimesis.locales import Locale
# Create providers with specific locale
person = Person(Locale.EN)
address = Address(Locale.EN)
internet = Internet()
# Generate individual data
name = person.full_name() # "John Smith"
email = person.email() # "example@domain.com"
city = address.city() # "New York"
# Using Generic provider for unified access
from mimesis import Generic
generic = Generic(Locale.EN)
print(generic.person.full_name()) # "Jane Doe"
print(generic.address.country()) # "United States"
print(generic.datetime.date()) # datetime.date(2023, 5, 15)Schema-based bulk generation:
from mimesis import Field, Schema
from mimesis.locales import Locale
# Define schema
field = Field(Locale.EN)
schema = Schema(schema=lambda: {
'id': field('increment'),
'name': field('person.full_name'),
'email': field('person.email'),
'birthdate': field('person.birthdate', min_year=1980, max_year=2005),
'address': field('address.address'),
})
# Generate multiple records
data = schema.create(iterations=100)Mimesis is built around several key components:
This architecture enables developers to use mimesis flexibly, from simple single-value generation to complex multi-field data structures, while maintaining consistent APIs across all data types.
Foundation classes and the unified Generic provider that enable consistent data generation patterns across all data types.
class BaseProvider:
def reseed(self, seed: int = None) -> None: ...
def validate_enum(self, item, enum) -> Any: ...
class BaseDataProvider(BaseProvider):
def get_current_locale(self) -> str: ...
def override_locale(self, locale): ...
class Generic:
def __init__(self, locale: Locale = Locale.DEFAULT): ...
def reseed(self, seed: int = None) -> None: ...
def add_provider(self, cls, **kwargs) -> None: ...Generate realistic personal information including names, demographics, contact details, and identification data with proper localization support.
class Person(BaseDataProvider):
def full_name(self, gender: Gender = None) -> str: ...
def first_name(self, gender: Gender = None) -> str: ...
def surname(self, gender: Gender = None) -> str: ...
def email(self) -> str: ...
def phone_number(self, mask: str = "", placeholder: str = "#") -> str: ...
def birthdate(self, min_year: int = 1980, max_year: int = 2023) -> datetime.date: ...Generate geographical and address information including streets, cities, countries, coordinates, and postal codes with locale-appropriate formatting.
class Address(BaseDataProvider):
def address(self) -> str: ...
def street_name(self) -> str: ...
def city(self) -> str: ...
def state(self, abbr: bool = False) -> str: ...
def country(self) -> str: ...
def postal_code(self) -> str: ...
def coordinates(self, dms: bool = False) -> dict: ...Generate internet-related data including IP addresses, domains, URLs, user agents, and network protocols with proper formatting and validation.
class Internet(BaseProvider):
def url(self) -> str: ...
def ip_v4(self) -> str: ...
def ip_v6(self) -> str: ...
def mac_address(self) -> str: ...
def user_agent(self) -> str: ...Generate dates, times, timestamps, and time-related data with flexible date ranges, formatting options, and timezone support.
class Datetime(BaseDataProvider):
def date(self, start: int = 2000, end: int = 2023) -> datetime.date: ...
def time(self) -> datetime.time: ...
def datetime(self, start: int = 2000, end: int = 2023) -> datetime.datetime: ...
def formatted_date(self, fmt: str = "", **kwargs) -> str: ...
def timezone(self, region: TimezoneRegion = None) -> str: ...Generate financial data including currencies, prices, company information, stock data, and banking details with proper formatting.
class Finance(BaseDataProvider):
def company(self) -> str: ...
def currency_iso_code(self, allow_random: bool = False) -> str: ...
def price(self, minimum: float = 500, maximum: float = 1500) -> float: ...
def bank(self) -> str: ...
def stock_ticker(self) -> str: ...Generate textual content including words, sentences, paragraphs, colors, and various text-based data with locale-appropriate content.
class Text(BaseDataProvider):
def word(self) -> str: ...
def words(self, quantity: int = 5) -> list[str]: ...
def sentence(self) -> str: ...
def text(self, quantity: int = 5) -> str: ...
def title(self) -> str: ...
def color(self) -> str: ...
def hex_color(self, safe: bool = False) -> str: ...Additional providers for specific domains including development data, scientific data, file information, hardware specs, transportation data, cryptographic utilities, and payment information.
class Development(BaseProvider):
def programming_language(self) -> str: ...
def software_license(self) -> str: ...
def version(self) -> str: ...
class Science(BaseProvider):
def dna_sequence(self, length: int = 10) -> str: ...
def rna_sequence(self, length: int = 10) -> str: ...
class Hardware(BaseProvider):
def cpu(self) -> str: ...
def resolution(self) -> str: ...
def manufacturer(self) -> str: ...
class Cryptographic(BaseProvider):
def uuid(self) -> str: ...
def hash(self, algorithm: Algorithm = Algorithm.MD5) -> str: ...
class Payment(BaseDataProvider):
def credit_card_number(self, card_type: CardType = None) -> str: ...
def paypal(self) -> str: ...
class Transport(BaseDataProvider):
def car(self) -> str: ...
def airplane(self) -> str: ...
class Food(BaseDataProvider):
def vegetable(self) -> str: ...
def fruit(self) -> str: ...
class File(BaseProvider):
def extension(self) -> str: ...
def file_name(self) -> str: ...
class Numeric(BaseProvider):
def integer_number(self, start: int = -1000, end: int = 1000) -> int: ...
def decimal_number(self, start: float = -1000.0, end: float = 1000.0) -> Decimal: ...
class Choice(BaseProvider):
def choice(self, *args, **kwargs) -> Any: ...High-level tools for generating structured data with export capabilities, enabling bulk data creation for testing and development.
class Field:
def __init__(self, locale: Locale = Locale.DEFAULT): ...
def __call__(self, *args, **kwargs) -> Any: ...
def register_handler(self, field_name: str, field_handler) -> None: ...
class Schema:
def __init__(self, schema: callable, iterations: int = 1): ...
def create(self) -> list[dict]: ...
def to_csv(self, file_path: str, **kwargs) -> None: ...
def to_json(self, file_path: str, **kwargs) -> None: ...Enumerations, locale management, utility functions, and plugin integrations that support and configure the data generation system.
class Locale(Enum):
EN = "en"
EN_US = "en-us"
DE = "de"
FR = "fr"
# ... 35+ locales
def luhn_checksum(num: str) -> str: ...
def romanize(locale: Locale) -> callable: ...from enum import Enum
from typing import Union, Optional, Dict, List, Any, Callable
from datetime import date, time, datetime
from decimal import Decimal
# Core types
Seed = Optional[int]
JSON = Dict[str, Any]
Matrix = List[List[Any]]
# Configuration enums
class Gender(Enum):
MALE = "male"
FEMALE = "female"
class TitleType(Enum):
TYPICAL = "typical"
ACADEMIC = "academic"
class CountryCode(Enum):
A2 = "a2" # ISO 3166-1 alpha-2
A3 = "a3" # ISO 3166-1 alpha-3
NUMERIC = "numeric"
class TimezoneRegion(Enum):
AFRICA = "africa"
AMERICA = "america"
ANTARCTICA = "antarctica"
ARCTIC = "arctic"
ASIA = "asia"
ATLANTIC = "atlantic"
AUSTRALIA = "australia"
EUROPE = "europe"
INDIAN = "indian"
PACIFIC = "pacific"
class Algorithm(Enum):
MD5 = "md5"
SHA1 = "sha1"
SHA224 = "sha224"
SHA256 = "sha256"
SHA384 = "sha384"
SHA512 = "sha512"
class CardType(Enum):
VISA = "visa"
MASTERCARD = "mastercard"
AMERICAN_EXPRESS = "american_express"
DISCOVER = "discover"