simpy-rs
A high-performance, drop-in replacement for Python's SimPy discrete-event simulation library, backed by Rust and PyO3.
Why simpy-rs?
- 2.5x–3.7x faster drop-in simulations for standard Python generator processes, resources, containers, stores, and conditions — with zero changes to your model logic.
- 150x+ faster native Rust queueing runners (
simulate_mm1,simulate_mmc) that execute the entire event loop without GIL or Python generator overhead. - Zero-overhead
Monitorfor recording time-series observations, percentiles, and time-weighted averages in Rust. - Drop-in SimPy 4.x compatible:
Environment,RealtimeEnvironment,Event,Timeout,Process,AllOf,AnyOf,Condition,Resource,PriorityResource,PreemptiveResource,Container,Store,PriorityStore,FilterStore,Interrupt,simpy_rs.util, and PEP 561 type stubs (py.typed). - Pre-built
abi3wheels for Linux (manylinux), macOS, and Windows (Python 3.9–3.15) — no Rust compiler needed topip install.
10-Second Quickstart
pip install simpy-rs
import simpy_rs as simpy
def car(env: simpy.Environment):
while True:
print(f"Start parking at {env.now}")
yield env.timeout(5)
print(f"Start driving at {env.now}")
yield env.timeout(2)
env = simpy.Environment()
env.process(car(env))
env.run(until=15)
Drop-In Migration
Replace your import and keep your existing SimPy model unchanged:
# Before
# import simpy
# After
import simpy_rs as simpy
env = simpy.Environment()
bcs = simpy.Resource(env, capacity=2)
def charge_car(env, name, bcs, driving_time, charge_duration):
yield env.timeout(driving_time)
with bcs.request() as req:
yield req
yield env.timeout(charge_duration)
for i in range(4):
env.process(charge_car(env, f"Car {i}", bcs, i * 2, 5))
env.run()
Native Rust Extensions (Zero-GIL Mode)
For high-throughput queueing sweeps and zero-overhead metric collection:
from simpy_rs import Monitor, simulate_mm1, simulate_mmc
# Run a 50,000 time-unit M/M/1 simulation 100% in Rust (~2 ms)
stats = simulate_mm1(arrival_rate=0.8, service_rate=1.0, until=50_000.0, seed=42)
print(stats["mean_wait"], stats["server_utilization"])
# Multi-server M/M/c
stats_c = simulate_mmc(arrival_rate=2.4, service_rate=1.0, servers=3, until=50_000.0, seed=7)
# Zero-overhead statistics & time-weighted average monitor
mon = Monitor()
mon.record(0.0, time=0.0)
mon.record(3.0, time=2.0)
mon.record(1.0, time=5.0)
print(mon.mean, mon.percentile(95.0), mon.time_average(until=10.0))
API Compatibility
| Category | Supported Symbols |
|---|---|
| Core | Environment, RealtimeEnvironment, Infinity, URGENT, NORMAL, PENDING |
| Events & Processes | Event, Timeout, Process, Initialize, Interruption, Condition, AllOf, AnyOf, ConditionValue, & / | operators |
| Resources | Resource, Request, Release, PriorityResource, PriorityRequest, PreemptiveResource, Preempted |
| Containers & Stores | Container, ContainerPut, ContainerGet, Store, StorePut, StoreGet, PriorityStore, PriorityItem, FilterStore, FilterStoreGet |
| Exceptions & Utils | SimPyException, Interrupt, EmptySchedule, StopSimulation, start_delayed, subscribe_at |
| Rust Extensions | Monitor, simulate_mm1, simulate_mmc |
Benchmarks
Measured on Windows (CPython 3.12.11, simpy==4.1.2, built with maturin develop --release) via python benchmarks/bench.py:
| Workload | Python SimPy |
simpy-rs |
Speedup |
|---|---|---|---|
PriorityResource (30k req/rel) |
0.1694 s | 0.0456 s | 3.72x |
Resource (50k req/rel) |
0.2346 s | 0.0638 s | 3.67x |
Store (50k put/get) |
0.1580 s | 0.0486 s | 3.25x |
AnyOf conditions (30k) |
0.1111 s | 0.0354 s | 3.14x |
Container (50k put/get) |
0.1650 s | 0.0547 s | 3.02x |
M/M/1 drop-in (T=50k) |
0.3404 s | 0.1178 s | 2.89x |
| Timeouts (200k events) | 0.1995 s | 0.0797 s | 2.50x |
M/M/1 native (simulate_mm1, T=50k) |
0.3404 s | 0.0022 s | 153.5x |
Contributing
Contributions are welcome! See CONTRIBUTING.md for local maturin develop setup instructions and PR guidelines.
License
Dual-licensed under either of:
at your option.
Metadata
Release files for simpy-rs 0.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 |
|---|---|---|---|---|
| simpy_rs-0.1.0.tar.gz | 44.9 kB | With provenance | Details for simpy_rs-0.1.0.tar.gz |
Built distributions (wheels)
| File | Actions Reset | |||
|---|---|---|---|---|
| simpy_rs-0.1.0-cp39-abi3-win_amd64.whl | CPython 3.9 | abi3 | Windows x86-64 | Details for simpy_rs-0.1.0-cp39-abi3-win_amd64.whl |
| simpy_rs-0.1.0-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl | CPython 3.9 | abi3 | Linux glibc 2.17+ x86-64 | Details for simpy_rs-0.1.0-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
| simpy_rs-0.1.0-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl | CPython 3.9 | abi3 | Linux glibc 2.17+ ARM64 | Details for simpy_rs-0.1.0-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl |
| simpy_rs-0.1.0-cp39-abi3-macosx_11_0_arm64.whl | CPython 3.9 | abi3 | macOS 11.0+ ARM64 | Details for simpy_rs-0.1.0-cp39-abi3-macosx_11_0_arm64.whl |
| simpy_rs-0.1.0-cp39-abi3-macosx_10_12_x86_64.whl | CPython 3.9 | abi3 | macOS 10.12+ x86-64 | Details for simpy_rs-0.1.0-cp39-abi3-macosx_10_12_x86_64.whl |
Total release size: 2.1 MB
Release files / simpy_rs-0.1.0.tar.gz
| Download URL | simpy_rs-0.1.0.tar.gz |
|---|---|
| Size | 44.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d6b08825c892ed834bc77939f6a46c561babd08b0b38b49030841ce5c66f0c93
|
|
BLAKE2b-256 checksum How to use checksums |
7b2c4b099010491d916d3f03d51cb1bdfa4f1167ed1db8179212aeeabbb71a57
|
| 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 26, 2026.
Transparency logRelease files / simpy_rs-0.1.0-cp39-abi3-win_amd64.whl
| Download URL | simpy_rs-0.1.0-cp39-abi3-win_amd64.whl |
|---|---|
| Size | 347.7 kB |
| Tags | CPython 3.9 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
56d5f62d075b948406434881aba598c24eac1e917bc7e65d8f16231621fb87c9
|
|
BLAKE2b-256 checksum How to use checksums |
ab7b1084d38a7f3b516f426d5e502298a35edefd862a9ad6790600722afcdb34
|
| 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 26, 2026.
Transparency logRelease files / simpy_rs-0.1.0-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
| Download URL | simpy_rs-0.1.0-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
|---|---|
| Size | 456.3 kB |
| Tags | CPython 3.9 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
257a95ce5ea9bffec586180798e5c658a386503747e6648d4fd7bac58ac3a4b7
|
|
BLAKE2b-256 checksum How to use checksums |
eca6c32095d348ca2abf413499c48b880aab3f3426157cf0ba10e0d844d03686
|
| 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 26, 2026.
Transparency logRelease files / simpy_rs-0.1.0-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
| Download URL | simpy_rs-0.1.0-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl |
|---|---|
| Size | 452.9 kB |
| Tags | CPython 3.9 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
8538206c7648bc6c34448fb8b9973670e41a96daf4204e2244018e4420d8da18
|
|
BLAKE2b-256 checksum How to use checksums |
e26cbeebc815c41c94e67a90c312932b7a8a7396abf93c7ecb8251332e3d67db
|
| 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 26, 2026.
Transparency logRelease files / simpy_rs-0.1.0-cp39-abi3-macosx_11_0_arm64.whl
| Download URL | simpy_rs-0.1.0-cp39-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 416.4 kB |
| Tags | CPython 3.9 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
b8295b62aacfcd953d36f173671a310484d1ff62c486d1a622b90e46fa8e1938
|
|
BLAKE2b-256 checksum How to use checksums |
5dd6e6c05c946b0a416413e681a88a6e91ae976dcc6065d4a1b6065197e297e4
|
| 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 26, 2026.
Transparency logRelease files / simpy_rs-0.1.0-cp39-abi3-macosx_10_12_x86_64.whl
| Download URL | simpy_rs-0.1.0-cp39-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 419.7 kB |
| Tags | CPython 3.9 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
8d97f67964e219f2fdadfc76250ff11fdd7d15e46201bc3765120c3cb9a30a17
|
|
BLAKE2b-256 checksum How to use checksums |
d48509eaf6c0af0dd5e4ae8e38339c5df50de12c3af097f4cbb16cdbc9857535
|
| 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 26, 2026.
Transparency logSecurity for simpy-rs 0.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.
Full provenance
All 6 files in this release have been uploaded with provenance metadata.
Attestation for simpy_rs-0.1.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 26, 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.