Deterministic Scenario Engine
Generate test scenarios, not just test records.
Deterministic Scenario Engine (DSE) creates reproducible, state-consistent
business histories and deterministic scenario suites with ground truth for
testing. The published distribution is deterministic-scenario-engine 2.0.0.
Phase 3 evidence-interchange capabilities are implemented on main and the
current source release candidate reports distribution version 2.1.0, while 2.1.0
is not published. Its deterministic compatibility version remains
ENGINE_VERSION == "1.0.0", and its DSL version remains integer 1.
Why it exists
Fake-data libraries and random record generators produce values; fixtures often describe isolated records. Scenario Engine executes histories: each committed step sees a consistent state, produces traceable state changes and artifacts, and advances an explicit logical clock. The same scenario and execution context can be replayed byte-for-byte, while invariants, controlled faults, and an oracle make expected behavior explicit.
Core capabilities
- DSL 1 parsing, compilation, and deterministic execution
- addressed randomness and logical IDs that do not depend on a shared stream
- current state plus append-only committed history and artifacts
- whole-step atomicity
- explicit external inputs, resource DAG resolution, validators, and constraints
- subflows, ordered branches, and bounded repeat
- invariants, deterministic fault injection, provenance, and oracle evaluation
- canonical result bytes and a
ReproducibilityManifestfor exact replay - an explicit, versioned plugin boundary and a reference ecommerce plugin pack
- a JSON-file adapter
- optional pytest, SQLAlchemy Core, Hypothesis, and Schemathesis integrations
- secure, explicit local-file composition with namespaced modules
- ordered Cartesian matrices with stable case IDs and original indexes
- immutable ordered batch plans and worker-independent results
- structured, redacted inspect/explain evidence and typed RFC 6901 semantic diff
- twelve-command
scenarioCLI for local and CI workflows, including bounded local evidence export, verification, and lossless migration - explicit immutable Domain Pack registries and pure Oracle Assertions
- canonical evidence bundles, ordered JSON/JSONL export, compatibility reports, explicit adapters, closed lossless migrations, and fixture-directory export
Core execution does not require a database, network service, plugin, or property testing framework. See security assumptions and non-goals. Neither Phase 2 nor Phase 3 adds hidden discovery, network, randomness, wall-clock, or ambient environment semantics. The historical Phase 2 contract is frozen in the Phase 2 public contract; the additive evidence surface is frozen in the Phase 3 public contract.
Installation
From a source checkout, use a virtual environment and install the checkout:
python3 -m venv /tmp/scenario-engine-docs-venv
/tmp/scenario-engine-docs-venv/bin/python -m pip install .
Install only the named optional integrations you need:
/tmp/scenario-engine-docs-venv/bin/python -m pip install '.[pytest]'
/tmp/scenario-engine-docs-venv/bin/python -m pip install '.[sqlalchemy]'
/tmp/scenario-engine-docs-venv/bin/python -m pip install '.[hypothesis]'
/tmp/scenario-engine-docs-venv/bin/python -m pip install '.[schemathesis]'
The published distribution is deterministic-scenario-engine 2.0.0. Install the package
with pip install deterministic-scenario-engine, or select an optional integration
with a command such as pip install 'deterministic-scenario-engine[pytest]'.
Minimal quickstart
The public cart scenario is an executable DSL 1 document. Run it from the repository root:
from pathlib import Path
from scenario_engine import (
compile_document,
parse_yaml,
replay_scenario,
run_scenario,
)
yaml_text = Path("examples/cart.yaml").read_text(encoding="utf-8")
document = parse_yaml(yaml_text)
scenario = compile_document(document)
result = run_scenario(scenario, root_seed="quickstart", run_index=0)
print(result.final_state["checkout_complete"])
print(result.trace())
stable_bytes = result.to_json_bytes()
manifest = result.manifest
replayed = replay_scenario(yaml_text, manifest)
assert replayed.to_json_bytes() == stable_bytes
ScenarioResult.final_state is the supported state-reading property; the stable
normalized result contains the same data under its state field.
Determinism contract
Generation derives from semantic ExecutionAddress values, not consumption of
a mutable global random stream. Exact replay requires the same canonical
scenario, explicit inputs, algorithms/plugins, and recorded execution context.
Unsupported cross-version replay fails explicitly. See the determinism model,
reproducibility guide, and normative
compatibility contract.
Documentation
- Quickstart
- DSL 1 reference
- Determinism model
- Reproducibility and replay
- Testing, faults, and oracle
- Plugins
- SQLAlchemy adapter
- Hypothesis integration
- Schemathesis integration
- Public Python API
- Security assumptions and non-goals
- Compatibility contract
- Phase 2 public contract, CLI, and hard bounds
- Phase 3 public contract and evidence interchange
Status
Distribution release identity and deterministic engine compatibility are
separate contracts. Version 2.0.0 has been published to PyPI and as a GitHub
Release. This source tree reports the unpublished 2.1.0 release candidate;
generated core manifests retain ENGINE_VERSION 1.0.0 and DSL 1. No 2.1.0 tag,
GitHub Release, or package-index publication exists. The project is licensed
under Apache-2.0.
Metadata
Release files for deterministic-scenario-engine 2.1.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 |
|---|---|---|---|---|
| deterministic_scenario_engine-2.1.0.tar.gz | 280.7 kB | Without provenance | Details for deterministic_scenario_engine-2.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| deterministic_scenario_engine-2.1.0-py3-none-any.whl | Python 3 | none | any | Details for deterministic_scenario_engine-2.1.0-py3-none-any.whl |
Total release size: 445.2 kB
Release files / deterministic_scenario_engine-2.1.0.tar.gz
| Download URL | deterministic_scenario_engine-2.1.0.tar.gz |
|---|---|
| Size | 280.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
17145e6bc4de271b0dc052b4b025dae179e0876792d5a6fdfcc0cd7516b4deb8
|
|
BLAKE2b-256 checksum How to use checksums |
2de1a35644e9cc61ff789a594655d12ff79fb56dc9f4d717189dcaf282a29591
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.7
|
Release files / deterministic_scenario_engine-2.1.0-py3-none-any.whl
| Download URL | deterministic_scenario_engine-2.1.0-py3-none-any.whl |
|---|---|
| Size | 164.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
685000958db72bebe3160bc0679920fac48167177016e6fff23797ff5c903a4b
|
|
BLAKE2b-256 checksum How to use checksums |
4da840c27f66b8aac22ef7c8e03438ced8f2d46432bb61b6ddbb6a5b65578bad
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.7
|
Security for deterministic-scenario-engine 2.1.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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.