Skip to content

Fix package_name resolution when module differs from distribution name#3582

Merged
Rowlando13 merged 1 commit into
pallets:stablefrom
kdeldycke:fix-version-option-detection
Jun 14, 2026
Merged

Fix package_name resolution when module differs from distribution name#3582
Rowlando13 merged 1 commit into
pallets:stablefrom
kdeldycke:fix-version-option-detection

Conversation

@kdeldycke

@kdeldycke kdeldycke commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

There is an issue we glossed over when closing #2331: I analyzed the bug report as requiring a new slot/field to be added to the @version_option decorator. I promptly close the issue as we decided in #3527 to freeze @version_option.

But looking closely #2331 did not asked for a new module_name field. That was my suggestion on how to address the user request.

So reframing it, #2331 is a report that @version_option is producing a RuntimeError for users in some legitimate situations. This breaks the out-of-the-box experience of @version_option.

In fact, the limitation has been pointed out by @davidism a couple of years ago at #1884 (comment):

If someone figures out a way to get the distribution version from the entry point name with importlib.metadata, I'd welcome a PR to improve our detection, but from my experiments with it I was not able to find how to do it. For now, I'll update the changelog.

So this is a PR to implement that fix.

Addresses:

@kdeldycke
kdeldycke force-pushed the fix-version-option-detection branch from ce308a9 to bec5928 Compare June 14, 2026 04:55
@kdeldycke

Copy link
Copy Markdown
Collaborator Author

Just rebased this PR. It is ready to be merged to stable.

@Rowlando13
Rowlando13 merged commit 7a16b20 into pallets:stable Jun 14, 2026
12 checks passed
@kdeldycke
kdeldycke deleted the fix-version-option-detection branch June 15, 2026 03:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug f:parameters feature: input parameter types

Projects

None yet

2 participants