Skip to content

ParamType.get_metavar has a new mandatory argument in 8.2.0 #2908

@peterdragun

Description

@peterdragun

I am using the get_metavar function to generate a custom metavar for some types. This was working fine, but upgrading Click to 8.2.0 broke our script. Unlike some other functions (e.g., get_missing_message), this is not even mentioned in the documentation that such a parameter was introduced. See (docs link):

Image

Overall, such changes to the public documented API should not add mandatory parameters because that is adding breaking changes into a minor release. I get that this was added to enable a new feature, but I think you should consider using it as an optional parameter, which still adds a benefit of a new feature, while not introducing breaking changes to the public API.

Steps to reproduce:

  1. Use click 8.1.x
  2. Call get_metavar to get some custom metavar (get_metavar has one parameter - param)
  3. Update to 8.2.0
  4. CLI crashes because a new mandatory parameter was introduced

Expected behavior:

No breaking changes to the public API in minor release, and better document the new parameter as you do for other functions.

Environment:

  • Python version: 3.13
  • Click version: 8.2.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions