Skip to main content

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

Project description

Weiss Schwarz Simulator

CI Wheels Benchmarks Security Docs PyPI Changelog

Deterministic Weiss Schwarz simulation for RL and engine research.

  • Rust handles the hot loop (weiss_core)
  • Python provides batched stepping (weiss_sim)
  • The engine advances internally until a decision point, then exposes a stable action-space contract

Why this project

  • Deterministic episodes from seed + action sequence
  • Fixed, versioned observation/action encodings for training pipelines
  • High-throughput EnvPool stepping for large batched RL workloads
  • Replay/fingerprint metadata for drift detection and debugging

5-minute start (Python)

Option A: install from PyPI

python -m pip install -U weiss-sim numpy

Option B: local dev install (Rust + Python)

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

Minimal step loop

Use a real .wsdb path on your machine. The db_path below is a placeholder and the legal_deck ids must exist in that database.

If you are working from source, you can use the fixture DB:

db_path="python/tests/fixtures/cards.wsdb"
from pathlib import Path
import numpy as np
import weiss_sim

db_path = Path("/path/to/your/cards.wsdb")
legal_deck = (list(range(1, 14)) * 4)[:50]

pool = weiss_sim.EnvPool.new_rl_train(
    32,
    str(db_path),
    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)

For training-safe loop semantics and contract details, read docs/rl_contract.md.

Documentation

Primary docs entrypoint: docs/README.md

Recommended reading paths:

  • RL users: docs/quickstart.md -> docs/rl_contract.md -> docs/encodings.md
  • Python integrators: docs/python_api.md -> docs/rl_contract.md
  • Engine contributors: docs/engine_architecture.md -> PROJECT_STATE.md -> docs/rules_coverage.md
  • Performance work: docs/performance_benchmarks.md -> benchmark workflow in .github/workflows/benchmarks.yml

Reference links:

Benchmark Snapshot (main, top 12)

Last updated: 2026-02-07 17:18 UTC

Benchmark Time
rust/advance_until_decision 31792 ns/iter
rust/step_batch_64 16628 ns/iter
rust/step_batch_fast_256_priority_off 67375 ns/iter
rust/step_batch_fast_256_priority_on 67209 ns/iter
rust/legal_actions 13 ns/iter
rust/legal_actions_forced 12 ns/iter
rust/on_reverse_decision_frequency_on 1104 ns/iter
rust/on_reverse_decision_frequency_off 1166 ns/iter
rust/observation_encode 166 ns/iter
rust/observation_encode_forced 166 ns/iter
rust/mask_construction 388 ns/iter
rust/mask_construction_forced 390 ns/iter

Repository layout

  • weiss_core/ Rust engine core
  • weiss_py/ PyO3 bindings
  • python/weiss_sim/ Python API helpers and buffer wrappers
  • python/examples/ benchmark and integration examples
  • python/tests/ Python contract and smoke tests
  • docs/ user/developer documentation hub

Local quality checks

Rust:

scripts/check_env_layering.sh
python scripts/check_docs_links.py
python scripts/check_docs_constants.py
cargo fmt --all -- --check
cargo clippy --workspace --all-targets -- -D warnings
cargo test --workspace --features test-harness

Python:

ruff format --check python scraper scripts
ruff check python scraper scripts
pytest -q python/tests

Compatibility and versioning

Encoding and schema values are explicit and versioned:

  • OBS_ENCODING_VERSION
  • ACTION_ENCODING_VERSION
  • REPLAY_SCHEMA_VERSION
  • WSDB_SCHEMA_VERSION

