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-22 22:06 UTC

Benchmark Time
rust/advance_until_decision 49166 ns/iter
rust/step_batch_64 16819 ns/iter
rust/reset_batch_256 816229 ns/iter
rust/step_batch_fast_256_priority_off 66720 ns/iter
rust/step_batch_fast_256_priority_on 73467 ns/iter
rust/legal_actions 12 ns/iter
rust/legal_actions_forced 12 ns/iter
rust/on_reverse_decision_frequency_on 1308 ns/iter
rust/on_reverse_decision_frequency_off 1303 ns/iter
rust/observation_encode 191 ns/iter
rust/observation_encode_forced 195 ns/iter
rust/mask_construction 311 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.6.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.6.0-cp312-cp312-win_amd64.whl (1.3 MB view details)

Uploaded CPython 3.12Windows x86-64

weiss_sim-0.6.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.6.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.6.0-cp311-cp311-win_amd64.whl (1.3 MB view details)

Uploaded CPython 3.11Windows x86-64

weiss_sim-0.6.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.6.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.6.0-cp310-cp310-win_amd64.whl (1.3 MB view details)

Uploaded CPython 3.10Windows x86-64

weiss_sim-0.6.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.6.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.6.0.tar.gz.

File metadata

  • Download URL: weiss_sim-0.6.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.6.0.tar.gz
Algorithm Hash digest
SHA256 658dda60414dd9e5cee03bace6f0d8d9c9690b0418705591874f18a9ff5ca705
MD5 533d89aac0609220746ef24752cbb64a
BLAKE2b-256 9424f323eb7899549cb61a258c27f3c76804512fd3145ecdb32b14f73a2dffe9

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: weiss_sim-0.6.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.6.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 96ba4fac17c74169883bf559180f1b883b72d1dfabfd433ca7718bd298760a26
MD5 7910328fef2fdd88ff9904284b21fd4c
BLAKE2b-256 c7d58ddfa1c4dd00afa35677cd3084dd9825514ebde6b6d4e49a7ec90da1d0dc

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for weiss_sim-0.6.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3869dd39c6981221eaae559427533c4f757b1a99b22832233917476df47d5179
MD5 80791fded3da9d98585ae783f762cf0d
BLAKE2b-256 0667ccc1bb49ddc54b8e9f140128f00323437502921ee441df8d462989e49454

See more details on using hashes here.

Provenance

The following attestation bundles were made for weiss_sim-0.6.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.6.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.6.0-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 e0a06bfc3892294b9a7424d91cc2512aa3b8b1912bb53544f031c822c2b215c8
MD5 9d3f4f3c5ba8cd179c701c213c74c499
BLAKE2b-256 da12bd26a1d2cefb55a7caf0d5e80eaf832c76b83958de71185ba3f72c92d3f6

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: weiss_sim-0.6.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.6.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 47120f25e58c2814119fd0444cc893b292c5a29c8f7ec8a6f8459ee63b2bf800
MD5 2bde26a1eca7de0db934b444ac040a68
BLAKE2b-256 42e7ef8cf0937b66973e2cef886cc5868cc49f3018cde9fe79653c5ae14b4d5b

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for weiss_sim-0.6.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6932575b3c9fe4a22a321654bbb4b56894c6a5ef34e32733f8988589a25e9741
MD5 1a6592adf2429af39bdcf915a7816f14
BLAKE2b-256 33057690d4ef2144881445beedec0a4111419d036d592ad8ff38d40cd905b972

See more details on using hashes here.

Provenance

The following attestation bundles were made for weiss_sim-0.6.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.6.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.6.0-cp311-cp311-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 23e7f69e7fb459da6476bbdb7f7bdceb54797b91944bfb40dcf882c5d6758747
MD5 b17a6cb794731473c27e66999f6f5b4a
BLAKE2b-256 8c2b46da6cf33943d06688a6b3240d71d7d0aa39c91e73e2f5fc8c85714d9163

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: weiss_sim-0.6.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.6.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 7b9286bb926299fb8542f9865e5f54ae7bad4ae3edde06bee9e96a5a14a23d33
MD5 dd9b3d6bedbeb60569efd7f439606876
BLAKE2b-256 3bb19a3906dc570b12daacfe1c1d7eb9c0c1058ec271346280382c48f4506aa7

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for weiss_sim-0.6.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 96fd4c5bfd39db07e99c7e67bcc0de651976093df15a9a62c25c931c1e675fc8
MD5 c9f598f7fe5a4fba61ba1ec0ed9421c8
BLAKE2b-256 01a33b79e8798bccc5c009d7f652aa05e49a961b6e6ac3b51f954c0e44be0f15

See more details on using hashes here.

Provenance

The following attestation bundles were made for weiss_sim-0.6.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.6.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.6.0-cp310-cp310-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 3854a3c1fbecb51492bf8e30a7845743e2b30ce65003332182e0f655e3eb9dcf
MD5 4be33e4c5549be38f52bb0f9ebe47ece
BLAKE2b-256 4fb8fe35bf84969c6d2430a5a1964ae27ffd2de7235e337efbf773cc103690ca

See more details on using hashes here.

Provenance

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