From cpython
Compiles CPython from source with ./configure/make/ccache, regenerates Argument Clinic, runs unittest tests, verifies changes, and debugs failures.
npx claudepluginhub joshuarweaver/cascade-code-languages-python --plugin gpshead-cpython-skillsThis skill uses the workspace's default tool permissions.
**ONLY build in a `build/` subdirectory** at repo root. Never build in the source tree.
Applies Acme Corporation brand guidelines including colors, fonts, layouts, and messaging to generated PowerPoint, Excel, and PDF documents.
Builds DCF models with sensitivity analysis, Monte Carlo simulations, and scenario planning for investment valuation and risk assessment.
Calculates profitability (ROE, margins), liquidity (current ratio), leverage, efficiency, and valuation (P/E, EV/EBITDA) ratios from financial statements in CSV, JSON, text, or Excel for investment analysis.
ONLY build in a build/ subdirectory at repo root. Never build in the source tree.
# Build directory setup
REPO_ROOT=<path-to-cpython-git-repo>
BUILD_DIR=$REPO_ROOT/build
ccache dramatically speeds up rebuilds by caching compilation results. Check if available:
which ccache
If ccache is not installed:
brew install ccache (no sudo required)apt-get install -y ccache or dnf install -y ccachesudo apt-get install ccachesudo dnf install ccacheConfigure with ccache (if available):
cd $BUILD_DIR && CC="ccache gcc" ../configure --with-pydebug
Configure without ccache (fallback):
cd $BUILD_DIR && ../configure --with-pydebug
When doing benchmarking or performance measurement of C code changes, omit --with-pydebug from configure:
cd $BUILD_DIR && CC="ccache gcc" ../configure # No --with-pydebug
Debug builds have significant overhead that distorts performance measurements. However, do not use --enable-optimizations unless explicitly asked—it enables PGO (Profile-Guided Optimization) which is slow to compile. Non-PGO release builds are sufficient for the majority of performance comparison work.
# Build using all CPU cores (initial or incremental)
make -C $BUILD_DIR -j $(nproc)
Platform notes:
BUILT_PY=$BUILD_DIR/pythonBUILT_PY=$BUILD_DIR/python.exe (note .exe extension)After editing .c files that change function signatures, docstrings, or argument specs:
make -C $BUILD_DIR clinic
NEVER edit files in **/clinic/** subdirectories - they're auto-generated.
$BUILT_PY --version
$BUILT_PY -c "print('Hello from CPython!')"
make clean in BUILD_DIR and rebuildmake -C $BUILD_DIR clinicrm -rf $BUILD_DIR && mkdir $BUILD_DIR && cd $BUILD_DIR && CC="ccache gcc" ../configure --with-pydebug && make -j $(nproc) (omit CC=... if ccache unavailable)Critical rules:
pytest - CPython tests are unittest based--match not -k for filtering - takes a glob pattern (this is not pytest!)Prerequisite: BUILT_PY=build/python or build/python.exe
# Single test module (recommended - proper discovery, parallel execution)
$BUILT_PY -m test test_zipfile -j $(nproc)
# Multiple modules
$BUILT_PY -m test test_csv test_json -j $(nproc)
# Direct execution (quick but may miss test packages)
$BUILT_PY Lib/test/test_csv.py
# Specific test by glob pattern (use --match, NOT -k!)
$BUILT_PY -m test test_zipfile --match "*large*" -j $(nproc)
$BUILT_PY -m test test_csv --match "TestDialect*"
$BUILT_PY -m test test_json --match "TestEncode.test_encode_string"
# Full test suite (ASK FIRST - takes significant time!)
make -C $BUILD_DIR test
# Useful flags: -v (verbose), -f (fail fast), --timeout 120 (detect hangs), --list-tests, --help
Test packages (directories like test_asyncio/) require load_tests() in __init__.py to work with python -m test.
# Collect coverage (uses trace mechanism via libregrtest)
$BUILT_PY -m test --coverage test_csv test_json --coveragedir .claude/coverage/ -j $(nproc)
# Reports go to specified coveragedir
For interactive debugging (pdb/lldb/gdb) or testing REPL features: Control a tmux session.
Add breakpoint() in test code, then run with -v for verbose output.