If any encoding layout changes, update:

  1. source constants
  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.2.1.tar.gz (239.5 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.2.1-cp312-cp312-win_amd64.whl (772.9 kB view details)

Uploaded CPython 3.12Windows x86-64

weiss_sim-0.2.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (930.6 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

weiss_sim-0.2.1-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (1.7 MB view details)

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

weiss_sim-0.2.1-cp311-cp311-win_amd64.whl (773.3 kB view details)

Uploaded CPython 3.11Windows x86-64

weiss_sim-0.2.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (930.2 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

weiss_sim-0.2.1-cp311-cp311-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (1.7 MB view details)

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

weiss_sim-0.2.1-cp310-cp310-win_amd64.whl (773.1 kB view details)

Uploaded CPython 3.10Windows x86-64

weiss_sim-0.2.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (930.3 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

weiss_sim-0.2.1-cp310-cp310-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (1.7 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.2.1.tar.gz.

File metadata

  • Download URL: weiss_sim-0.2.1.tar.gz
  • Upload date:
  • Size: 239.5 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.2.1.tar.gz
Algorithm Hash digest
SHA256 b6cba2c8c4a7d3ad9425e0c3e4a7a657322f27c1c219da0bfde64943a95d3d6d
MD5 8c514716e7a174bdc564415d9ec0eeb6
BLAKE2b-256 1e29c514dbf26d5e637a7f69881f3462dfe54a101f81aa74f9b1065ce29772ab

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: weiss_sim-0.2.1-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 772.9 kB
  • 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.2.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 5bbfe8ee80956808f6229bb29c7dd1dba0e1141221f4023c453fd39d8d84a141
MD5 8e61be899344c961a882b47c7595e993
BLAKE2b-256 8e0f63d511f39ed85a2083d10faf6e6b39001da1877db4e284eb7b3db91a8188

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for weiss_sim-0.2.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 76f62237da6bad41ad68cadebc69368e4afbc0eef8be7f7215c3aa48081377e7
MD5 3fdaa68b3b832c6e058278c74785b02f
BLAKE2b-256 5b72c25478db65902938d3edeb186e1dbe9c2d5e6c8f637d7cd7f74554058432

See more details on using hashes here.

Provenance

The following attestation bundles were made for weiss_sim-0.2.1-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.2.1-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.2.1-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 f26fbc51f83bc0ad9433a5f6064e700c4e7a1e88727f27ecdfa280ad11bf8e73
MD5 96f793f8ec0f493a54cebd857e84a24f
BLAKE2b-256 7a3d72172451562f198e3d6747c749ab4a9c4dc1b6c3a6838ba0b1746488e32e

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: weiss_sim-0.2.1-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 773.3 kB
  • 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.2.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 0bf7cbee606d1a9976262b3554493bf2e9be3c436587a79ddceaf2cb5bcf74b7
MD5 b4d0350f032e078c7c67d484a9fbab59
BLAKE2b-256 92ab0d0477e3538f1a42c6757f1967e03db0164616d737dc5a5c904d371e2234

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for weiss_sim-0.2.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 68cce6bacd25110e5aa46d9cc9a9db196ea3a36321b4df7113468184eaa6d1e3
MD5 2886acdf29f2d67afcbf8fdc0b029ff3
BLAKE2b-256 b7d6f9ce0be9a0b69c8965bcce89eb635495d6034c068a26066fc77b32f70efa

See more details on using hashes here.

Provenance

The following attestation bundles were made for weiss_sim-0.2.1-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.2.1-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.2.1-cp311-cp311-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 b12853b5e35b3d575f2a34b7b17f67e7c5ba73178bc2668e71b1dafbc6b8f0f9
MD5 3bdcbecbacecf0c226b75ea56d189714
BLAKE2b-256 7354713497d8d49bb1dc04c0b28bf591ac877aefa9b4919169bcd8d8d18096ab

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: weiss_sim-0.2.1-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 773.1 kB
  • 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.2.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 3fe2c682a2af7c5101c4f04376f149a228d163b041760f2492d86cb8616d7a80
MD5 35b8a4695b26d3439a5e71579c958ec2
BLAKE2b-256 f63c68d49fc725d513fa06dac0146e83049069c30aafecf2a1ea924ff5414de9

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for weiss_sim-0.2.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 bbd813f706fa53c12140fcf49f1549cc4af0ece65719381c6823b52f98011275
MD5 e11f0c1b778474e2504c9540d3f14db0
BLAKE2b-256 2024710bbd48b5c0d77ec983c28508fcaf47a8c56f9d7ddf6f046a7eac29ce03

See more details on using hashes here.

Provenance

The following attestation bundles were made for weiss_sim-0.2.1-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.2.1-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.2.1-cp310-cp310-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 4a7f64210c8ca8e6dc0ed38643f00ea58d918aa4f374561f389dbae31088fe7d
MD5 747c0b445f1e2626c10b676832412418
BLAKE2b-256 f8b2b66f0cc42ec516e75a768c1d4689c0fa2c62d77eec8a83c1c13480a2e715

See more details on using hashes here.

Provenance

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