GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Fix `package_name` resolution when module differs from distribution name by kdeldycke · Pull Request #3582 · pallets/click

Conversation

@kdeldycke

@kdeldycke kdeldycke commented Jun 11, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

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 https://github.com/pallets/click/discussions/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:

  • version_option doesn't automatically detect version anymore with click 8.0.0 #1884
  • version_option module name and package name are not equivalent #2331
  • version_option ignores package_name #3125

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@kdeldycke kdeldycke added the f:parameters label Jun 11, 2026
@kdeldycke kdeldycke added this to the 8.4.2 milestone Jun 11, 2026
@kdeldycke
kdeldycke force-pushed the fix-version-option-detection branch from 002b282 to ce308a9 Compare June 11, 2026 06:11
This was linked to issues Jun 11, 2026
version_option ignores package_name #3125
Closed
version_option module name and package name are not equivalent #2331
Closed
version_option doesn't automatically detect version anymore with click 8.0.0 #1884
Closed
This was referenced Jun 11, 2026
version_option doesn't automatically detect version anymore with click 8.0.0 #1884
Closed
version_option ignores package_name #3125
Closed
version_option module name and package name are not equivalent #2331
Closed
@kdeldycke kdeldycke added the bug label Jun 11, 2026
kdeldycke added a commit to kdeldycke/click-extra that referenced this pull request Jun 11, 2026
@kdeldycke
Fix package_version resolution when top-level module differs from d…
a6c8a01
…istribution name

Refs: pallets/click#3582
@kdeldycke
Fix package_name resolution when top-level module differs from dist…
bec5928
…ribution name

Refs: pallets#1884 pallets#2331 pallets#3125
@kdeldycke
kdeldycke force-pushed the fix-version-option-detection branch from ce308a9 to bec5928 Compare June 14, 2026 04:55
@kdeldycke

kdeldycke commented Jun 14, 2026

Copy link
Copy Markdown
Collaborator Author

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Rowlando13
Rowlando13 merged commit 7a16b20 into pallets:stable Jun 14, 2026
11 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@kdeldycke
kdeldycke deleted the fix-version-option-detection branch June 15, 2026 03:16
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Jul 25, 2026
@kdeldycke kdeldycke added parsing Parsing, parameters, commands, chaining, context and removed f:parameters labels Aug 8, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

parsing Parsing, parameters, commands, chaining, context

Projects

None yet

Milestone

8.4.2

Development

Successfully merging this pull request may close these issues.

version_option ignores package_name version_option module name and package name are not equivalent version_option doesn't automatically detect version anymore with click 8.0.0

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@kdeldycke @Rowlando13
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.