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 24.5–31.3x 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.856 s 0.117 s 0.078 s
Multicore, 100 trials 38.723 s 1.238 s 0.800 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 our fork of Cimba 3.0.0-RC2, 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.

The bindings manage the strict native object lifecycle required since Cimba 3.0.0 RC1: initialize before use, terminate after use, and destroy allocated objects. This includes temporary statistics objects and spawned processes. Abandoned trials also release the bindings' spawned-process registry before the worker runs another trial. Python models do not need manual lifecycle calls.

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

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

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

    @sim.collect
    def collect_stats(self: "MM1"):
        self.avg_queue_length = self.queue.mean_level()


model = MM1("MM1")

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

print(exp.results.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.6.1.tar.gz (18.1 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.6.1-cp314-cp314-win_amd64.whl (350.5 kB view details)

Uploaded CPython 3.14Windows x86-64

cimba-0.6.1-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (440.1 kB view details)

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

cimba-0.6.1-cp314-cp314-macosx_11_0_arm64.whl (346.2 kB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

cimba-0.6.1-cp313-cp313-win_amd64.whl (344.7 kB view details)

Uploaded CPython 3.13Windows x86-64

cimba-0.6.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (439.1 kB view details)

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

cimba-0.6.1-cp313-cp313-macosx_11_0_arm64.whl (345.0 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

File details

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

File metadata

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

File hashes

Hashes for cimba-0.6.1.tar.gz
Algorithm Hash digest
SHA256 a9ec1e4b08b56027ca0b6a54a9389414982dde57f6bb49c6492a6678f640976d
MD5 b51094adfda4985ea5e91de2cab255cb
BLAKE2b-256 ea15d4ba6b1bd99b566aeba07eb01a400841f2a6a607054af25ee885e5b780d2

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: cimba-0.6.1-cp314-cp314-win_amd64.whl
  • Upload date:
  • Size: 350.5 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.6.1-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 372d2fe67849a094e06a92bd9a77fe019086ed59efa89bba5f36b6ff3c3d412f
MD5 a45933c713fc62160277ec14aec1acce
BLAKE2b-256 d7ec8adc1611b3af9c4e11baa5d22362670fdafd3c2601120bd246ba233c4384

See more details on using hashes here.

Provenance

The following attestation bundles were made for cimba-0.6.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.6.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.6.1-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 820e08da4e75d1af862663c4d1a81792feac1f4577fcc7ef4536de049ae95571
MD5 414f7567245703de2f393a1b2a7d8e2d
BLAKE2b-256 7bf9b19c48ebce33e99eec7f765ef66bc1c166e2a06df468ee5164541265554d

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for cimba-0.6.1-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3c31b6b2f686d144ec1b133f28e21e51fa4ef4c19aab217302aeca0776e53227
MD5 b1db210b23257bbc68109b4a8f4ce067
BLAKE2b-256 0bea4bbea533a79f8c3a94cb963374c953f81cf55282b5665ca961a2fbf11934

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: cimba-0.6.1-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 344.7 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.6.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 2027db3b414e719f6e3467137e8be779bc8e293263138b1ad41fec2c5a9a9559
MD5 2c3686089186d5e42b80d7f93f55f81b
BLAKE2b-256 fae3f63cc9590a087b8d0e8d7752b6a5bd61657898144aacb347f17f4729fbc4

See more details on using hashes here.

Provenance

The following attestation bundles were made for cimba-0.6.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.6.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.6.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2309ae6c50c514bf8bab4e07616ffd4560c67ce1a411506a7998832bd6c44643
MD5 6555468abfd68ae7d8a285f8951c464d
BLAKE2b-256 ae9f209cb61fabd7d8d00544399db0cccfce515e14c887ff9b6f973bef088bc8

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for cimba-0.6.1-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5afb5a55876b66317ead0bf699142d33e0639315aa4ffbfa0df25f623cc3208c
MD5 8dc4720b8686698cba47036b4a4dadda
BLAKE2b-256 d93b367291e642fe92730a3745dc58baf46aef766c5d15462418d3364026c7c2

See more details on using hashes here.

Provenance

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

This release

0.6.1 This release

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

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