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.1.tar.gz (37.6 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.1-py3-none-any.whl (40.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fabrikate-0.2.1.tar.gz
  • Upload date:
  • Size: 37.6 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.1.tar.gz
Algorithm Hash digest
SHA256 f74f81cdc2e6a1a263199679ec3afcab106be159b5cf493ce08ec469bfddd9f2
MD5 4f3bbe697e6ed4f237972f3c446af431
BLAKE2b-256 0094c59c0841622fb72e46d76597ec338c30767d2b5ca88e09a8e14db292dd8f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabrikate-0.2.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3d2d56f65c4baaebd05b52de2f2457108e570b099af1b3d7249d0e03db5ae321
MD5 e6c9513fdfb70d826acba7a420a2832b
BLAKE2b-256 f904ce3afc1363b90bf7078a13343f1f505c6fddd99e1c21f6a1b39c3551187d

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