Skip to content

Method used to build prompts under the hood does not allow for full format customization #2875

Description

@AdamPiotrowski91

Currently method _build_prompt is implemented in very opinionated way regarding formatting how to display choices or default value. Considering how good of a job the rest of the features do in regards to potential extensions and customizations, I am surprised that the best way I found to customize this method is to overwrite it before use, for example as follows:

import click

def my_own_build_prompts(*args, **kwargs):
    pass

click.termui._build_prompt = my_own_build_prompts

Even though it is "technically" possible to override, I'd argue the fact that in order to find it I had to dig deep into codebase and find the details of implementation feels "hacky" and "not intended" - and for sure error prone and not future-proof.

I am very happy to contribute and implement the solution, but I'd rather hear some opinions from the library owners beforehand whether this is something they'd find valuable.

Activity

  1. Rowlando13 commented on Apr 11, 2025

    @Rowlando13
    Member

    In general, I am open to new community sourced ideas, and I appreciate the effort you put into this. However, Click is so widely used, that I would like to have more comprehensive docs and better test coverage before anything major is added, unless there is very clear community support. I will continue to keep an eye on this to see if it gathers community support.

  2. added
    promptInteractive input and confirmation
    and removed on Aug 8, 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

    promptInteractive input and confirmation

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions