# pallets/click

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/pallets-click).**

17,306 stars · 1,571 forks · Python · bsd-3-clause

## Links

- GitHub: https://github.com/pallets/click
- Homepage: https://click.palletsprojects.com
- awesome-repositories: https://awesome-repositories.com/repository/pallets-click.md

## Topics

`cli` `click` `pallets` `python`

## Description

Click is a Python framework for building command-line interfaces. It provides a declarative approach to defining command structures, allowing developers to map functions to command-line arguments, options, and nested groups using decorators. The framework handles the complexities of parameter parsing, type validation, and help documentation generation automatically.

The project distinguishes itself through its hierarchical context system, which propagates configuration and state across nested commands, and its environment-aware parameter resolution that prioritizes command-line inputs, environment variables, and interactive prompts. It includes native support for shell completion, allowing for context-aware suggestions, and provides a robust terminal toolkit for handling interactive user input, progress bars, and styled output.

Beyond core parsing, the framework offers extensive utilities for file system management, cross-platform stream handling, and terminal interaction. It supports complex execution lifecycles, including lazy command loading, custom error handling, and programmatic subcommand invocation, while providing built-in tools for testing command-line interfaces in isolated environments.

## Tags

### Development Tools & Productivity

- [CLI Frameworks](https://awesome-repositories.com/f/development-tools-productivity/cli-frameworks.md) — A library for building complex command-line interfaces with automatic help generation, parameter parsing, and nested command groups.
- [Frameworks](https://awesome-repositories.com/f/development-tools-productivity/command-line-interfaces/frameworks.md) — Building complex, nested command-line tools with automatic help generation, parameter validation, and support for environment variable configuration.
- [CLI Command Frameworks](https://awesome-repositories.com/f/development-tools-productivity/cli-command-frameworks.md) — Constructs command-line tools by decorating functions to handle parsing, help generation, and nesting. ([source](https://click.palletsprojects.com/api/))
- [Command Line Parsers](https://awesome-repositories.com/f/development-tools-productivity/command-line-parsers.md) — A tool that maps command-line arguments, flags, and environment variables to function parameters with built-in type validation.
- [Help Text Generators](https://awesome-repositories.com/f/development-tools-productivity/help-text-generators.md) — Automatically generates formatted help pages and usage instructions based on command structure and docstrings. ([source](https://click.palletsprojects.com))
- [Environment Variable Configuration](https://awesome-repositories.com/f/development-tools-productivity/command-argument-parsers/environment-variable-configuration.md) — Resolves parameter values by prioritizing command-line arguments, environment variables, and interactive prompts.
- [Shell Integration](https://awesome-repositories.com/f/development-tools-productivity/terminal-shell-cli/terminal-cli-enhancements/shell-terminal-utilities/automation-integration-tools/shell-integration.md) — Integrates natively with shell environments to suggest commands, options, and arguments during terminal input. ([source](https://click.palletsprojects.com))
- [Nested Command Structures](https://awesome-repositories.com/f/development-tools-productivity/cli-command-frameworks/nested-command-structures.md) — Combines multiple independent command line utilities into a single hierarchical interface. ([source](https://click.palletsprojects.com/complex/))
- [CLI Argument Definitions](https://awesome-repositories.com/f/development-tools-productivity/command-argument-parsers/cli-argument-definitions.md) — Attaches options and arguments to commands to capture user input with type conversion and default values. ([source](https://click.palletsprojects.com/api/))
- [Named Option Definitions](https://awesome-repositories.com/f/development-tools-productivity/command-options/named-option-definitions.md) — Configures command-line arguments by mapping flags to function parameters with automatic name inference. ([source](https://click.palletsprojects.com/options/))
- [Environment Variable Mapping](https://awesome-repositories.com/f/development-tools-productivity/environment-variable-mapping.md) — Automatically populates command parameters from environment variables when command-line arguments are missing. ([source](https://click.palletsprojects.com/arguments/))
- [Execution Context Management](https://awesome-repositories.com/f/development-tools-productivity/execution-context-management.md) — Maintains a shared hierarchical object that propagates configuration and runtime state across nested command groups. ([source](https://click.palletsprojects.com/commands-and-groups/))
- [Interactive Prompts](https://awesome-repositories.com/f/development-tools-productivity/human-in-the-loop-interfaces/interactive-prompts.md) — Requests missing or sensitive information from users during execution through secure, interactive terminal prompts. ([source](https://click.palletsprojects.com))
- [Progress Indicators](https://awesome-repositories.com/f/development-tools-productivity/progress-indicators.md) — Displays an interactive progress indicator in the terminal to track the status of long-running tasks. ([source](https://click.palletsprojects.com/utils/))
- [Shell Completion Generators](https://awesome-repositories.com/f/development-tools-productivity/shell-completion-generators.md) — A system that provides native shell integration to suggest commands, options, and arguments to users as they type.
- [Version Information](https://awesome-repositories.com/f/development-tools-productivity/version-information.md) — Provides a standard command-line flag to display the application version and exit immediately. ([source](https://click.palletsprojects.com/option-decorators/))
- [Global Command Registration](https://awesome-repositories.com/f/development-tools-productivity/cli-command-frameworks/global-command-registration.md) — Registers functions as system-level commands during package installation for direct terminal access. ([source](https://click.palletsprojects.com/entry-points/))
- [Cross-Platform Console Tooling](https://awesome-repositories.com/f/development-tools-productivity/cross-platform-console-tooling.md) — Developing terminal applications that maintain consistent behavior, Unicode support, and file stream handling across different operating systems.
- [Shell Completion Providers](https://awesome-repositories.com/f/development-tools-productivity/shell-completion-providers.md) — Provides custom completion sources for specific parameters to enable context-aware shell suggestions. ([source](https://click.palletsprojects.com/shell-completion/))
- [Programmatic Command Invokers](https://awesome-repositories.com/f/development-tools-productivity/cli-command-extensions/programmatic-command-invokers.md) — Allows executing one command from within another by passing arguments explicitly or forwarding context state. ([source](https://click.palletsprojects.com/advanced/))
- [Command Callbacks](https://awesome-repositories.com/f/development-tools-productivity/cli-command-frameworks/command-callbacks.md) — Triggers custom logic after command line arguments are parsed and converted to ensure callbacks receive processed values. ([source](https://click.palletsprojects.com/click-concepts/))
- [Command Chaining](https://awesome-repositories.com/f/development-tools-productivity/cli-command-frameworks/command-chaining.md) — Supports executing a sequence of subcommands in a single invocation. ([source](https://click.palletsprojects.com/commands/))
- [Eager Parameter Execution](https://awesome-repositories.com/f/development-tools-productivity/cli-command-frameworks/eager-parameter-execution.md) — Triggers immediate program termination or specific actions after processing flags like help or version. ([source](https://click.palletsprojects.com/advanced/))
- [CLI Extensions](https://awesome-repositories.com/f/development-tools-productivity/cli-extensions.md) — Integrates third-party packages to add features like advanced formatting and complex option grouping to command line interfaces. ([source](https://click.palletsprojects.com/contrib/))
- [Command Lifecycle Managers](https://awesome-repositories.com/f/development-tools-productivity/command-lifecycle-managers.md) — Registers cleanup functions to ensure external resources are safely closed when command execution finishes. ([source](https://click.palletsprojects.com/advanced/))
- [Command Line Applications](https://awesome-repositories.com/f/development-tools-productivity/command-line-interfaces/command-line-applications.md) — Executes command line applications within test environments to capture exit codes and standard streams. ([source](https://click.palletsprojects.com/testing/))
- [Mandatory Parameter Enforcement](https://awesome-repositories.com/f/development-tools-productivity/command-options/mandatory-parameter-enforcement.md) — Enforces data type constraints on command inputs to ensure correct parsing and descriptive help documentation. ([source](https://click.palletsprojects.com/parameters/))
- [Exit Status Reporters](https://awesome-repositories.com/f/development-tools-productivity/exit-status-reporters.md) — Returns specific status codes to the operating system based on command success or user input errors. ([source](https://click.palletsprojects.com/exceptions/))
- [Boolean Flag Generators](https://awesome-repositories.com/f/development-tools-productivity/flag-definitions/boolean-flag-generators.md) — Generates toggleable boolean flags with support for explicit on/off pairs and custom values. ([source](https://click.palletsprojects.com/options/))
- [Parameter Metadata Displayers](https://awesome-repositories.com/f/development-tools-productivity/help-generators/parameter-metadata-displayers.md) — Displays default values, environment variable requirements, and custom meta-variables within generated help output. ([source](https://click.palletsprojects.com/documentation/))
- [Command Aliasing](https://awesome-repositories.com/f/development-tools-productivity/cli-command-frameworks/command-aliasing.md) — Maps shortened or alternative names to existing commands by intercepting command resolution. ([source](https://click.palletsprojects.com/extending-click/))
- [Result Callbacks](https://awesome-repositories.com/f/development-tools-productivity/cli-command-frameworks/command-callbacks/result-callbacks.md) — Bubbles command output values up to the caller or a result callback. ([source](https://click.palletsprojects.com/commands/))
- [Command Group Overrides](https://awesome-repositories.com/f/development-tools-productivity/cli-command-frameworks/command-group-overrides.md) — Extends command group behavior by overriding core methods for dynamic loading or aliasing. ([source](https://click.palletsprojects.com/extending-click/))
- [Pipeline Processors](https://awesome-repositories.com/f/development-tools-productivity/cli-command-frameworks/pipeline-processors.md) — Collects and transforms data across chained commands by passing state through context objects. ([source](https://click.palletsprojects.com/commands/))
- [Command Argument Parsers](https://awesome-repositories.com/f/development-tools-productivity/command-argument-parsers.md) — Handles command-line string parsing, including support for argument escaping and literal flag processing. ([source](https://click.palletsprojects.com/arguments/))
- [Configuration Defaults](https://awesome-repositories.com/f/development-tools-productivity/configuration-defaults.md) — Injects dynamic default values for command options from external configuration files. ([source](https://click.palletsprojects.com/commands/))
- [Help Trigger Aliases](https://awesome-repositories.com/f/development-tools-productivity/help-generators/help-trigger-aliases.md) — Defines custom flags or aliases to invoke help documentation for better interface compatibility. ([source](https://click.palletsprojects.com/documentation/))
- [Terminal Output Stylers](https://awesome-repositories.com/f/development-tools-productivity/terminal-output-stylers.md) — Prints text to the terminal with automatic encoding handling, color support, and stream redirection. ([source](https://click.palletsprojects.com/api/))

### Web Development

- [Command-Line Interface Mappings](https://awesome-repositories.com/f/web-development/routing-systems/routing/decorator-based-route-mappings/command-line-interface-mappings.md) — Maps command-line arguments and options to executable code using function decorators.
- [Input Converters](https://awesome-repositories.com/f/web-development/type-safe-schema-validations/input-converters.md) — Applies automatic conversion and constraint checking to inputs based on defined data types.
- [Lazy Loading Strategies](https://awesome-repositories.com/f/web-development/performance-optimizations/lazy-loading-strategies.md) — Defers the loading of command definitions until runtime to improve performance and reduce startup time. ([source](https://click.palletsprojects.com/complex/))
- [Choice Fields](https://awesome-repositories.com/f/web-development/choice-fields.md) — Validates command-line arguments against predefined sets of allowed values with case-insensitive matching. ([source](https://click.palletsprojects.com/parameter-types/))

### Software Engineering & Architecture

- [Context Object Passing](https://awesome-repositories.com/f/software-engineering-architecture/software-architecture/architectural-patterns/layering-presentation/state-management-patterns/context-object-passing.md) — Propagates configuration and runtime state across nested command groups using a shared hierarchical object. ([source](https://click.palletsprojects.com/complex/))
- [CLI Exception Handlers](https://awesome-repositories.com/f/software-engineering-architecture/error-handling/exception-logic-structures/exception-handling-strategies/cli-exception-handlers.md) — Intercepts and formats command-line errors for user display while allowing custom error management. ([source](https://click.palletsprojects.com/exceptions/))
- [Stream Abstractions](https://awesome-repositories.com/f/software-engineering-architecture/stream-abstractions.md) — Wraps standard input and output streams with platform-agnostic logic for consistent encoding and behavior.
- [Parameter Range Definitions](https://awesome-repositories.com/f/software-engineering-architecture/configuration-state-managers/parameter-range-definitions.md) — Enforces minimum and maximum bounds on numeric inputs with optional value clamping. ([source](https://click.palletsprojects.com/parameter-types/))
- [Error Handling](https://awesome-repositories.com/f/software-engineering-architecture/error-handling.md) — Provides mechanisms to disable automatic exception handling for manual control over command invocation and error propagation. ([source](https://click.palletsprojects.com/exceptions/))

### Graphics & Multimedia

- [Terminal Interaction](https://awesome-repositories.com/f/graphics-multimedia/immersive-interactive-systems/user-interaction/terminal-interaction.md) — Creating interactive command-line applications that prompt for sensitive input, display progress bars, and handle real-time user keystrokes.

### Testing & Quality Assurance

- [CLI Testing Tools](https://awesome-repositories.com/f/testing-quality-assurance/general-testing-utilities/test-utilities-assertions/test-scope-harnesses/cli-testing-tools.md) — Verifying command-line tool behavior by isolating execution environments, capturing output, and simulating user input for automated testing workflows. ([source](https://click.palletsprojects.com/api/))

### Data & Databases

- [CLI Type Converters](https://awesome-repositories.com/f/data-databases/custom-type-converters/cli-type-converters.md) — Allows defining custom parameter types with specialized validation and transformation logic for command-line inputs. ([source](https://click.palletsprojects.com/parameter-types/))

### User Interface & Experience

- [Input Validation Utilities](https://awesome-repositories.com/f/user-interface-experience/input-validation-utilities.md) — Verifies and transforms user-provided values after type conversion, raising formatted errors for invalid input. ([source](https://click.palletsprojects.com/advanced/))
- [Terminal UI Components](https://awesome-repositories.com/f/user-interface-experience/terminal-ui-components.md) — A collection of utilities for handling interactive prompts, progress bars, colored output, and cross-platform terminal stream management.
- [Sensitive Input Prompts](https://awesome-repositories.com/f/user-interface-experience/masked-inputs/sensitive-input-prompts.md) — Collects user input while masking characters on the screen and requiring secondary confirmation. ([source](https://click.palletsprojects.com/option-decorators/))
- [User Confirmation Dialogs](https://awesome-repositories.com/f/user-interface-experience/user-confirmation-dialogs.md) — Asks the user for a boolean confirmation before proceeding with an action, with automatic abort capabilities. ([source](https://click.palletsprojects.com/prompts/))

### Artificial Intelligence & ML

- [Parameter Source Tracking](https://awesome-repositories.com/f/artificial-intelligence-ml/model-parameters/parameter-inspection-utilities/parameter-source-tracking.md) — Resolves parameter values by checking prompts, arguments, and environment variables in a defined order of precedence. ([source](https://click.palletsprojects.com/commands-and-groups/))

### Programming Languages & Runtimes

- [File Stream Management](https://awesome-repositories.com/f/programming-languages-runtimes/file-stream-management.md) — Opens files for reading or writing with automatic lifecycle management and support for standard stream redirection. ([source](https://click.palletsprojects.com/parameter-types/))

### DevOps & Infrastructure

- [Native Binary Packagers](https://awesome-repositories.com/f/devops-infrastructure/native-binary-packagers.md) — The CLI framework bundles an interpreter and project dependencies into a standalone executable or installer for major operating systems to eliminate external environment requirements. ([source](https://click.palletsprojects.com/standalone-apps/))

### Operating Systems & Systems Programming

- [Configuration Directory Resolvers](https://awesome-repositories.com/f/operating-systems-systems-programming/system-administration-maintenance/file-system-management/file-system-utilities/configuration-directory-resolvers.md) — Identifies standard, platform-specific directories for storing application configuration files. ([source](https://click.palletsprojects.com/utils/))
- [Path Validation Utilities](https://awesome-repositories.com/f/operating-systems-systems-programming/system-administration-maintenance/file-system-management/file-system-utilities/path-validation-utilities.md) — Verifies file system paths by checking for existence and access permissions while providing user-friendly error messages. ([source](https://click.palletsprojects.com/handling-files/))

### System Administration & Monitoring

- [Terminal Input Interceptors](https://awesome-repositories.com/f/system-administration-monitoring/terminal-input-interceptors.md) — Reads individual keystrokes from the terminal buffer immediately to enable real-time user interaction. ([source](https://click.palletsprojects.com/utils/))
