Emit Claude Code plugin hint at module load time - #1867
Merged
Conversation
xavdid
approved these changes
Aug 6, 2026
Committed-By-Agent: claude
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why?
Claude Code supports a plugin hint protocol: if an SDK writes a specific XML tag to stderr at import time, Claude Code picks it up and loads the associated plugin automatically. Adding this hint to stripe-python means any user running Claude Code against Python code that imports stripe will get the Stripe plugin loaded without any manual setup.
What?
_claude_code_hint()and_emit_claude_code_hint()tostripe/_util.py. Both are internal and not re-exported from the package._emit_claude_code_hint()fromstripe/__init__.pyat module load time, just before the generated section. Gated onCLAUDECODEorCLAUDE_CODE_CHILD_SESSIONbeing set, wrapped in try/except so it can never raise.TestEmitClaudeCodeHinttotests/test_util.pywith three cases: emits onCLAUDECODE, emits onCLAUDE_CODE_CHILD_SESSION, silent when neither is set.assert_outputintests/test_exports.pyto strip the hint line from stderr before asserting it's clean, so existing import tests pass whether or not Claude env vars are set in the outer process (for example, if a Stripe is editing this SDK using Claude Code).See Also
Changelog