Faker Events
Generate realistic, stateful event streams for development, demos, load tests, and data-pipeline validation—without copying production data.
Version 2 is a ground-up rewrite for Python 3.11+. It provides isolated generator state, deterministic runs, validated configuration, async delivery, virtual-time batches, cron schedules, and fast JSON serialization.
Install
pip install faker-events
Install only the stream adapters you need:
pip install "faker-events[kafka]"
pip install "faker-events[kinesis]"
Try it
The built-in example writes JSON Lines to stdout and progress to stderr:
faker-events run --profiles 10 --max-events 100 --seed 42
Persist generated entities across runs:
faker-events run --profiles 100 --profile-file profiles.json
Generate a historical batch without sleeping:
faker-events run \
--start 2026-01-01T00:00:00+00:00 \
--end 2026-01-02T00:00:00+00:00
Define a flow
Create checkout.py:
from typing import Any
from faker_events import (
Event,
EventContext,
EventGenerator,
GeneratorConfig,
Output,
Profile,
)
def build(
profiles: list[Profile],
output: Output,
*,
seed: int | None = None,
max_events: int | None = None,
) -> EventGenerator:
template: dict[str, Any] = {
"type": "",
"event_id": 0,
"event_time": "",
"customer_id": "",
"total": 0,
}
def created(context: EventContext, profile: Profile) -> dict[str, Any]:
return {
"type": "cart.created",
"event_id": context.id,
"event_time": context.time.isoformat(),
"customer_id": profile.id,
}
def checked_out(context: EventContext, profile: Profile) -> dict[str, Any]:
return {
"type": "cart.checked_out",
"event_id": context.id,
"event_time": context.time.isoformat(),
"total": 99,
}
cart = Event(template, created, rate=120)
checkout = Event(template, checked_out, rate=30)
cart >> checkout
return EventGenerator(
profiles,
cart,
output=output,
config=GeneratorConfig(seed=seed, max_events=max_events),
)
Run it:
faker-events run checkout.py --profiles 10
Transforms may update context.data directly, return a mapping to merge, or
return SKIP to suppress delivery. Data is stateful per event and profile.
Use event >> next_event for a sequence and event >> [a, b] to branch.
limit=0 repeats indefinitely.
Scheduled events
Cron events run alongside flow events:
snapshot = Event(
{"type": "account.snapshot"},
schedule="*/5 * * * *",
limit=0,
)
generator = EventGenerator(profiles, [cart, snapshot], output=output)
Schedules also work in virtual-time batches and are emitted in timestamp order.
Outputs
from faker_events import KafkaOutput, KinesisOutput
kafka = KafkaOutput("events", "localhost:9092")
kinesis = KinesisOutput("events", partition_key=lambda event: event["customer_id"])
Custom outputs implement three async methods:
class Output:
async def open(self) -> None: ...
async def send(self, event: dict) -> None: ...
async def close(self) -> None: ...
The included Kinesis adapter batches records. The Kafka adapter uses
confluent-kafka/librdkafka and verifies delivery.
Migration from 1.x
Version 2 intentionally removes global configuration:
- Pass profiles, first events, output, and config to
EventGenerator. - Await
run_live()orrun_batch()instead of callingstart(). - Use
rateinstead ofepm; variance is a fraction from0to1. - Use
scheduleinstead ofcron. - Use
ConsoleOutput,KafkaOutput, orKinesisOutputinstead ofStream. - Return
SKIPinstead of the string"skip". - User scripts expose a
build(...)function instead of mutating class state.
These changes allow multiple independent generators to run safely in one process.
Metadata
Release files for faker-events 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| faker_events-2.0.0.tar.gz | 17.0 kB | With provenance | Details for faker_events-2.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| faker_events-2.0.0-py3-none-any.whl | Python 3 | none | any | Details for faker_events-2.0.0-py3-none-any.whl |
Total release size: 33.5 kB
Release files / faker_events-2.0.0.tar.gz
| Download URL | faker_events-2.0.0.tar.gz |
|---|---|
| Size | 17.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b77ee026b6f9e7e710a1d692b38ef930d048048fcdac6db7cab0142aad87115b
|
|
BLAKE2b-256 checksum How to use checksums |
e6e6319595b776b52f3b36e5f5ce6bcbae1bce831e5180f928d616751b21cc2a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.
Transparency logRelease files / faker_events-2.0.0-py3-none-any.whl
| Download URL | faker_events-2.0.0-py3-none-any.whl |
|---|---|
| Size | 16.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cf681287ad1bc4ba6dffcded5d2ea077d91d495bcd8e14a4a096a3572da40f1d
|
|
BLAKE2b-256 checksum How to use checksums |
6be83a625a34582f20fa4fdd9212031755c9925ef9fee012b04ef7d946ef8b04
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.
Transparency logSecurity for faker-events 2.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for faker_events-2.0.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.