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

  • About 25 times slower than the C tools (one team-season: 0.075 s in C, about 1.4 s here). Whole seasons take seconds to a minute.
  • It reads Retrosheet's files; it does not include or download them.
  • Python 3.11 or newer. 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.1.1

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.1.1
File Size Uploaded
chadwickpy-0.1.1.tar.gz 348.7 kB Details

Built distribution (wheel)

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

Total release size: 465.2 kB

Release files / chadwickpy-0.1.1.tar.gz

Download URL chadwickpy-0.1.1.tar.gz
Size 348.7 kB
Tags Source
SHA-256 checksum
How to use checksums
1db9570560d9c87110abf79e5b0a4a338f1f6a26c52b9706734edd5353a97f02
BLAKE2b-256 checksum
How to use checksums
78fbe95a19540ce4c27709c99d35fd2937c56dbdf0f2b75074d519eb9977d44b
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.1.1-py3-none-any.whl

Download URL chadwickpy-0.1.1-py3-none-any.whl
Size 116.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
522a846721a0131ba5a3349e869f5e149b644c87985e92384750498bf2e24b9d
BLAKE2b-256 checksum
How to use checksums
951e7cf05d606720e7bfba7a435b92b8f61430527e1823c49ea1dcddda63995d
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

0.2.0

2 release files

This release

0.1.1 This release

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