Skip to main content

Deterministic Weiss Schwarz simulator with a Rust core and Python bindings.

Project description

Weiss Schwarz Simulator

CI Wheels Benchmarks Security PyPI Rustdoc Docs Hub

Deterministic Weiss Schwarz simulation for RL and engine research.

What you get

  • Rust engine (weiss_core) with deterministic advance-until-decision stepping
  • PyO3 bindings (weiss_py) and Python API (python/weiss_sim) for batched training/eval loops
  • Stable observation/action contracts (OBS_LEN=378, ACTION_SPACE_SIZE=527, SPEC_HASH=8590000130)
  • Replay and fingerprint surfaces for drift detection and reproducibility

5-minute start

Option A: install from PyPI

python -m pip install -U weiss-sim numpy

Option B: local build from source

python -m pip install -U maturin numpy
maturin develop --release --manifest-path weiss_py/Cargo.toml

Minimal high-level loop

import numpy as np
import weiss_sim

sim = weiss_sim.train(num_envs=32, seed=0)
reset = sim.reset()
actions = np.full((32,), weiss_sim.PASS_ACTION_ID, dtype=np.uint32)
step = sim.step(actions)

Minimal low-level loop

import numpy as np
import weiss_sim

legal_deck = (list(range(1, 14)) * 4)[:50]

pool = weiss_sim.EnvPool.new_rl_train(
    32,
    deck_lists=[legal_deck, legal_deck],
    deck_ids=[1, 2],
    seed=0,
)
buf = weiss_sim.EnvPoolBuffers(pool)
out = buf.reset()
actions = np.full(pool.envs_len, weiss_sim.PASS_ACTION_ID, dtype=np.uint32)
out = buf.step(actions)

Architecture at a glance

flowchart LR
  A["Python API\npython/weiss_sim"] --> B["PyO3 bindings\nweiss_py"]
  B --> C["Engine core\nweiss_core"]
  C --> D["Deterministic outputs\nobs/masks-or-ids/reward/status"]
  C --> E["Replay + fingerprint\nrepro & drift debugging"]

Documentation map

Start in docs/README.md.

Recommended paths:

Repository layout

  • weiss_core/: Rust engine and deterministic rule runtime
  • weiss_py/: PyO3 extension layer
  • python/weiss_sim/: high-level and low-level Python interfaces
  • python/tests/: Python API/contract tests
  • scripts/: CI parity, coverage, perf, and docs checks
  • docs/: user + contributor documentation hub

Local quality checks

Full local CI parity:

scripts/run_local_ci_parity.sh

Skip benchmark gate during iteration:

SKIP_BENCHMARKS=1 scripts/run_local_ci_parity.sh

Docs-only checks:

python scripts/check_docs_links.py
python scripts/check_docs_constants.py

Benchmark snapshot (main)

Last updated: 2026-02-18 10:58 UTC

Benchmark Time
rust/advance_until_decision 51573 ns/iter
rust/step_batch_64 15566 ns/iter
rust/reset_batch_256 893236 ns/iter
rust/step_batch_fast_256_priority_off 74777 ns/iter
rust/step_batch_fast_256_priority_on 68299 ns/iter
rust/legal_actions 13 ns/iter
rust/legal_actions_forced 12 ns/iter
rust/on_reverse_decision_frequency_on 1186 ns/iter
rust/on_reverse_decision_frequency_off 1237 ns/iter
rust/observation_encode 178 ns/iter
rust/observation_encode_forced 188 ns/iter
rust/mask_construction 397 ns/iter

Long-form benchmark docs: docs/performance_benchmarks.md

Compatibility policy

Contract constants are explicit compatibility boundaries:

  • OBS_ENCODING_VERSION=2
  • ACTION_ENCODING_VERSION=1
  • POLICY_VERSION=2
  • REPLAY_SCHEMA_VERSION=2
  • WSDB_SCHEMA_VERSION=2

If encoding/layout semantics change, update code + docs in the same PR:

  1. constants/encode implementation
  2. docs/rl_contract.md checksum table
  3. docs/encodings_changelog.md

License

MIT OR Apache-2.0

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

weiss_sim-0.4.0.tar.gz (658.8 kB view details)

Uploaded Source

Built Distributions

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

weiss_sim-0.4.0-cp312-cp312-win_amd64.whl (1.3 MB view details)

Uploaded CPython 3.12Windows x86-64

weiss_sim-0.4.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

weiss_sim-0.4.0-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (2.4 MB view details)

Uploaded CPython 3.12macOS 10.12+ universal2 (ARM64, x86-64)macOS 10.12+ x86-64macOS 11.0+ ARM64

weiss_sim-0.4.0-cp311-cp311-win_amd64.whl (1.3 MB view details)

Uploaded CPython 3.11Windows x86-64

weiss_sim-0.4.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

weiss_sim-0.4.0-cp311-cp311-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (2.4 MB view details)

Uploaded CPython 3.11macOS 10.12+ universal2 (ARM64, x86-64)macOS 10.12+ x86-64macOS 11.0+ ARM64

weiss_sim-0.4.0-cp310-cp310-win_amd64.whl (1.3 MB view details)

Uploaded CPython 3.10Windows x86-64

weiss_sim-0.4.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

weiss_sim-0.4.0-cp310-cp310-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (2.4 MB view details)

Uploaded CPython 3.10macOS 10.12+ universal2 (ARM64, x86-64)macOS 10.12+ x86-64macOS 11.0+ ARM64

File details

Details for the file weiss_sim-0.4.0.tar.gz.

File metadata

  • Download URL: weiss_sim-0.4.0.tar.gz
  • Upload date:
  • Size: 658.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for weiss_sim-0.4.0.tar.gz
Algorithm Hash digest
SHA256 d9b6b3b8412b37d9c3a60368206666ec3f7f6a6d9d53b0cede918d04479340c7
MD5 2601378769e71d1ec9890869d8092741
BLAKE2b-256 3a3e29b01267ac3b86f867946f32b1b1560f600ae3fac35d2919bada6b8c57e7

See more details on using hashes here.

Provenance

The following attestation bundles were made for weiss_sim-0.4.0.tar.gz:

Publisher: wheels.yml on victorwp288/weiss-schwarz-simulator

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

File details

Details for the file weiss_sim-0.4.0-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: weiss_sim-0.4.0-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 1.3 MB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for weiss_sim-0.4.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 347da14395422d17c44bf6c4571e4da3eb828b2203940ad070083ad29e4c2741
MD5 29b0107bcf6f2c926eba557d52a35cdf
BLAKE2b-256 bd50e8ec5f4589b9959d402c89165961451c68a929c656ba0cff8c8525fcc8a7

See more details on using hashes here.

Provenance

The following attestation bundles were made for weiss_sim-0.4.0-cp312-cp312-win_amd64.whl:

Publisher: wheels.yml on victorwp288/weiss-schwarz-simulator

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

File details

Details for the file weiss_sim-0.4.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for weiss_sim-0.4.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 182c30082bc251161e2d08b38fa20f5e0c8532c6b1e33697861403186f6817ce
MD5 0070dee42938ca0f7c775b3b24bb6d67
BLAKE2b-256 d9d6922dceef0a1b41911e6c45e6e477726ac9d452185d7ee5aad62d9927c33c

See more details on using hashes here.

Provenance

The following attestation bundles were made for weiss_sim-0.4.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: wheels.yml on victorwp288/weiss-schwarz-simulator

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

File details

Details for the file weiss_sim-0.4.0-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.

File metadata

File hashes

Hashes for weiss_sim-0.4.0-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 3ecb78413e84423f688d9582d5560887b06ef5fb34b8fb497e9b49088ec99cee
MD5 2a2e9fedadd3be503ce7473ffd29ed47
BLAKE2b-256 92e91405ac7fd9b6fffc8d1c7bd4d936d54a1a5cef8207363b2711965f52d550

See more details on using hashes here.

Provenance

The following attestation bundles were made for weiss_sim-0.4.0-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl:

Publisher: wheels.yml on victorwp288/weiss-schwarz-simulator

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

File details

Details for the file weiss_sim-0.4.0-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: weiss_sim-0.4.0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 1.3 MB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for weiss_sim-0.4.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 9fe9ce61f3b2eda74c24f103a30dedd6e8c8a4343d41647335cab6a2fd21d085
MD5 8f32ad1363cf610dd13f0e5bb8649a86
BLAKE2b-256 a9a69b7d6fe971fb5c98910e922620d3ce2c777365792fea79457066e761bf4d

See more details on using hashes here.

Provenance

The following attestation bundles were made for weiss_sim-0.4.0-cp311-cp311-win_amd64.whl:

Publisher: wheels.yml on victorwp288/weiss-schwarz-simulator

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

File details

Details for the file weiss_sim-0.4.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for weiss_sim-0.4.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ba1c9b7b4e882a5c2e50ebfcdbb0964f67e462c2f0c04dc10e036f31a2224456
MD5 a3467744770af0e35d0ba686048921db
BLAKE2b-256 f54e58f39876fc0e416aef18e46cd4030600d59d5cf1cae2ae65861808789123

See more details on using hashes here.

Provenance

The following attestation bundles were made for weiss_sim-0.4.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: wheels.yml on victorwp288/weiss-schwarz-simulator

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

File details

Details for the file weiss_sim-0.4.0-cp311-cp311-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.

File metadata

File hashes

Hashes for weiss_sim-0.4.0-cp311-cp311-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 671e455f2ebd2e304aaf6ac2c1837b6e98be04ed5b9a525aa7f02ee0b48c7909
MD5 3a25c4fa5736fd559c891ab1c772ab68
BLAKE2b-256 6e904e512f0ebc0d028a97e34025f968243adbc02a188bcd00b82d6cebcbd921

See more details on using hashes here.

Provenance

The following attestation bundles were made for weiss_sim-0.4.0-cp311-cp311-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl:

Publisher: wheels.yml on victorwp288/weiss-schwarz-simulator

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

File details

Details for the file weiss_sim-0.4.0-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: weiss_sim-0.4.0-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 1.3 MB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for weiss_sim-0.4.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 d4b7af68dd89e0f684854860cb0498e4e359ba28c612a80eb67a07a95f26a06c
MD5 016a6104e89ccdcd8c558ea14afa19e4
BLAKE2b-256 439a3f81f13958fb3e1bfaca08db6785b09f5bc79299f58b8bf52e3d4a3aff64

See more details on using hashes here.

Provenance

The following attestation bundles were made for weiss_sim-0.4.0-cp310-cp310-win_amd64.whl:

Publisher: wheels.yml on victorwp288/weiss-schwarz-simulator

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

File details

Details for the file weiss_sim-0.4.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for weiss_sim-0.4.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c3daab16fb3ee32e34a93917d2b141249ec9e7321569907a4b2b32cdb055fb18
MD5 480aa9add8ab69c82112b201332bae31
BLAKE2b-256 f1491b216e37ea8f26db118e4a1af8dcd5bd1f4391f47d4e3b6afacdb8f887c4

See more details on using hashes here.

Provenance

The following attestation bundles were made for weiss_sim-0.4.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: wheels.yml on victorwp288/weiss-schwarz-simulator

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

File details

Details for the file weiss_sim-0.4.0-cp310-cp310-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.

File metadata

File hashes

Hashes for weiss_sim-0.4.0-cp310-cp310-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 5feb79ea9559a22290ec70b8825c8615c5d2ce2e1cab73d2913dde6e46928464
MD5 b551da7674d6321da1917a959a27c9eb
BLAKE2b-256 88aa3d45d41c8aa7b3c981b1770cf5a053e4ed548c1c3aebd0c435f5ba8fbc2a

See more details on using hashes here.

Provenance

The following attestation bundles were made for weiss_sim-0.4.0-cp310-cp310-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl:

Publisher: wheels.yml on victorwp288/weiss-schwarz-simulator

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