CLI Command Parser is a class-based CLI argument parser that defines parameters with descriptors. It provides the tools to quickly and easily get started with basic CLIs, and it scales well to support even very large and complex CLIs while remaining readable and easy to maintain.
- Some of the primary goals and key features of this project:
- Minimal boilerplate code is necessary to define CLI parameters and access their parsed values
- Easy to use type annotations for CLI parameters
- Subcommands can inherit common parameters so they don't need to be repeated
- Easy to handle common initialization tasks for all actions / subcommands once
from cli_command_parser import Command, Option, main
class Hello(Command, description='Simple greeting example'):
name = Option('-n', default='World', help='The person to say hello to')
count: int = Option('-c', default=1, help='Number of times to repeat the message')
def main(self):
for _ in range(self.count):
print(f'Hello {self.name}!')
if __name__ == '__main__':
main()$ hello_world.py --name Bob -c 3
Hello Bob!
Hello Bob!
Hello Bob!
$ hello_world.py -h
usage: hello_world.py [--name NAME] [--count COUNT] [--help]
Simple greeting example
Optional arguments:
--name NAME, -n NAME The person to say hello to (default: 'World')
--count COUNT, -c COUNT Number of times to repeat the message (default: 1)
--help, -h Show this help message and exit
CLI Command Parser can be installed and updated via pip:
$ pip install -U cli-command-parser
There are no required dependencies. Support for formatting wide characters correctly in help text descriptions can be included by adding wcwidth to your project's requirements, and/or by installing with optional dependencies:
$ pip install -U cli-command-parser[wcwidth]
Python versions 3.10 and above are currently supported. The last release of CLI Command Parser that supported 3.9 was 2025-09-27. Support for Python 3.9 officially ended on 2025-10-31.
- Documentation: https://dskrypa.github.io/cli_command_parser/
- Example Scripts: https://github.com/dskrypa/cli_command_parser/tree/main/examples
- PyPI Releases: https://pypi.org/project/cli-command-parser/
- Source Code: https://github.com/dskrypa/cli_command_parser
- Issue Tracker: https://github.com/dskrypa/cli_command_parser/issues