datadog/compare-cpython-versions
> Compare CPython source code between two Python versions to identify changes in headers and structs. Use this when adding support for a new Python version to understand what changed between versions.
npx skills add https://github.com/DataDog/dd-trace-py --skill compare-cpython-versions
This skill helps compare CPython source code between two Python versions to identify
changes in headers, structs, and APIs that affect our codebase.
Use this skill when:
find-cpython-usage skill# Create ~/dd directory if it doesn't exist
mkdir -p ~/dd
# Clone CPython repository if needed (to ~/dd/cpython)
if [ ! -d ~/dd/cpython ]; then
git clone https://github.com/python/cpython.git ~/dd/cpython
cd ~/dd/cpython
git fetch --tags
else
cd ~/dd/cpython
# Update existing repository
git fetch --tags
git fetch origin
fi
Using the list of headers from find-cpython-usage, compare each header between
the old version and new version. Replace OLD_VERSION and NEW_VERSION with the
actual version tags (e.g., v3.13.0, v3.14.0):
# Compare specific headers between versions
git diff OLD_VERSION NEW_VERSION -- Include/internal/pycore_frame.h
git diff OLD_VERSION NEW_VERSION -- Include/frameobject.h
# Compare all internal headers
git diff OLD_VERSION NEW_VERSION -- 'Include/internal/pycore*.h'
# Compare specific struct definitions
git diff OLD_VERSION NEW_VERSION -- Include/internal/pycore_frame.h | grep -A 20 "struct _PyInterpreterFrame"
For each header/struct, look for:
Struct Changes:
API Changes:
Header Changes:
For each change identified:
# Find commits that modified a specific file between versions
git log OLD_VERSION..NEW_VERSION -- Include/internal/pycore_frame.h
# Find commits that mention a specific struct or function
git log OLD_VERSION..NEW_VERSION --all --grep="_PyInterpreterFrame" -- Include/
# Show the commit that introduced a specific change
git log -p OLD_VERSION..NEW_VERSION -S "struct _PyInterpreterFrame" -- Include/
gh-123923, #123923)https://github.com/python/cpython/issueshttps://docs.python.org/3/whatsnew/You can use AI coding assistants to help analyze differences by:
When comparing versions, look for these types of changes (examples):
Struct Field Changes:
Header Moves:
API Deprecations:
After running this skill, you should have:
Take datadog/compare-cpython-versions from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.