Skip to main content

High-density spatial simulation bindings for libdense_sim

Project description

dense-sim Python binding

This CPython extension wraps the canonical libdense_sim C ABI. Spatial indexing, subscriptions, kinetic scheduling, and fanout grouping remain inside the native library.

Install a prebuilt wheel

python3.13 -m pip install dist/*cp313*.whl
python3.14 -m pip install dist/*cp314*.whl

The wheels target Linux x86-64 and statically contain libdense_sim.

Build from the included binding source

From the repository root:

make -C bindings/python PYTHON=python3.14 test
make -C bindings/python PYTHON=python3.14 wheel

The build uses include/dense/dense_sim.h and lib/linux-x86_64/libdense_sim.a by default. Override them with:

DENSE_SIM_INCLUDE_DIR
DENSE_SIM_LIB_DIR
DENSE_SIM_STATIC_LIBRARY

Scalar use

from dense_sim import CHANNEL_POSITION, World

world = World(cell_size=8, chunk_size=16)
world.begin_tick(1)
world.spawn(193, 100, 100, 1)
world.move(193, 101, 100)
world.mark_dirty(193, CHANNEL_POSITION)
world.end_tick()

for group in world.fanout_view():
    for delta in group.entries:
        print(delta.entity_id, delta.operation_name)

Batch use

from array import array

entity_ids = array("Q", [193, 228, 482])
xs = array("i", [101, 88, 52])
ys = array("i", [100, 90, 61])

world.move_many(entity_ids, xs, ys)
world.mark_dirty_many(entity_ids, CHANNEL_POSITION)

Batch calls are sequential rather than transactional. Borrowed fanout objects are invalidated by the next successful World.begin_tick() or World.close().

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

dense_sim-0.1.0rc1-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (94.4 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.17+ x86-64

dense_sim-0.1.0rc1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (94.0 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

dense_sim-0.1.0rc1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (94.0 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

dense_sim-0.1.0rc1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (93.5 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

File details

Details for the file dense_sim-0.1.0rc1-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for dense_sim-0.1.0rc1-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 c8cfeea342e5dc93684c98a54ac96e52457a332328dad0af980c66d7dddc273c
MD5 25127ab906d4cb5b0243d358b8184780
BLAKE2b-256 591cfa0bd044a13aae80ab6e649a0fe1f8446864ccd7dca1a991ec24f10bdb5b

See more details on using hashes here.

File details

Details for the file dense_sim-0.1.0rc1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for dense_sim-0.1.0rc1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 6148576b79ce9ec52f4c729b591fc1ea180240972956f3617e6ce31af4a504c5
MD5 506109650e01c79e0616a1b080e9bc43
BLAKE2b-256 41ef8bb2e50be005960ffc927e1e5e426b3ab451ddad6983bedc3932ca13fe9c

See more details on using hashes here.

File details

Details for the file dense_sim-0.1.0rc1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for dense_sim-0.1.0rc1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 9868d876cd1fc35ff76c5d71b937edcc0280eec841741111fc6921bf6121cb3a
MD5 1ee188d52007a4fb026c7dc2eaa22791
BLAKE2b-256 da693ced5f9b3d08560ea54152de9c8e93996af5380257296c7f466b69b81bc9

See more details on using hashes here.

File details

Details for the file dense_sim-0.1.0rc1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for dense_sim-0.1.0rc1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 99f4233831c84254974bb5f54ddae0db538f9b78485da1be1fe9dda46dd25691
MD5 c299bf57c395ec6b2e03c5007b18f1e5
BLAKE2b-256 4812b848558e3f4046e7493ff8273adbc44ca0924ea6709294415c925d21a105

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page