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 API —
Datasetwith 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
Rostershape. - 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.
- Validator —
validate(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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file wh40kdc-0.5.11.tar.gz.
File metadata
- Download URL: wh40kdc-0.5.11.tar.gz
- Upload date:
- Size: 611.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
957cee23bfa12c8d2a387b4bc886b05465bc14a1220b83e20e543875f02e29b8
|
|
| MD5 |
7f913d62321ead161b553a60f13831e0
|
|
| BLAKE2b-256 |
8bcb0db189adfd128f4ffc94560eea2a5c1bc10a65bb5da5adf498ea61fe6cf4
|
Provenance
The following attestation bundles were made for wh40kdc-0.5.11.tar.gz:
Publisher:
validate.yml on wn-mitch/40kdc-data
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
wh40kdc-0.5.11.tar.gz -
Subject digest:
957cee23bfa12c8d2a387b4bc886b05465bc14a1220b83e20e543875f02e29b8 - Sigstore transparency entry: 1756781240
- Sigstore integration time:
-
Permalink:
wn-mitch/40kdc-data@d42ef0a41be1f44d40608fc2b43a13e0d9f47f99 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/wn-mitch
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
validate.yml@d42ef0a41be1f44d40608fc2b43a13e0d9f47f99 -
Trigger Event:
push
-
Statement type:
File details
Details for the file wh40kdc-0.5.11-py3-none-any.whl.
File metadata
- Download URL: wh40kdc-0.5.11-py3-none-any.whl
- Upload date:
- Size: 669.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d71643482c16ed4d445a488fca416a1efecf5dcd6d3d94859d84aa3791fef64c
|
|
| MD5 |
a0b1e4ae4212500b343d7c5af3fa2056
|
|
| BLAKE2b-256 |
c91ee880d646b65ea68537ca739da583b978024d6398fb7ab28f73fb843aa8d9
|
Provenance
The following attestation bundles were made for wh40kdc-0.5.11-py3-none-any.whl:
Publisher:
validate.yml on wn-mitch/40kdc-data
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
wh40kdc-0.5.11-py3-none-any.whl -
Subject digest:
d71643482c16ed4d445a488fca416a1efecf5dcd6d3d94859d84aa3791fef64c - Sigstore transparency entry: 1756781265
- Sigstore integration time:
-
Permalink:
wn-mitch/40kdc-data@d42ef0a41be1f44d40608fc2b43a13e0d9f47f99 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/wn-mitch
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
validate.yml@d42ef0a41be1f44d40608fc2b43a13e0d9f47f99 -
Trigger Event:
push
-
Statement type: