Skip to content

Conversation

@jsklan
Copy link
Contributor

@jsklan jsklan commented Jan 26, 2026

Description

Fixes duplicate imports in __init__.py when using additional_init_exports. When the same symbol was exported from both the regular types module and from additional_init_exports, the generator would produce duplicate imports causing F811 "Redefinition of unused" ruff errors, which caused generation to fail.

Link to Devin run: https://app.devin.ai/sessions/fa9ba4d562ab4d6ab3ebae66bef5c0de
Requested by: @jsklan ([email protected])

Changes Made

  • Added _deduplicate_exports method in module_manager.py that filters exports to ensure each symbol is only imported once
  • When the same symbol appears in both regular exports and additional_init_exports, the additional_init_exports version takes precedence
  • Added test fixture examples:additional_init_exports_with_duplicates demonstrating the fix
  • Updated versions.yml with version 4.50.1 changelog entry

Testing

  • Test fixture added that reproduces the duplicate export scenario
  • Verified generation succeeds with the fix applied
  • Lint checks pass (pnpm run check)

Human Review Checklist

  • Verify the deduplication logic correctly gives precedence to additional_init_exports (relies on registration order - later entries win in the all_exports dict)
  • Confirm the generated __init__.py in the fixture shows Actor, Actress, Movie imported only from .types.types (not duplicated from .types)

@devin-ai-integration
Copy link
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@devin-ai-integration devin-ai-integration bot changed the title fix(python-sdk): deduplicate additional_init_exports in __init__.py fix(python): deduplicate additional_init_exports in __init__.py Jan 26, 2026
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.

2 participants