Skip to content

Fix package_name resolution when module differs from distribution name#3582

Open
kdeldycke wants to merge 1 commit into
pallets:stablefrom
kdeldycke:fix-version-option-detection
Open

Fix package_name resolution when module differs from distribution name#3582
kdeldycke wants to merge 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 added the f:parameters feature: input parameter types label Jun 11, 2026
@kdeldycke kdeldycke added this to the 8.4.2 milestone Jun 11, 2026
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

1 participant