Python package for composable command line interfaces with as little code as necessary
open sourceBSD-3-Clauseself-hostablefree
Click (the Command Line Interface Creation Kit) is an open source Python package for building command line tools in a composable way with little code. You decorate functions with @click.command, @click.option and @click.argument, and Click parses the arguments, converts and validates parameter types, prompts for missing input and generates formatted help pages automatically. Commands nest arbitrarily into groups, subcommands can load lazily at runtime, and a context object passes state between them. It includes shell completion, file and path handling, colours and paging, prompts and confirmations, Unicode and Windows console support, and a test runner for invoking commands in tests. It's BSD-3-Clause licensed and maintained by Pallets, the community behind Flask.
Problems it solves
- build a command line tool in Python with options and subcommands
- argparse is too verbose for my Python CLI
- generate help pages automatically for my Python command line app
- nest subcommands in a Python CLI like git does
- add shell completion to a Python command line tool
- prompt the user for missing values in a Python CLI
- test my Python CLI commands without spawning processes
Features
- decorator-based commands, options and arguments
- arbitrary nesting of command groups
- lazy loading of subcommands
- automatic help page generation
- parameter types with conversion and validation
- prompts and confirmation
- shell completion
- file handling utilities
- context object for passing state
- Unicode and Windows console support
View 2 more
- testing utilities (CliRunner)
- extensible: custom parameter types and command classes
Capabilities
| Takes plugins | plan not known |
|---|---|
| Has official SDKs | plan not known |
