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

Option C: contributor setup (dev extras + local extension)

python -m venv .venv
source .venv/bin/activate
./scripts/setup_dev_env.sh

This installs .[dev] extras (ruff, pytest, maturin, pip-audit) and builds the local extension in-place.

Minimal high-level loop

import numpy as np
import weiss_sim

with weiss_sim.fast(num_envs=32, seed=0) as sim:
    reset = sim.reset()
    actions = reset.legal.sample_uniform(seed=123)
    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)

Deck authoring flow (Python)

import weiss_sim

builder = weiss_sim.cards.builder(initial="starter_v1")
builder.set_count("CARD-1", 4)
report = builder.validate(rules_profile="approx", card_pool="all")
if report.ok:
    deck_ids = builder.build(rules_profile="approx", card_pool="all")

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
python scripts/gen_docs_snippets.py --check

Benchmark snapshot (main)

Last updated: 2026-02-23 01:29 UTC

Benchmark Time
rust/advance_until_decision 49148 ns/iter
rust/step_batch_64 15240 ns/iter
rust/reset_batch_256 803322 ns/iter
rust/step_batch_fast_256_priority_off 67411 ns/iter
rust/step_batch_fast_256_priority_on 68008 ns/iter
rust/legal_actions 12 ns/iter
rust/legal_actions_forced 11 ns/iter
rust/on_reverse_decision_frequency_on 1253 ns/iter
rust/on_reverse_decision_frequency_off 1290 ns/iter
rust/observation_encode 186 ns/iter
rust/observation_encode_forced 185 ns/iter
rust/mask_construction 300 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.7.0.tar.gz (708.6 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.7.0-cp312-cp312-win_amd64.whl (1.3 MB view details)

Uploaded CPython 3.12Windows x86-64

weiss_sim-0.7.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

weiss_sim-0.7.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.7.0-cp311-cp311-win_amd64.whl (1.3 MB view details)

Uploaded CPython 3.11Windows x86-64

weiss_sim-0.7.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

weiss_sim-0.7.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.7.0-cp310-cp310-win_amd64.whl (1.3 MB view details)

Uploaded CPython 3.10Windows x86-64

weiss_sim-0.7.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

weiss_sim-0.7.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.7.0.tar.gz.

File metadata

  • Download URL: weiss_sim-0.7.0.tar.gz
  • Upload date:
  • Size: 708.6 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.7.0.tar.gz
Algorithm Hash digest
SHA256 ba45dce299400eff9d60c4c7e7f00fafdef4128f7a1e4b29cd977330d4d00dd1
MD5 982968aee262b2fd09ea59d48f65af62
BLAKE2b-256 fb0c38187616cd8088353ae1de1470de5281d52fe88700f086806979cfde7b34

See more details on using hashes here.

Provenance

The following attestation bundles were made for weiss_sim-0.7.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.7.0-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: weiss_sim-0.7.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.7.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 79f43a4a60cc8092041dab4997d15d28ba99c4aadf98b1e44127e29d2b792e0f
MD5 e7ae443aef2fba87a61cc5d0a4709f17
BLAKE2b-256 45f4342e89ac65087b5d1d2f3bd3ab74550555d2af416dc3e8bf7658fc18fabb

See more details on using hashes here.

Provenance

The following attestation bundles were made for weiss_sim-0.7.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.7.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for weiss_sim-0.7.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 11b57a38fae50a11e4a4dba6b11324a936fbbe8bed23cc8d31098a6f35c2ca56
MD5 58fc1d38fba710cc0f9b8b38a323e485
BLAKE2b-256 a88b471364f2359545c4b6a9248e67a1ec40008ac20c49984da3f9042a853264

See more details on using hashes here.

Provenance

The following attestation bundles were made for weiss_sim-0.7.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.7.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.7.0-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 c0fd1ec8536c91d6e87399322fb28ff0baea41a3ee83c9c96fb167f36dd62d7d
MD5 b8da30ec3da40d8cc5942dbb8d658e19
BLAKE2b-256 952902f49a9a256d3f69bc2d16294d11e6d5d913348fdb81e41730f3d4ed7c13

See more details on using hashes here.

Provenance

The following attestation bundles were made for weiss_sim-0.7.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.7.0-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: weiss_sim-0.7.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.7.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 35bc601a1c53950983f5af184f06a0dcb239ab50baa17d90028fce54b24f6408
MD5 79caeaa87ec4975f0781b62fe8e86c12
BLAKE2b-256 e0f98c9778d44e1cc57c641bb8535940660700d2cae2b9e1326071f565af2a29

See more details on using hashes here.

Provenance

The following attestation bundles were made for weiss_sim-0.7.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.7.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for weiss_sim-0.7.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 27e81fe0259992a6eee716314403d2d21a2f5e4cc1e2e41a01d30b42029afa7a
MD5 643b996fa09e5a17bc16ed9aa3df6020
BLAKE2b-256 a2dd7ec836425632e044a7528aadbb1418e4eac678944ae68af339e22f037e66

See more details on using hashes here.

Provenance

The following attestation bundles were made for weiss_sim-0.7.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.7.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.7.0-cp311-cp311-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 7299cf738cad0ae2f8f54098e61899efa511dc0b63ac05fa4f845b9b9338def1
MD5 564ba0e6104f8553171ddde3a0ba16b6
BLAKE2b-256 69b51f4fbb4efe291049f9f6bedd4764cc4cfae76bb1d28f74c7a9e342667130

See more details on using hashes here.

Provenance

The following attestation bundles were made for weiss_sim-0.7.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.7.0-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: weiss_sim-0.7.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.7.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 55c585cb034223f0183fa22aaffd58aed57f89482f169fe164108aa7e74e2dc1
MD5 bbf12ce7c40bfff70ae2ffccfd7135ab
BLAKE2b-256 c6ae7079d3e4a90558b044b2aff65fe7ad928cbd2e5d3c92dc6357b80a2d98b1

See more details on using hashes here.

Provenance

The following attestation bundles were made for weiss_sim-0.7.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.7.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for weiss_sim-0.7.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b08fa70bbf900dda0314484b27622dbf8c70c45013978af94ff2069803d30033
MD5 558cf6eb8b8a6ff3ae03694992544021
BLAKE2b-256 530c56d43928b7d92caa050804bcf31cd57d4ceb9b35ea94841a74405c9c96bd

See more details on using hashes here.

Provenance

The following attestation bundles were made for weiss_sim-0.7.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.7.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.7.0-cp310-cp310-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 12c57f8a3a8fc35a506351a859b9dc4c9dc444f8553df432b384c81aab4994df
MD5 d75bd5639f737eebd7c4b766926f545f
BLAKE2b-256 1e9f0f1ca2f3ac08742bb5afaa7d69caa04db51f511774945806742c92b6350e

See more details on using hashes here.

Provenance

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