Skip to content

Reorder ParameterSource#3248

Open
kdeldycke wants to merge 1 commit intopallets:stablefrom
kdeldycke:reorder-parameter-source
Open

Reorder ParameterSource#3248
kdeldycke wants to merge 1 commit intopallets:stablefrom
kdeldycke:reorder-parameter-source

Conversation

@kdeldycke
Copy link
Collaborator

This reorder the ParameterSource enum by precedence, as suggested in #2879.

It brings an interesting property of being able to check if a value was explicitly provided with that kind of code:

        source = ctx.get_parameter_source("port")
        if source < click.ParameterSource.DEFAULT_MAP:
            ...  # value was explicitly set

Additionally, this PR:

  • change enum type from generic Enum to IntEnum
  • document the precedence in the Sphinx docs
  • expose ParameterSource to the package root

@kdeldycke kdeldycke changed the title Reorder ParameterSource from most to least explicit Reorder ParameterSource Mar 5, 2026
@kdeldycke kdeldycke force-pushed the reorder-parameter-source branch from c8306cf to 1f42ba5 Compare March 5, 2026 18:54
kdeldycke added a commit to kdeldycke/click-extra that referenced this pull request Mar 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant