Skip to main content

Generate contextually coherent mock data — people, companies, and transactions that actually make sense together.

Project description

fabrikate 🏭

Contextually coherent mock data generation for Python.

Unlike random fake data generators, fabrikate ensures everything makes sense together. A person generated in Tokyo gets a Japanese name, address, phone format, and bank. A company's employees, products, and transactions are internally consistent.

Installation

pip install fabrikate

Quick Start

from fabrikate import World

# Create a world set in Japan
world = World(locale="ja_JP", seed=42)

# Generate a company with employees
company = world.company(industry="tech")
employees = company.hire(10)

# Generate products for that company
products = world.products(5, company=company)

# Generate transactions
transactions = world.transactions(100, receiver=company)

# Export everything as JSON
print(world.to_json())

Why fabrikate?

Faker generates random data — a person might have an American name, a Japanese phone number, and a German address. fabrikate keeps everything coherent within a cultural and business context.

Feature Faker fabrikate
Random names
Locale-aware names
Coherent address + phone + bank
Company → employee inheritance
Industry-appropriate products
Linked transactions
Full dataset export
Seed reproducibility

Supported Locales

  • en_US — United States (English)
  • ja_JP — Japan (Japanese)
  • de_DE — Germany (German)
  • pt_BR — Brazil (Portuguese)

More coming soon. PRs welcome!

Core Concepts

World

A World is your mock data universe. Everything generated within a world shares context and can reference each other.

world = World(locale="de_DE", seed=123, industry="finance")

Context

The Context controls what locale, industry, and time period data is generated for. You usually don't create these directly — World handles it.

# Child contexts inherit but can override
child_ctx = world.ctx.child(locale="en_US")

Generators

Each entity type has a generator that respects the context:

person = world.person()              # Coherent person
company = world.company()            # Coherent company
product = world.product(company=co)  # Product tied to company
tx = world.transaction(sender=p)     # Transaction from person

Company → Employee Inheritance

When you hire employees through a company, they inherit its context:

company = world.company(industry="tech")  # German tech company
team = company.hire(5)                     # 5 German employees

for person in team:
    print(person.full_name)    # German names
    print(person.phone)        # +49 format
    print(person.bank)         # German bank
    print(person.company_id)   # Links to company

Full Dataset Export

Dump everything to JSON for test fixtures:

data = world.dataset()
# {
#   "metadata": {"locale": "de_DE", "seed": 123, ...},
#   "people": [...],
#   "companies": [...],
#   "products": [...],
#   "transactions": [...]
# }

API Reference

World(locale, seed, year, industry)

  • locale (str): Locale code, default "en_US"
  • seed (int|None): Random seed for reproducibility
  • year (int): Reference year, default 2025
  • industry (str|None): Default industry context

world.person(**overrides) → Person

world.people(count, **overrides) → list[Person]

world.company(**overrides) → Company

world.companies(count, **overrides) → list[Company]

world.product(company?, **overrides) → Product

world.products(count, company?, **overrides) → list[Product]

world.transaction(sender?, receiver?, product?, **overrides) → Transaction

world.transactions(count, sender?, receiver?, **overrides) → list[Transaction]

world.dataset() → dict

world.to_json(indent=2) → str

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fabrikate-0.2.0.tar.gz (37.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fabrikate-0.2.0-py3-none-any.whl (40.6 kB view details)

Uploaded Python 3

File details

Details for the file fabrikate-0.2.0.tar.gz.

File metadata

  • Download URL: fabrikate-0.2.0.tar.gz
  • Upload date:
  • Size: 37.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for fabrikate-0.2.0.tar.gz
Algorithm Hash digest
SHA256 d5f5efd3eeb49a4d3dc70e0a9a131249a794495cff60b4783ad3d6c70446055e
MD5 7b84fb34fdb6a10ef50fdc6b55a5bae9
BLAKE2b-256 030c9c159fa10aa086b3fb40148de58f7c4d7c02f5d2c18ea68dee1fc9681371

See more details on using hashes here.

File details

Details for the file fabrikate-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: fabrikate-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 40.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for fabrikate-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5dc575bdec20688b466c75d3d93d58be28d1a4dbb979c521eafc5cadff8a2b65
MD5 a0689ee7711e29f2ea4089f6c1b83281
BLAKE2b-256 308abf8ebb4bd0db1c6921716f1f24e19cfdcf9dc7b6d094e2bc8de360567090

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page