Skip to main content

chadwickpy logo

chadwickpy

Retrosheet play-by-play files to data tables. Pure Python, one pip install.

CI PyPI Python versions Downloads License Docs

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), chadwickpy automatically parallelizes across available CPU cores, processing an entire 2,430-game season in ~2.3 seconds (~80,000 plays/s), matching native C throughput.
  • Override parallelism anytime via -j <workers> (e.g. -j 1 for sequential) or the CHADWICK_JOBS environment 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.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for chadwickpy 0.2.0
File Size Uploaded
chadwickpy-0.2.0.tar.gz 354.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for chadwickpy 0.2.0
File Interpreter ABI Platform
chadwickpy-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 472.9 kB

Release files / chadwickpy-0.2.0.tar.gz

Download URL chadwickpy-0.2.0.tar.gz
Size 354.2 kB
Tags Source
SHA-256 checksum
How to use checksums
266d196d0b180002a682510861ef35a128bae998a24c3147b2c862fa6130d760
BLAKE2b-256 checksum
How to use checksums
92cfbf47ab340c914277f53721767685fea5a0e8ac5b32ce922962dbff6c02ca
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 5, 2026.

Transparency log

Release files / chadwickpy-0.2.0-py3-none-any.whl

Download URL chadwickpy-0.2.0-py3-none-any.whl
Size 118.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b2e13d78f963baf1e1287a69ebcf464511b827d87d50ff7973cc2ef11a41baaa
BLAKE2b-256 checksum
How to use checksums
c4ae2fc85c284bc6ac860d05f8500577df40d52cb42c326ba334fc030d8fd782
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 5, 2026.

Transparency log

Release history Release notifications | RSS feed

0.4.0

2 release files

0.3.0

2 release files

This release

0.2.0 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page