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

Uploaded CPython 3.14Windows x86-64

cimba-0.5.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (395.3 kB view details)

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

cimba-0.5.0-cp314-cp314-macosx_11_0_arm64.whl (307.3 kB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

cimba-0.5.0-cp313-cp313-win_amd64.whl (311.2 kB view details)

Uploaded CPython 3.13Windows x86-64

cimba-0.5.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (394.1 kB view details)

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

cimba-0.5.0-cp313-cp313-macosx_11_0_arm64.whl (306.3 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: cimba-0.5.0.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.0.tar.gz
Algorithm Hash digest
SHA256 94f6692cec869f39c08ed682e33646ace1ed087bcf4f46655c250c24f3a7eb1f
MD5 652c711196324bd9188195be342f6f92
BLAKE2b-256 2bcc872a68fe7c324c90faa6777dfb8c45f21fb0ad841c8adcafc6118f2f5271

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: cimba-0.5.0-cp314-cp314-win_amd64.whl
  • Upload date:
  • Size: 317.0 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.0-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 508e04b2707b7656d45ffd3f1b51922124b378be07792dd405e59c7eae5c966d
MD5 15883b4383c8adb64decb41e6d867fa3
BLAKE2b-256 b0ae8246f8caef9f8035d575e9716f1c7a5fe69e9da01676c8cc3196ee4b9688

See more details on using hashes here.

Provenance

The following attestation bundles were made for cimba-0.5.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.5.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.5.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 d45450bcbd1a6db6aeef1e94c07501b2b1575e7bcb60bb7e95886f10cdd405f5
MD5 9d6f17c48b118265b168bf0542ef1823
BLAKE2b-256 7f882987e44f613473f35680680e29bf42ba2040c06f2de1d36171b00625db02

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for cimba-0.5.0-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f357182eced7f65b0736eba440caa772008c09e2ef220eb357b50963cf7d1488
MD5 4da755f4646092af771f7e64abc11deb
BLAKE2b-256 af4d4872847523b3d6435b8acac87dcf3e3f3ce92f3ee3339932d7256c8e54e5

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: cimba-0.5.0-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 311.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.5.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 7b41bc005adce6aa91897238e7c092df75e91ce00a7fa583de1520a58bcfca80
MD5 17321dd31c1ac75f6e79161dcdabdbf9
BLAKE2b-256 9452c6f54b2dbcfaaad22301427627ef63fbd4c572c8355903b5d43f7a7e0701

See more details on using hashes here.

Provenance

The following attestation bundles were made for cimba-0.5.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.5.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.5.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f5c4cd90a44ad2aee79727bc5d968cee09ed8e977451e5e77bd48e07b8bd3afb
MD5 65bd6d27b3a0f2b7136186966fb092ba
BLAKE2b-256 7a52b6e9564c295a9e7a0a4097d75acb41743a050b4dd7c72059460571e05d65

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for cimba-0.5.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9dfad333545660a2a7b4a4858ea412cac130654f989d442aeab2452e37a9558f
MD5 6164d2d5f6fc4d3181badacecde460e4
BLAKE2b-256 f1ddf11097c5383b14723761eb532427bec7f13afd621acb1a2a3cc06aae7d58

See more details on using hashes here.

Provenance

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

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

This release

0.5.0 This release

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