Skip to main content

Cimba logo

Cimba Python

Fast discrete event simulation for Python

Cimba Python is a Python interface to Cimba, a multithreaded discrete event simulation engine written in C and assembly.

It is designed for Python simulation models that need more speed than pure Python event scheduling can usually provide. In the included M/M/1 benchmark, Cimba Python runs about 27-33x faster than SimPy after its one-time Numba compile, while keeping model code in Python.

On an AMD Ryzen 7 9700X under WSL Ubuntu 24.04, averaged over 10 runs:

Benchmark SimPy Cimba Python Cimba C
Single core, single trial 2.612 s 0.096 s 0.083 s
Multicore, 100 trials 36.807 s 1.131 s 0.970 s

The benchmark data and charts are in benchmark/AMD_Ryzen_7_9700X_WSL.ods.

Install

pip install cimba

or with uv:

uv add cimba

Python 3.13 or newer is required. The Linux, Windows, and macOS wheels embed the Cimba C library, so you do not need to install Cimba separately. Native macOS wheels are available for Apple Silicon. Numba does not currently publish the required llvmlite wheels for Intel Macs.

What is it?

Cimba Python gives Python models access to Cimba's native simulation engine through the cimba.sim API: processes, event queues, buffers, queues, stores, priority queues, resources, resource pools, conditions, timers, events, logging helpers, and experiment tables. Random distributions live in cimba.random.

What does the code look like?

import cimba.sim as sim
import cimba.random as random


class MM1(sim.Model):
    utilization: sim.Param
    avg_queue_length: sim.Output
    queue: sim.Queue


model = MM1("MM1")


@model.process
def arrival(env: MM1):
    while True:
        sim.hold(random.exponential(1.0 / env.utilization))
        env.queue.put(1)


@model.process
def service(env: MM1):
    while True:
        env.queue.get(1)
        sim.hold(random.exponential(1.0))


@model.collect
def collect_stats(env: MM1):
    env.avg_queue_length = env.queue.mean_level()


exp = model.experiment(
    utilization=0.75,
    replications=100,
    duration=1000.0,
    warmup=100.0,
    seed=123,
)
exp.run()

print(exp["avg_queue_length"].mean())

More examples, tutorials, background notes, and the API reference are in the documentation.

Development

From a fresh clone:

uv sync
uv run pytest

License

Cimba Python is licensed under Apache-2.0. See LICENSE and NOTICE.

