Skip to main content

desflow

CI Pipeline Documentation PyPI version Python Versions License: MIT

Realistic event streams from a simulation you can steer while it runs.

dynamic-des is now desflow. The package was renamed in 0.20.0: install desflow, import desflow and run desflow. Code that imports dynamic_des and scripts that run ddes keep working with a warning until a later release, and the Changelog says what to change.

desflow architecture

Most test data generators write random rows. desflow writes the events of a working process: orders queue for packers, packing slows down at busy times, and a backlog builds when arrivals outpace capacity. The data has the cause and effect of a real system, because it comes from a SimPy discrete-event simulation.

Change an arrival rate or a capacity while the simulation runs, from Kafka, Redis, PostgreSQL or a timed scenario, and the pipeline downstream sees the effect. One run can write a week of history at full speed, then keep streaming in real time.

Events and telemetry go to Kafka, Redis, PostgreSQL, Parquet or JSONL files (on local disk or S3-compatible storage), or Apache Iceberg tables. A model is a YAML file, a Python builder, or SimPy code.

Used for: testing streaming pipelines with data that behaves like production, training data for ML models that predict delays or load, data for testing AI agents, digital twins that follow live data, and demos and workshops.

The control dashboard changes simulation parameters while a run is going, and the telemetry reacts without a restart:

Live parameter updates from the control dashboard

Key Features

  • Real time or full speed: DynamicRealtimeEnvironment runs SimPy in step with the system clock, or unpaced, and reports how far the simulation lags behind real time.
  • Live parameters: arrival rates, service times and capacities change mid-run through registry paths such as Shop.arrival.orders.rate. A resource grows at once, and shrinks only as busy units are released, so no work in progress is lost.
  • Several sinks per run: each sink added with add_egress has its own when filter, batch_size and flush_interval, so one run can feed a stream and a data lake together.
  • Backfill then go live: one run generates backdated history at full speed, then switches to real time at go_live_at.
  • Serialisation: JSON through orjson by default, Avro through the Confluent or AWS Glue Schema Registry for chosen topics, and Pydantic models published as they are.
  • Kafka security: extra keyword arguments go to the Kafka client, so SASL, mTLS, OAuth and AWS IAM clusters work.

Installation

Install the core library with uv or pip.

With uv:

# The desflow command
uv tool install desflow

# Or the library, in a uv project
uv add desflow

With pip:

pip install desflow

The connectors are optional extras, for example uv add "desflow[kafka,parquet]" or pip install "desflow[kafka,parquet]":

Extra Adds
kafka Kafka ingress and egress
confluent Avro with the Confluent Schema Registry (includes kafka)
glue Avro with the AWS Glue Schema Registry (includes kafka)
redis Redis ingress and egress
postgres PostgreSQL ingress and egress
parquet Parquet and JSONL files on local disk or S3-compatible storage
iceberg Apache Iceberg tables through a REST catalog
all Every extra above

Run an Example

The local example needs no container. With desflow installed as above, desflow examples get downloads the example at the release you installed, into a folder of its own, and desflow run runs it:

desflow examples get local --api yaml
cd local/yaml
desflow run local.yaml

For the builder or low-level version, use --api builder or --api low-level; the Installation page shows all three in tabs. desflow examples lists the other examples, and each example page gives the same steps, including the odctl service it needs.

Three Ways to Write a Simulation

A simulation can be a YAML blueprint, a script using the builder API (SimulationContext), or a script using the low-level API (DynamicRealtimeEnvironment and SimPy processes). All three build the same parameters and run on the same environment, so the registry paths, the records and the connectors are the same whichever way you choose.

This blueprint is a small online shop: one packer, an order about every 2 seconds and 1.5 seconds of packing, with every record printed to the terminal:

# The First Simulation tutorial: the shop as a blueprint.
# Run it with: desflow run first_shop.yaml
simulation:
  sim_id: Shop
  factor: 1.0  # 1 simulated second takes 1 real second
  random_seed: 42  # the same arrival times on every run

resources:
  packers: {current_cap: 1, max_cap: 1}

services:
  # Every order takes exactly 1.5 seconds to pack
  packing: {dist: constant, value: 1.5}

arrivals:
  # One order every 2 seconds on average; each arrival spawns pack_order
  orders: {dist: exponential, rate: 0.5, spawn: pack_order}

tasks:
  pack_order:
    service: packing
    resource: packers
    # The value of the finished event
    payload: {event_type: order_packed}

egress:
  - type: Console

run:
  until: 20

First Simulation builds this shop step by step, with the YAML, builder and low-level code side by side at each step, and the comparison of the three ways explains which to choose.

Roadmap

Version 0.21.0 adds distributions, stores, flows, statistics and the first pages of the shop tutorial in the Learn section. The next releases add replications, the record format that 1.0 keeps stable, desflow explain and the rest of the tutorial, followed by a simulation server with tools for AI agents. The roadmap page shows them in order, with what is in progress.

Learn More

The documentation is at jaehyeon.me/desflow. Good places to start:

Blog posts about desflow and the projects built on it are tagged desflow on jaehyeon.me.

Projects that use desflow:

  • benchtop: hands-on data engineering and machine learning demos that run locally, most of them with data produced by desflow.
  • agentic-analytics-system: conversational analytics over an Iceberg lakehouse, with the lakehouse data generated by desflow.
  • oml-digital-twin-hotrolling: a streaming digital twin of a steel hot rolling mill, with online machine learning on Kafka and Flink.

License

MIT

Metadata

Release files for desflow 0.21.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for desflow 0.21.0
File Size Uploaded Provenance
desflow-0.21.0.tar.gz 111.5 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for desflow 0.21.0
File Interpreter ABI Platform
desflow-0.21.0-py3-none-any.whl Python 3 none any Details

Total release size: 243.0 kB

Release files / desflow-0.21.0.tar.gz

Download URL desflow-0.21.0.tar.gz
Size 111.5 kB
Tags Source
SHA-256 checksum
How to use checksums
83a1914390435cb5c7f786512d81118237822b1f03162c42e7f505444362608c
BLAKE2b-256 checksum
How to use checksums
850ae380c9b111f2d7842281b3518438f5fe4f2bc1b1446cea391b359e22ab0a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 16, 2026.

Transparency log

Release files / desflow-0.21.0-py3-none-any.whl

Download URL desflow-0.21.0-py3-none-any.whl
Size 131.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3b6ee1e9949351bf2721e4e3d9fe0459d1e733ec4f486a73b617fdf4ce70e4c7
BLAKE2b-256 checksum
How to use checksums
b7175fb253577c4cb7934f673b0b14c379410ad8f18f3c3d070676af76bd8c91
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 16, 2026.

Transparency log

Security for desflow 0.21.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

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for desflow-0.21.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 Oct 16, 2026.

Transparency log

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page