Skip to main content

Warhammer 40K dataset for the 40kdc-data schema layer: an embedded dataset behind a linked typed API, ListForge + NewRecruit roster importers and exporters, damage-projection cruncher, and a schema validator.

Project description

wh40kdc

The 40kdc Warhammer 40K dataset behind a linked, typed API — find units, follow them to their weapons, abilities, phases, and factions. The Python counterpart to @alpaca-software/40kdc-data (npm) and wh40kdc (crates.io), held in behavioral lockstep with both by the shared conformance corpus in the 40kdc-data repository.

pip install wh40kdc
from wh40kdc import Dataset

ds = Dataset.embedded()
unit = ds.units.find("Khârn the Betrayer")
for weapon in unit.weapons:
    print(weapon.name)

What ships:

  • Linked dataset APIDataset with id/name lookups (diacritic- and punctuation-insensitive), reverse indexes, and join queries across units, weapons, abilities, phases, and factions.
  • Importers — ListForge, NewRecruit (JSON / WTC-compact / WTC-full / simple), GW app export, and Rosterizer, all resolving to one Roster shape.
  • Exporters — the same roster formats back out, byte-identical to the TypeScript and Rust implementations.
  • Cruncher — the damage-projection engine (attacks → hits → wounds → unsaved → damage → after-FNP → models-killed) with buff resolution and per-buff attribution.
  • Scoring, terrain, translation — secondary-mission scoring, terrain layout resolution and keystone measurements, and the ability-DSL / scoring-card describers.
  • Validatorvalidate(target, value) against the canonical JSON Schemas, emitting the closed error-code enum shared by all implementations.

The conformance runner (used by the cross-implementation parity differ) is invoked as python -m wh40kdc.runner — see conformance/RUNNER_PROTOCOL.md in the repository.

Development

cd python
uv venv && uv pip install -e ".[dev]"
pytest          # includes the conformance suite when run inside the repo
ruff check .
mypy src

Generated artifacts (_bundle.json, _spec.py, _types.py, src/wh40kdc/schemas/) are produced by the scripts in codegen/ and checked for drift in CI — regenerate with:

python3 codegen/sync_bundle.py && python3 codegen/sync_spec.py && python3 codegen/gen_typeddicts.py

License

MIT. The schema content the dataset describes is CC0; enrichment data is CC BY 4.0 — see the repository's licensing table.

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

wh40kdc-0.5.3.tar.gz (599.8 kB view details)

Uploaded Source

Built Distribution

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

wh40kdc-0.5.3-py3-none-any.whl (657.5 kB view details)

Uploaded Python 3

File details

Details for the file wh40kdc-0.5.3.tar.gz.

File metadata

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

File hashes

Hashes for wh40kdc-0.5.3.tar.gz
Algorithm Hash digest
SHA256 93cecfbe8504d9f5af1d686573f1a40900be223c7d5e6891b69c62a2935a8cf3
MD5 d69eb0a205b638eafadab324e55b7e17
BLAKE2b-256 5bc05a81c62ea1e89ce7a1e7f14cdaa98a19a2bf03b01aa9e7ad7ac4cda4ccfc

See more details on using hashes here.

Provenance

The following attestation bundles were made for wh40kdc-0.5.3.tar.gz:

Publisher: validate.yml on wn-mitch/40kdc-data

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

File details

Details for the file wh40kdc-0.5.3-py3-none-any.whl.

File metadata

  • Download URL: wh40kdc-0.5.3-py3-none-any.whl
  • Upload date:
  • Size: 657.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for wh40kdc-0.5.3-py3-none-any.whl
Algorithm Hash digest
SHA256 bda343a14de276b323464d872038d57ec6a0987f02f120ea46ab2b76c5450a43
MD5 8e7bcc024861dd8e93a450a2ae6dd78c
BLAKE2b-256 245321d8fdc8ab97a84705ab5d888f3d61dee8e1f83259e08357828d89f2d643

See more details on using hashes here.

Provenance

The following attestation bundles were made for wh40kdc-0.5.3-py3-none-any.whl:

Publisher: validate.yml on wn-mitch/40kdc-data

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