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, and with the Go module, 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.Dataset.embedded()is the matched-play view: listings and name searches skip Combat Patrol-only records, and id lookups resolve every record.ds.for_game_mode("combat-patrol")ords.for_game_mode("all")opens another view. - Importers — ListForge, NewRecruit (JSON / WTC-compact / WTC-full /
simple), GW app export, Rosterizer, and canonical Roster JSON, all resolving
to one
Rostershape. - Exporters — NewRecruit (JSON / WTC-compact / WTC-full / simple), canonical Roster JSON, Rosterizer, ATC 2026, and Yellowscribe, byte-identical to the TypeScript, Rust, and Go implementations.
- Cruncher — the damage-projection engine (attacks → hits → wounds →
unsaved → damage → after-FNP → models-killed) with buff resolution and
per-buff attribution. Undecided leaf conditions are reported as needs with
stable keys and answered through the engine context's
conditionFactsdict;Dataset.mortal_wound_sources_forlists mortal wounds inflicted outside the attack. - 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.
Metadata
Release files for wh40kdc 1.5.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| wh40kdc-1.5.1.tar.gz | 2.3 MB | With provenance | Details for wh40kdc-1.5.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| wh40kdc-1.5.1-py3-none-any.whl | Python 3 | none | any | Details for wh40kdc-1.5.1-py3-none-any.whl |
Total release size: 4.6 MB
Release files / wh40kdc-1.5.1.tar.gz
| Download URL | wh40kdc-1.5.1.tar.gz |
|---|---|
| Size | 2.3 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cc1675ae23af2b262d5bcb656fb063a428df30d45d453acde8b2b9b83c2ce734
|
|
BLAKE2b-256 checksum How to use checksums |
effdad5ded3bd370e872dc544853c3fe3fb93496f5ffdcf1b29ba33ab6d69060
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 13, 2026.
Transparency logRelease files / wh40kdc-1.5.1-py3-none-any.whl
| Download URL | wh40kdc-1.5.1-py3-none-any.whl |
|---|---|
| Size | 2.4 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3c072d672ee39df3857f88b3823ff9a6fd1c527bad17b7f229c6db60df630221
|
|
BLAKE2b-256 checksum How to use checksums |
60575b979bbc0e10e154c0125640a401b9daf24c0a98da0ab00ab264dd37eebc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 13, 2026.
Transparency logSecurity for wh40kdc 1.5.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for wh40kdc-1.5.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 13, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.