Skip to main content

Python bindings for the Murk simulation framework

Project description

murk (Python)

PyPI Docs CI

Python bindings for the Murk simulation engine.

murk gives you:

  • Native Rust performance via PyO3 bindings
  • Gymnasium-compatible environment adapters
  • Batched stepping for high-throughput RL training
  • Typed Python API surface (py.typed + .pyi stubs)

Install

python -m pip install murk

Requirements:

  • Python 3.12+

Quick Start (Gymnasium)

MurkEnv is designed for subclassing. Override hook methods to map actions, reward, and episode boundaries for your task.

import numpy as np
from murk import (
    Config,
    EdgeBehavior,
    FieldMutability,
    MurkEnv,
    ObsEntry,
    PropagatorDef,
    WriteMode,
)


class SimpleEnv(MurkEnv):
    def __init__(self, seed: int = 42):
        cfg = Config()
        cfg.set_space_line1d(10, EdgeBehavior.Absorb)
        cfg.add_field("value", mutability=FieldMutability.PerTick)
        cfg.set_dt(0.1)
        cfg.set_seed(seed)

        def step_fn(reads, reads_prev, writes, tick_id, dt, cell_count):
            writes[0][:] = float(tick_id)

        PropagatorDef("inc", step_fn, writes=[(0, WriteMode.Full)]).register(cfg)
        super().__init__(cfg, [ObsEntry(0)], n_actions=2, seed=seed)
        self._tick_limit = 100

    def _compute_reward(self, obs, info):
        return -float(np.sum(obs))

    def _check_terminated(self, obs, info):
        return False

    def _check_truncated(self, obs, info):
        return info["tick_id"] >= self._tick_limit


env = SimpleEnv()
obs, info = env.reset(seed=0)
obs, reward, terminated, truncated, info = env.step(0)
env.close()

High-Throughput Vectorized RL

BatchedVecEnv steps all worlds in one Rust call (single GIL release), which removes per-world FFI overhead.

import numpy as np
from murk import BatchedVecEnv, Config, EdgeBehavior, FieldMutability, ObsEntry


def make_config(i: int) -> Config:
    cfg = Config()
    cfg.set_space_line1d(64, EdgeBehavior.Absorb)
    cfg.add_field("energy", mutability=FieldMutability.PerTick)
    cfg.set_seed(i)
    return cfg


env = BatchedVecEnv(
    config_factory=make_config,
    obs_entries=[ObsEntry(0)],
    num_envs=32,
)
obs, infos = env.reset(seed=0)
obs, rewards, terminateds, truncateds, infos = env.step(np.zeros(32))
env.close()

Low-Level API

If you want direct control of stepping and commands, use World and ObsPlan from murk._murk / murk.

Core types:

  • Config, World, Command
  • ObsEntry, ObsPlan
  • StepMetrics (timings, queue/realtime counters, sparse reuse counters)

Package Links

Project details


Download files

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

Source Distribution

murk-0.2.0.tar.gz (415.8 kB view details)

Uploaded Source

Built Distributions

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

murk-0.2.0-cp312-abi3-win_amd64.whl (592.3 kB view details)

Uploaded CPython 3.12+Windows x86-64

murk-0.2.0-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (803.7 kB view details)

Uploaded CPython 3.12+manylinux: glibc 2.17+ x86-64

murk-0.2.0-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (779.9 kB view details)

Uploaded CPython 3.12+manylinux: glibc 2.17+ ARM64

murk-0.2.0-cp312-abi3-macosx_11_0_arm64.whl (714.0 kB view details)

Uploaded CPython 3.12+macOS 11.0+ ARM64

murk-0.2.0-cp312-abi3-macosx_10_12_x86_64.whl (732.1 kB view details)

Uploaded CPython 3.12+macOS 10.12+ x86-64

File details

Details for the file murk-0.2.0.tar.gz.

File metadata

  • Download URL: murk-0.2.0.tar.gz
  • Upload date:
  • Size: 415.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for murk-0.2.0.tar.gz
Algorithm Hash digest
SHA256 5dc820ac16142643accd8ba7294a6bdc9270aef953c4a9114b0e6e622e49c2c3
MD5 3377178312897133d95c218b8aa981eb
BLAKE2b-256 dce775ccfff977b380cf225ed96fa26b4264b45140434f2854da2e86aa5c4406

See more details on using hashes here.

Provenance

The following attestation bundles were made for murk-0.2.0.tar.gz:

Publisher: release.yml on tachyon-beep/murk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file murk-0.2.0-cp312-abi3-win_amd64.whl.

File metadata

  • Download URL: murk-0.2.0-cp312-abi3-win_amd64.whl
  • Upload date:
  • Size: 592.3 kB
  • Tags: CPython 3.12+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for murk-0.2.0-cp312-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 20d97038058c533615c4624c5bf81be5a2acc678e658ae4e04c44cfef12b6e0a
MD5 adf34f8a848b448923967497c4d99c88
BLAKE2b-256 93258d44c576e9714c2ea245c267a1be1c1fca2ebc5263a9ff24f87e4b1ab23f

See more details on using hashes here.

Provenance

The following attestation bundles were made for murk-0.2.0-cp312-abi3-win_amd64.whl:

Publisher: release.yml on tachyon-beep/murk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file murk-0.2.0-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for murk-0.2.0-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5e2fb3161b93e9ed2c3ea7b7d3ae6bf57cd5b2da0bad44f026416065b1dbb9f0
MD5 a489aaec9cd72da8465b1c53aff806db
BLAKE2b-256 a1bf870e52e53e174f9b8827c1c73be0ede5d7cd77ea20b99c16e86535f420ff

See more details on using hashes here.

Provenance

The following attestation bundles were made for murk-0.2.0-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on tachyon-beep/murk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file murk-0.2.0-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for murk-0.2.0-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 8ba5b24cf1216a36c1da710bbe16646140d92a280f092dee8c5319884f7ca618
MD5 d7605ddef747c534a98130379ae953d0
BLAKE2b-256 1f82f978ae4b4cf5b4957a8dee30e663f9553d489d30a27d7bf3f02d428af5c5

See more details on using hashes here.

Provenance

The following attestation bundles were made for murk-0.2.0-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on tachyon-beep/murk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file murk-0.2.0-cp312-abi3-macosx_11_0_arm64.whl.

File metadata

  • Download URL: murk-0.2.0-cp312-abi3-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 714.0 kB
  • Tags: CPython 3.12+, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for murk-0.2.0-cp312-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f442eaa5918113dfa6e26ad93343553bc9e61482f0a9dc97aa85755ed1148791
MD5 a06c0121dbfb2023ee0d9f210fbfac39
BLAKE2b-256 a0271f3375ff97276e8d288cc46b645f2b496e6bafd64715680c74f0df7510ed

See more details on using hashes here.

Provenance

The following attestation bundles were made for murk-0.2.0-cp312-abi3-macosx_11_0_arm64.whl:

Publisher: release.yml on tachyon-beep/murk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file murk-0.2.0-cp312-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for murk-0.2.0-cp312-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 3bca520e552b898195aea5549db5d4d2e7b3317b2eb20f292076c376433bac94
MD5 c86a90556a879d2aa68606d045d42fa9
BLAKE2b-256 2a37023a5d10640020ca0204f3e18f3c20665918cc8528b5e75b071d845574ae

See more details on using hashes here.

Provenance

The following attestation bundles were made for murk-0.2.0-cp312-abi3-macosx_10_12_x86_64.whl:

Publisher: release.yml on tachyon-beep/murk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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