Skip to content

fix(compat): walk single-underscore Python module files#78

Merged
gjtorikian merged 1 commit into
mainfrom
fix-python-private-module-skip
May 18, 2026
Merged

fix(compat): walk single-underscore Python module files#78
gjtorikian merged 1 commit into
mainfrom
fix-python-private-module-skip

Conversation

@gjtorikian
Copy link
Copy Markdown
Collaborator

Summary

  • The Python extractor's file walker skipped any .py file whose name starts with _ (except __init__.py), treating them as private. But workos-python puts every service's public methods in _resource.py and re-exports them via __init__.py — so the entire service surface was invisible to the differ.
  • Result: spec changes that removed/added service kwargs (e.g. dropping Authorization.listResources.search in openapi-spec#23) showed 0 breaking changes for Python while every other language correctly flagged them.
  • Narrow the skip to dunder-prefixed files (__foo.py), matching Python's actual convention for name-mangled internals. Single-underscore files now get walked.

Test plan

  • New fixture sample-sdk-python/src/workos/widgets/_resource.py exercises the _resource.py re-export pattern with a service method that has a search kwarg.
  • New test asserts Widgets.list_widgets and its params are extracted.
  • Full compat suite: 553/553 passing locally.

🤖 Generated with Claude Code

The Python extractor's file walker skipped any `.py` file starting with
`_` (except `__init__.py`), treating them as private modules. workos-python
puts every service's public methods in `_resource.py` (re-exported via
`__init__.py`), so the walker silently ignored the entire service surface —
e.g. PR diffs that removed an Authorization kwarg showed 0 breaking changes
for Python while every other language flagged it.

Narrow the skip to dunder-prefixed files (`__foo.py`), which matches Python
convention for truly name-mangled internals. Single-underscore files now
get parsed.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@gjtorikian gjtorikian merged commit 347f2ad into main May 18, 2026
5 checks passed
@gjtorikian gjtorikian deleted the fix-python-private-module-skip branch May 18, 2026 17:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant