Skip to content

Sort help args to make them reproducible - #3728

Open
jspricke wants to merge 1 commit into
pallets:mainfrom
jspricke:reproducible_help
Open

Sort help args to make them reproducible#3728
jspricke wants to merge 1 commit into
pallets:mainfrom
jspricke:reproducible_help

Conversation

@jspricke

Copy link
Copy Markdown

get_help_option_names() uses a set which is not ordered.
The return value is used by mkdocs-click making the
mkdocs-doc package in Debian not reproducible:

https://reproduce.debian.net/all/unstable.html#mkdocs-doc

@davidism

Copy link
Copy Markdown
Member

I don't think the set or this simple sort are correct. We probably want to apply some specific order, such as long options then short options, or preserve the order they were originally specified. @kdeldycke I think you added this (and maybe I suggested the set in review, can't remember)? What do you think?

@kdeldycke

Copy link
Copy Markdown
Collaborator

I don't think the set or this simple sort are correct. We probably want to apply some specific order, such as long options then short options, or preserve the order they were originally specified. @kdeldycke I think you added this (and maybe I suggested the set in review, can't remember)? What do you think?

Ah yes, the sort proposed by @jspricke is the right idea. We want stability and predictability. And the set-based arithmetics implemented here 12 years ago (see c2e187b) is sound, but does not preserved order.

So the fix is to replicate the arithmetics, but with order preserving lists/tuples. It sounds like something I solved 2 years ago in #2811 / 70c673d when I added a test_iter_params_for_processing parametrized test to demonstrate the mangling of invocation and declaration orders.

I will amend this PR with something in the same spirit to speed up the process and have it reach the upcoming 8.5.0 release.

@kdeldycke kdeldycke added this to the 8.5.0 milestone Jul 31, 2026
@kdeldycke
kdeldycke changed the base branch from stable to main July 31, 2026 10:40
@kdeldycke kdeldycke added bug f:help feature: help text labels Jul 31, 2026
Co-authored-by: Jochen Sprickerhof <git@jochen.sprickerhof.de>
@kdeldycke
kdeldycke force-pushed the reproducible_help branch from accdfed to 047adef Compare July 31, 2026 11:28
@kdeldycke

Copy link
Copy Markdown
Collaborator

Just made the changes, this PR is ready to be merged.

@kdeldycke
kdeldycke requested review from Rowlando13 and davidism July 31, 2026 11:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug f:help feature: help text

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants