Skip to content

Choice autocomplete incorrect for enums #3015

Closed

Description

@berndbohmeier

When using enums, the autocomplete doesn't give a value that works, as it doesn't use the same code to normalize.

Use an enum like

import enum

class MyEnum(enum.Enum):
    foo = "bar"

with

@click.choice(MyEnum)

The accepted value for the argument will be "foo", but the autocompleted value is "MyEnum.foo"

Environment:

  • Python version: 3.13.4
  • Click version: 8.2.1

I think I know how to fix it roughly, so I can open a PR.

Activity

  1. added a commit that references this issue on Mar 19, 2026
    94db5a4
  2. added this to the 8.4.1 milestone on May 18, 2026
  3. kdeldycke commented on May 22, 2026

    @kdeldycke
    Collaborator

    Has been addressed in #3471

  4. locked as resolved and limited conversation to collaborators on Jul 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    shell completion

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions