docs: py-spy 0.4.1 lacks Python 3.14 support; wrapper aborts early

Root cause of 'No python processes found in process <pid>': py-spy needs
per-release ABI knowledge and 0.4.1 (latest PyPI) predates 3.14. Wrapper
now detects the interpreter and points users at pyinstrument/memray/cProfile.
This commit is contained in:
2026-04-17 13:17:23 -04:00
parent 1a18377b0a
commit ba448bae13
2 changed files with 23 additions and 2 deletions

View File

@@ -13,6 +13,20 @@ if [[ -z "${PID}" ]]; then
exit 1
fi
PY_VER="$(python -c 'import sys; print(f"{sys.version_info[0]}.{sys.version_info[1]}")')"
if [[ "${PY_VER}" == "3.14" ]] || [[ "${PY_VER}" > "3.14" ]]; then
cat >&2 <<EOF
WARNING: py-spy 0.4.1 (latest on PyPI) does not yet support Python ${PY_VER}.
Attaching will fail with "No python processes found in process <pid>".
Use one of the other lenses for now:
DECNET_PROFILE_REQUESTS=true # pyinstrument, per-request flamegraphs
scripts/profile/memray-api.sh # memory allocation profiling
scripts/profile/cprofile-cli.sh <cmd> # deterministic CLI profiling
Track upstream: https://github.com/benfred/py-spy/releases
EOF
exit 2
fi
echo "Attaching py-spy to PID ${PID} for ${DURATION}s -> ${OUT}"
sudo py-spy record -o "${OUT}" -p "${PID}" -d "${DURATION}" --subprocesses
sudo .venv/bin/py-spy record -o "${OUT}" -p "${PID}" -d "${DURATION}" --subprocesses
echo "Wrote ${OUT}"