Make inline dependency declaration a hard contract rule (WI-005)#8
Merged
Conversation
The output contract instructed PEP 723 only as a parenthetical example, so weaker models (verified with openai:gpt-4o) emitted non-stdlib imports with no inline metadata — producing files that are single but not self-contained. Promote it to an explicit MUST with a worked PEP 723 example. Re-running the same requests/pandas tasks now yields correct `# /// script` dependency blocks, satisfying the "single self-contained file" verification case. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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.
What
Promotes the output contract's PEP 723 instruction from a parenthetical example to an explicit MUST, with a worked dependency-block example.
Why
Closing WI-005 required live verification of the "single self-contained file" case. Testing against the shipped Pydantic-AI backend (
openai:gpt-4o) showed the model emitting non-stdlib imports (requests,pandas) with no PEP 723 block — two-for-two. The files were single but not self-contained:uv runwould fail without manual installs.Root cause: the contract only hinted at PEP 723 in a parenthetical. After this change, re-running the identical tasks produces correct inline metadata:
dependencies = ["requests"]dependencies = ["requests", "pandas"]The companion case ("model chooses platform-appropriate language") passed as-is — bash for shell tasks, Python otherwise.
Verification
🤖 Generated with Claude Code