Keep listed names that exist at runtime without a visible binding - #61
Merged
hakancelikdev merged 2 commits intoSep 25, 2026
Merged
hakancelikdev merged 2 commits into
hakancelikdev merged 2 commits into
Conversation
These were removed from __all__, so `from m import *` silently lost them: - submodules listed in a package's __init__.py, which the star import loads - names served by a module __getattr__ (PEP 562) - names added through globals() / vars() or @enum.global_enum - match-statement captures, which were not seen as module bindings Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019P9bvuGwAyVCNUdsAYPB1V
…nto fix/keep-runtime-provided-names # Conflicts: # src/unexport/analyzer.py # src/unexport/session.py
hakancelikdev
merged commit Sep 25, 2026
befabb6
into
claude/issuelari-gorme-fpbbfd
26 checks passed
hakancelikdev
pushed a commit
that referenced
this pull request
Oct 2, 2026
- Bump the version to 0.5.0. - Date the changelog section and add the entries that were missing for #53, #54, #56, #57, #58, #60, #61 and #62. - Fix license_files: `file: LICENSE` is not a valid glob, so LICENSE was left out of the built sdist and wheel. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019P9bvuGwAyVCNUdsAYPB1V
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.
From the second review of the integration branch. These names were removed from
__all__(onmainas well), sofrom m import *silently lost them. That contradicts the rule added in #47: names already listed that still exist are kept.Cases
__init__.pyfrom pkg import *imports listed submodules (importlib._handle_fromlist)xml/__init__.py__getattr__(PEP 562)concurrent.futures,typing,zoneinfoglobals().update(...),vars(),@enum.global_enumre,calendar,inspectmatchcaptures (case (Cap,):,**rest)strnotast.NameFix
Analyzer/Session.get_expected_alltake an optionalpath, andmainpasses it. For a package's__init__.py, sibling*.pymodules and subdirectories are collected assubmodules._ModuleBindings.has_dynamic_namespaceis set by a module-leveldef __getattr__, or by anyglobals/vars/global_enumreference. In that case every listed name is kept, the same as with a star import.collect.Tests
test_names_provided_at_runtime_are_kept(4 sub-cases) andtest_listed_submodules_of_a_package_are_keptboth fail before this change. I also checked end to end with the review's package repro:pkg/__init__.pyis no longer changed. 3.10 / 3.12 / 3.14, pre-commit, mypy and the self-check all pass.🤖 Generated with Claude Code
https://claude.ai/code/session_019P9bvuGwAyVCNUdsAYPB1V
Generated by Claude Code