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.
Metadata
Release files for wh40kdc 1.4.5
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 | |
|---|---|---|---|---|
| wh40kdc-1.4.5.tar.gz | 1.8 MB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| wh40kdc-1.4.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 3.7 MB
Release files / wh40kdc-1.4.5.tar.gz
| Download URL | wh40kdc-1.4.5.tar.gz |
|---|---|
| Size | 1.8 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
94c9ba6fc9b2d6cd567db12097c25ff39a187c2a01eef395d40c7634ff02aad3
|
|
BLAKE2b-256 checksum How to use checksums |
e608f3fc1d7dfd956f04e65308c7eb2fc8cd86da8815c32c05d401a829b64979
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Sep 17, 2026.
Transparency logRelease files / wh40kdc-1.4.5-py3-none-any.whl
| Download URL | wh40kdc-1.4.5-py3-none-any.whl |
|---|---|
| Size | 1.9 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a28746dc51e3e2f44c72dca626b8a15b7f4be183ed9fccc921f0685ba8c3742a
|
|
BLAKE2b-256 checksum How to use checksums |
e247430b923c9eb44a29ba997547b6a4c1ed70bdbcc63ea41c4a7888324c3648
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Sep 17, 2026.
Transparency logSecurity for wh40kdc 1.4.5
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
All 2 files in this release have been uploaded with provenance metadata.
Attestation for wh40kdc-1.4.5.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 Sep 17, 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.