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

    @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.0.tar.gz (7.6 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.0-cp314-cp314-win_amd64.whl (340.1 kB view details)

Uploaded CPython 3.14Windows x86-64

cimba-0.6.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (419.5 kB view details)

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

cimba-0.6.0-cp314-cp314-macosx_11_0_arm64.whl (333.0 kB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

cimba-0.6.0-cp313-cp313-win_amd64.whl (334.2 kB view details)

Uploaded CPython 3.13Windows x86-64

cimba-0.6.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (418.3 kB view details)

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

cimba-0.6.0-cp313-cp313-macosx_11_0_arm64.whl (331.7 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: cimba-0.6.0.tar.gz
  • Upload date:
  • Size: 7.6 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.0.tar.gz
Algorithm Hash digest
SHA256 69d5825e1f048d0500c3e7f02e346507fffdd7bc39560e277250376ed667c6bb
MD5 5be955eeb0ea49f7c7cb800f483d03bc
BLAKE2b-256 2eec3da7132a0a15b030d8936592acbbd984aa9339555b9885a6f4e7fc726f3c

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: cimba-0.6.0-cp314-cp314-win_amd64.whl
  • Upload date:
  • Size: 340.1 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.0-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 71a19e65698a58bda5d48f5e1bae7f80b5b7ccf992894192b0ca124095329a61
MD5 05043c887fe9c0964c904bdcab1d9926
BLAKE2b-256 58f4a93cb087ceb321e2354be6d8acdd9f7fd7be46aface044ec54a4a6478bef

See more details on using hashes here.

Provenance

The following attestation bundles were made for cimba-0.6.0-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.0-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.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 1cd4843b91545d7c569053b274b3dbc2145901e619e1d4d8e8e1c7a0c3f4805d
MD5 0447398278725f0dc4d3305ee5c6cf39
BLAKE2b-256 cb15c13ee11201dac6c69e4e14ff7e784708c11bf033c2f1b483a2ea3f06bd2a

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for cimba-0.6.0-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ae208a892965c751a4a620d2260990c8d419a1478890564310043e40b5e20563
MD5 f69d116a1cb6ef01d3336a15f40d7f20
BLAKE2b-256 a0f44aa51fec333fa1ee0dc9ca4c3b9f3a69310bdf4f03d33e8f80441f3abf9e

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: cimba-0.6.0-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 334.2 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.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 8ba8b1c7fdad6e471127fd861b9f3a25c10bb958d15845800321adc5ac330887
MD5 0a85c7576488062748716fa1c1ab858e
BLAKE2b-256 678a8c2e3679f08764eb9619eece72af3a45b25cfd0ddd736aa6e186f6c0f85d

See more details on using hashes here.

Provenance

The following attestation bundles were made for cimba-0.6.0-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.0-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.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 79f14d0b5a58947e06dfd6376218493717762a898127f236b52c1d64045fc21a
MD5 d4d61aa92fadb529944400fd84f2239d
BLAKE2b-256 218df7c9cf017c0c0933bba32a5654d4a7a658e4ee26c35d6abf82db12ecf783

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for cimba-0.6.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b802a0706a4ddbd4a9735ebe376be4e9a6fd18c005bcf7ac411853187f94270b
MD5 61dd27d06f3ba8e0f6dc784207d4405f
BLAKE2b-256 862fe217784106c6fde29061567f0e246561ad3a780df00a656aed6fb6c5077f

See more details on using hashes here.

Provenance

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

This release

0.6.0 This release

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