find-cpython-usage

Identify CPython internal headers and structs used in the codebase.

648|537|Updated Jun 20, 2016
One-click install
npx skills add https://github.com/DataDog/dd-trace-py --skill find-cpython-usage
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: find-cpython-usage
Source: https://github.com/DataDog/dd-trace-py/tree/main/.claude/skills/find-cpython-usage
Command: npx skills add https://github.com/DataDog/dd-trace-py --skill find-cpython-usage

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps identify all CPython internal headers and structures used in the codebase, which is essential when adding support for new Python versions.

Core Features & Use Cases

  • Scan for internal headers: Locate includes like internal/pycore*, CPython headers, and Python.h usages.
  • Detect struct usage: Capture where common CPython structs (frame, code, thread state) are accessed.
  • Document findings: Compile a reference to guide compatibility validation and CPython version testing.

Quick Start

Run the CPython usage search across the codebase and save results to findings-find-cpython-usage.txt. Example: grep -r "include.internal/pycore" ddtrace/ --include=".c" --include=".cpp" --include=".h" --include=".hpp" --include=".pyx"

Frequently Asked Questions about find-cpython-usage

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I identify CPython internal headers used in my codebase?

CPython internal headers like internal/pycore* and Python.h are located by scanning source files with grep. Search across .c, .cpp, .h, .hpp, and .pyx files to capture all includes, then document findings in a reference file for version compatibility validation.

What CPython structs should I check when adding support for a new Python version?

Common CPython structs include frame, code, and thread state objects. Document where these structs are accessed in your codebase and which fields are directly used, then map findings to source files to enable version comparison across Python releases.

Why do I need to track CPython internal API dependencies?

CPython internal APIs change between versions, affecting profilers and native extensions. Identifying which internal headers and structs your code relies on reveals compatibility risks and guides targeted testing when upgrading to new Python versions.

Can I use this to prepare my native extensions for a Python version upgrade?

Yes. Scan native extensions for internal header includes and struct accesses, document the results, and use that reference to validate compatibility with the target Python version before deploying the upgrade.

What's the best way to document CPython usage across a large codebase?

Compile a findings file listing all included CPython headers, accessed structs, and directly used fields mapped to their source files. This centralized reference enables systematic compatibility validation and simplifies handoff to version comparison workflows.