GitHub
10/26/2026, 5:05 PMwarnings.warn) were routed through logging.captureWarnings, producing a single raw string containing the file path, category and trailing source line, with no structured fields. This replaces it with a warnings.showwarning hook that logs through structlog under the py.warnings logger, with the message as the event and category, filename and lineno as separate fields.
Before (JSON): {"event": "/…/canonical.py:86: DeprecationWarning: The 'version' field …\n instance = super().__call__(…)\n", …}
After (JSON): {"event": "The 'version' field …", "category": "DeprecationWarning", "filename": "…/canonical.py", "lineno": 86, "level": "warning", …}
Checklist
• I have read the contribution guide
Was generative AI tooling used to co-author this PR?
• Yes (please specify the tool below)
Generated-by: Claude Code following the agentic coding guidelines
Related Issues
• N/A
Summary by Sourcery
Replace raw Python warning text with structured py.warnings log events throughout the CLI.
New Features:
• Log Python warnings through structlog as structured events with separate category, filename, and line-number fields.
Enhancements:
• Install the warning capture hook during CLI initialization so warnings emitted during imports are structured consistently.
• Preserve standard warning formatting when callers provide an explicit output stream.
Tests:
• Add coverage for structured warning events and explicit-stream warning output.
meltano/meltanoGitHub
10/26/2026, 5:15 PM