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.4.1.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.4.1-cp314-cp314-win_amd64.whl (308.4 kB view details)

Uploaded CPython 3.14Windows x86-64

cimba-0.4.1-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (386.8 kB view details)

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

cimba-0.4.1-cp314-cp314-macosx_11_0_arm64.whl (298.7 kB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

cimba-0.4.1-cp313-cp313-win_amd64.whl (302.6 kB view details)

Uploaded CPython 3.13Windows x86-64

cimba-0.4.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (385.6 kB view details)

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

cimba-0.4.1-cp313-cp313-macosx_11_0_arm64.whl (297.8 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

File details

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

File metadata

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

File hashes

Hashes for cimba-0.4.1.tar.gz
Algorithm Hash digest
SHA256 d45f2e7da4c314ab34cb4c1c4d5aeee9bfe33e0160581bc4e8eb8406a585e691
MD5 1562853fc6a68b1be3c4992539c41ae3
BLAKE2b-256 3cc63488fbdf3c7881466b8231338408aa8d8b21e48cc8b8e5dd40a37e918f88

See more details on using hashes here.

Provenance

The following attestation bundles were made for cimba-0.4.1.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.4.1-cp314-cp314-win_amd64.whl.

File metadata

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

File hashes

Hashes for cimba-0.4.1-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 3ca2d55b5ebdbadfc883b45ac07b25fb0eb604e34d7834485988b98382a38c5b
MD5 d1ae2cffc6a9be11344dadd0035fdbea
BLAKE2b-256 ac009b097b693634139360abd2bb2e7bf6bf99936829e22a4fff27dad5c5f3fa

See more details on using hashes here.

Provenance

The following attestation bundles were made for cimba-0.4.1-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.4.1-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for cimba-0.4.1-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 25cc410059997325a9f329034c15e14586b6c5187c2e4dfce8db5eadfbe2da65
MD5 5cdfca03f74308c6540db4eaab20cfb7
BLAKE2b-256 3a86e46fd22d3ec30b1dea327fb21fa3e355ec09a50859efc6d0a0dea5477822

See more details on using hashes here.

Provenance

The following attestation bundles were made for cimba-0.4.1-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.4.1-cp314-cp314-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for cimba-0.4.1-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e53adf737c427d7ee6834f2dc5e722a31836dc34aee5c185636180f2813e4260
MD5 2c23081f514d18abd3aa228eacb39712
BLAKE2b-256 5655cc53c058c0befddd7f44b63696f7067b7beba8e325c8f6ed369906c2e0b3

See more details on using hashes here.

Provenance

The following attestation bundles were made for cimba-0.4.1-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.4.1-cp313-cp313-win_amd64.whl.

File metadata

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

File hashes

Hashes for cimba-0.4.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 d8d712f0e961d020e8841fb7a521341dbd7da60a6dd7caca9ec813425cac5c30
MD5 0001b4636ab43dfb86c9ccce4d9f77ef
BLAKE2b-256 0f632d0a39278fb86445c8fa7c0f8ae6ab64a436d747e630dfcab0248049bc8c

See more details on using hashes here.

Provenance

The following attestation bundles were made for cimba-0.4.1-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.4.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for cimba-0.4.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2fe462139752e329d486ffdde3631a2d10282473fbbede8df79321bec11995a4
MD5 35e940c0b55e27ef7c5d07c44f748c44
BLAKE2b-256 4e19519b7c40c9853fd0fa0a9af7fa8cf6b259f5a5e12e9b174482f756ca232d

See more details on using hashes here.

Provenance

The following attestation bundles were made for cimba-0.4.1-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.4.1-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for cimba-0.4.1-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 eb6a551a2fd789544b7f7d1b48f360cb88a03dc76b1361fe97b15ee3d9796e2f
MD5 9af8c8bb5e8305b29f02a29042df0246
BLAKE2b-256 a218d2e6e4ff670193943439254c7b30f171e7d51d0dd1a716ea8273a93ab0da

See more details on using hashes here.

Provenance

The following attestation bundles were made for cimba-0.4.1-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

0.5.9

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

This release

0.4.1 This release

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