The bundled Cimba C library is also Apache-2.0 licensed. See subprojects/cimba/NOTICE for attribution.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cimba-0.5.9.tar.gz (7.5 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

cimba-0.5.9-cp314-cp314-win_amd64.whl (335.3 kB view details)

Uploaded CPython 3.14Windows x86-64

cimba-0.5.9-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (413.6 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

cimba-0.5.9-cp314-cp314-macosx_11_0_arm64.whl (325.6 kB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

cimba-0.5.9-cp313-cp313-win_amd64.whl (329.6 kB view details)

Uploaded CPython 3.13Windows x86-64

cimba-0.5.9-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (412.4 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

cimba-0.5.9-cp313-cp313-macosx_11_0_arm64.whl (324.6 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

File details

Details for the file cimba-0.5.9.tar.gz.

File metadata

  • Download URL: cimba-0.5.9.tar.gz
  • Upload date:
  • Size: 7.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for cimba-0.5.9.tar.gz
Algorithm Hash digest
SHA256 5f6c62a99ce9ed4d57211358b60e3909326f858c5acb5fed39e60b849200e310
MD5 e44d7c288e932635982fc6653c26cd0c
BLAKE2b-256 2931a51e6ebbb27e664736ec837798b0f714e72650f2a3b7947a230cb6f2947d

See more details on using hashes here.

Provenance

The following attestation bundles were made for cimba-0.5.9.tar.gz:

Publisher: release.yml on FBarrca/cimba_python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cimba-0.5.9-cp314-cp314-win_amd64.whl.

File metadata

  • Download URL: cimba-0.5.9-cp314-cp314-win_amd64.whl
  • Upload date:
  • Size: 335.3 kB
  • Tags: CPython 3.14, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for cimba-0.5.9-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 cb042f1b445e1530ff68c36ac00b6a7aa188e2ae422173064d4295b4c533cb80
MD5 7eb4a7739ed7dd92c2bbe84c0579080a
BLAKE2b-256 df3959e50bfb8de62553ac92798d602e8b18d7b86c72778f3a1c8bec585a673c

See more details on using hashes here.

Provenance

The following attestation bundles were made for cimba-0.5.9-cp314-cp314-win_amd64.whl:

Publisher: release.yml on FBarrca/cimba_python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cimba-0.5.9-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for cimba-0.5.9-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 775e63013aaee964cf655e6153559a37ed424429d10e7c43cc95ae75525de212
MD5 61d9941f2b0bd4c599204028c547e367
BLAKE2b-256 a147a43c0f1c4117fa140a219f344b4a276053a52f20bae312d2b42babf7df1b

See more details on using hashes here.

Provenance

The following attestation bundles were made for cimba-0.5.9-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl:

Publisher: release.yml on FBarrca/cimba_python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cimba-0.5.9-cp314-cp314-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for cimba-0.5.9-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a2235446ddb241bfdc97aa04774cf3b96269018b470b7b9dffa1a5934c06e5ce
MD5 609f196906c96dbdbf69466b8620a61f
BLAKE2b-256 bc1f0e41d5fc9bc2b39da178ca553143855ba50cc0bfae4f9222c9a854fb2da8

See more details on using hashes here.

Provenance

The following attestation bundles were made for cimba-0.5.9-cp314-cp314-macosx_11_0_arm64.whl:

Publisher: release.yml on FBarrca/cimba_python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cimba-0.5.9-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: cimba-0.5.9-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 329.6 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for cimba-0.5.9-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 aaca8231f24b7d832ae058a373de780cf077f63dd37e58a8ee74ccaecf198a79
MD5 1a3d44b9f620ce85328b52e77ff9bd79
BLAKE2b-256 e1278e2488ab6dc08d97e3f8a7bfe8ae2909a70826a94de9e9f3561977e3c125

See more details on using hashes here.

Provenance

The following attestation bundles were made for cimba-0.5.9-cp313-cp313-win_amd64.whl:

Publisher: release.yml on FBarrca/cimba_python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cimba-0.5.9-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for cimba-0.5.9-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 65ecef45265b931f9c96a9ddd38144e5520277358e5c3430131361cd5860b239
MD5 3ddc66c700697dc23e4ffb015e3bca71
BLAKE2b-256 0cbfd380b0442e54276a4c8790ec4e169e0dd5db25be96588e8e00d2504199a7

See more details on using hashes here.

Provenance

The following attestation bundles were made for cimba-0.5.9-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl:

Publisher: release.yml on FBarrca/cimba_python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cimba-0.5.9-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for cimba-0.5.9-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 04259d33e8b8b74ebefa8756d390efc5689d4cf74b47808f6effb78c745c2d3c
MD5 d46eec53828e8d6dc513eb25da7943bf
BLAKE2b-256 e8aefcfd4c1a8cea460462df5772004bc9d1625038dc224089f4f6cef2c1b8f1

See more details on using hashes here.

Provenance

The following attestation bundles were made for cimba-0.5.9-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: release.yml on FBarrca/cimba_python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.6.1

7 files

0.6.0

7 files

This release

0.5.9 This release

7 files

0.5.8

7 files

0.5.7

7 files

0.5.6

7 files

0.5.5

7 files

0.5.4

7 files

0.5.2

7 files

0.5.1

7 files

0.5.0

7 files

0.4.1

7 files

0.4.0

3 files

0.3.0

3 files

0.2.1

5 files

0.1.0

2 files

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