Skip to content

Click Processing Pipeline Rewrite #590

Open

Description

@mitsuhiko

Click evolved unfortunately really badly the last two releases because the internal logic just grew too complex and it's totally not sound. This needs to be cleaned up but I'm not yet sure how.

Click needs to somehow become a pipeline that is clearly separated to be able to work better. Starting with parsing, handling of value callbacks and then invoking the callbacks. Maybe we need to split this pipeline into more steps where we can have args that are not yet processed by callbacks somehow?

Some effects of the current broken handling:

Activity

  1. mitsuhiko commented on May 26, 2016

    @mitsuhiko
    ContributorAuthor

    I'm not entirely sure how we ended up on this point but it was probably a bad design from the start and it got more and more eroded over time. I will need to write down the exact effects this causes but essentially we badly mix parsing with invoking so if something needs to "inverse" the order things get really out of hand. For instance --help internally is a huge hack right now. This also shows up in a few situations now outside as people have discovered.

    • As an example chain commands broke so bad in 6.x that they cannot accept arguments any more.
    • Flask's --app option is not processed for the default help rendering (removed now in Flask)
    • You cannot reliably implement --config flags that can override some settings that might affect the execution of Click because there is no good hook point.
    • Because we invoke parent commands before the subcommand but the separation is not clear there are some really odd effects where arguments might or might not be available to them on the context.
  2. added this to the 9.0.0 milestone on Aug 13, 2020
  3. removed this from the 8.1.0 milestone on Feb 21, 2022
  4. self-assigned this
    on Jun 17, 2022
  5. added
    parsingParsing, parameters, commands, chaining, context
    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

Labels

parsingParsing, parameters, commands, chaining, context

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions