chadwickpy
Retrosheet play-by-play files to data tables. Pure Python, one pip install.
Retrosheet publishes every play of every MLB game as text files. The Chadwick tools turn those files into tables. chadwickpy is those same six tools, rewritten in pure Python: no compiler, no C library, no dependencies. Output is byte-identical to Chadwick on every season from 1910 to 2025 (for inputs where the C behaves in a defined way).
pip install chadwickpy # or: uvx --from chadwickpy cwevent -h
curl -O https://www.retrosheet.org/events/2010seve.zip
unzip -q 2010seve.zip -d retro2010 && cd retro2010
cwevent -y 2010 -n -f 0,2,3,4,10,14,29,34 2010NYA.EVA > yankees_events.csv
"GAME_ID","INN_CT","BAT_HOME_ID","OUTS_CT","BAT_ID","PIT_ID","EVENT_TX","EVENT_CD"
"NYA201004130",1,0,0,"aybae001","petta001","S9/F9S-",20
"NYA201004130",1,0,0,"abreb001","petta001","K",3
"NYA201004130",1,0,1,"huntt001","petta001","8/F8LXD",2
The six tools
| Tool | One row per |
|---|---|
cwevent |
event (a play): up to 164 columns |
cwgame |
game |
cwdaily |
player per game (batting, pitching, fielding) |
cwsub |
substitution |
cwcomment |
scorer comment |
cwbox |
game, as a text, XML or SportsML box score |
Same command names and options as Chadwick. Also usable from Python
(from chadwickpy.tools.events import event_rows).
Good to know
- Speed: Single-core processing is ~0.66 s per team-season. When processing multiple files (such as a full season),
chadwickpyautomatically parallelizes across available CPU cores, processing an entire 2,430-game season in a few seconds on a multi-core machine. That matches the C tools on one core; per core, chadwickpy is about 10 to 40 times slower than C. - Override parallelism anytime via
-j <workers>(e.g.-j 1for sequential) or theCHADWICK_JOBSenvironment variable. - It reads Retrosheet's files; it does not include or download them.
- Pure Python (zero dependencies). Python 3.11 or newer (also fully compatible with PyPy 3.10+ and Python 3.13+ JIT). Linux, macOS and Windows.
Documentation
https://cbwinslow.github.io/chadwickpy/: getting started, a guide to each tool, Python
usage, recipes, the full option and field reference, how it was verified, and an FAQ.
Machine-readable: llms.txt.
Verification
tests/ compares every tool with captured real-Chadwick output, and with the real programs
when they are available (CHADWICK_BIN, CHADWICK_SRC). CI builds Chadwick at commit
c685ab5 and runs the whole suite on Python 3.11-3.13, failing on any skipped parity test.
Run it yourself: uv run --with pytest pytest.
Licence and credit
GPL-3.0-or-later (LICENSE). chadwickpy is a derivative work of Chadwick, Copyright (C)
2002-2023 Dr T L Turocy and the Chadwick Baseball Bureau, GPL-2.0-or-later (COPYING-chadwick,
NOTICE); each ported module keeps that notice. It is independent: Chadwick and Retrosheet do
not endorse or sponsor it, and it ships no Retrosheet data.
Retrosheet's data-use notice asks that anyone using its data say so. If you publish anything built on it, include:
The information used here was obtained free of charge from and is copyrighted by Retrosheet. Interested parties may contact Retrosheet at "www.retrosheet.org".
Contributing, questions, security
CONTRIBUTING.md · Discussions · Issues · SECURITY.md. The rule of the project: the port stays a translation of Chadwick's C; rules come from the C, never from tuning output.
Metadata
Release files for chadwickpy 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| chadwickpy-0.3.0.tar.gz | 426.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| chadwickpy-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 548.9 kB
Release files / chadwickpy-0.3.0.tar.gz
| Download URL | chadwickpy-0.3.0.tar.gz |
|---|---|
| Size | 426.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bda072a8c6ec76f049e596f0832badd0d3f5d6340bde47a254646bb1d4e0fcb9
|
|
BLAKE2b-256 checksum How to use checksums |
6ee3d84183b70820705f1a9c21e8111f95216904414a39c282fdb2104f68c8bc
|
| 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 Oct 7, 2026.
Transparency logRelease files / chadwickpy-0.3.0-py3-none-any.whl
| Download URL | chadwickpy-0.3.0-py3-none-any.whl |
|---|---|
| Size | 122.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
926d623722064a5a044449c2604ea68849715139f4284dc6bf81b0ddd14fa1fc
|
|
BLAKE2b-256 checksum How to use checksums |
763b90b626b6ae6546c5839f725ef78f9756a5039c74a645ba17d2eda74b4915
|
| 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 Oct 7, 2026.
Transparency log