cmd2
cmd2 - quickly build feature-rich and user-friendly interactive command line applications in Python
Decision gist · record as of 2026-08-14
Yes. cmd2 is actively maintained, has low install friction, carries no security vulnerabilities, and uses a permissive MIT license. It is well-suited for any Python developer building interactive CLI applications that need tab completion, help generation, and scripting support. The framework is production-stable (Development Status 5) and supports current Python versions.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.11 or later.
- Low install friction with only 4 runtime dependencies (prompt-toolkit, pyperclip, rich, rich-argparse).
- Actively maintained with a release 8 days ago.
License · maintenance · safety
MIT (permissive) — MIT license permits commercial and private use with minimal restrictions—suitable for most projects without licensing concerns.
last release 2026-08-06 (8 days)
0 known vulnerabilities (OSV.dev, 2026-08-14) · 2,372,794 downloads/mo, #3,099 on PyPI
Alternatives
Verify before relying
pip install cmd2
import cmd2
class MyApp(cmd2.Cmd):
def do_hello(self, _: cmd2.Statement):
self.poutput('Hello')
if __name__ == '__main__':
MyApp().cmdloop()- Whether the framework supports subcommand hierarchies beyond what argparse provides.
- Performance characteristics when handling large command sets or high-frequency tab completion.
- Compatibility with async/await patterns in user-defined commands.
What it is and what it does
cmd2 extends Python's built-in cmd module to simplify building feature-rich interactive command-line applications. It provides automatic tab completion for commands, subcommands, file paths, and argparse-defined flags; rich help text generation; and scripting capabilities through text files and Python scripts. The framework is designed to bridge the gap between easy command discovery (via completion and help) and workflow automation (via aliases, macros, and scripting), making it suitable for both exploratory CLI tools and production automation systems.
The package depends on prompt-toolkit for terminal interaction, rich for colored output and formatting, rich-argparse for integrated argument help, and pyperclip for clipboard support. It has been actively maintained since 2008 and currently targets Python 3.11 and later, including free-threaded Python variants. With no known security vulnerabilities and a permissive MIT license, it is production-ready for developers building admin tools, interactive shells, or complex CLI workflows.
Use it for
- Build system administration tools with discoverable commands and tab completion for file paths and options.
- Create interactive debugging or diagnostic shells that support scripting and command history.
- Develop workflow automation CLIs that transition smoothly from interactive exploration to batch scripting.
- Implement interactive REPL-style applications for data analysis or configuration management.
- Build security or penetration testing frameworks with command aliasing and macro support.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
cmd2 is actively maintained, has low install friction, carries no security vulnerabilities, and uses a permissive MIT license. It is well-suited for any Python developer building interactive CLI applications that need tab completion, help generation, and scripting support. The framework is production-stable (Development Status 5) and supports current Python versions.
Install
cmd2 on PyPI
Before you install
Low install friction with only 4 runtime dependencies (prompt-toolkit, pyperclip, rich, rich-argparse). Actively maintained with a release 8 days ago. Supports current Python versions (3.11+) including free-threaded variants.
Requires Python 3.11 or later.
License in practice
MIT license permits commercial and private use with minimal restrictions—suitable for most projects without licensing concerns.
Quickstart
pip install cmd2
import cmd2
class MyApp(cmd2.Cmd):
def do_hello(self, _: cmd2.Statement):
self.poutput('Hello')
if __name__ == '__main__':
MyApp().cmdloop()
Verify before relying
- Whether the framework supports subcommand hierarchies beyond what argparse provides.
- Performance characteristics when handling large command sets or high-frequency tab completion.
- Compatibility with async/await patterns in user-defined commands.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.11 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 4 packagesprompt-toolkitpypercliprichrich-argparse |
| Maintenance | Actively maintained 8 days since the last release |
| First released | |
| Downloads | 2,372,794 / month, #3,099 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableEnvironment :: ConsoleIntended Audience :: DevelopersIntended Audience :: System AdministratorsOperating System :: OS IndependentProgramming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.15Programming Language :: Python :: Free Threading :: 3 - StableTopic :: Software Development :: Libraries :: Python Modules |
Evidence: cmd2-4.2.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “interactive command line framework”
- cmd2cmd2 is a Python framework for building interactive command-line…
- robotframework-debuglibraryProvides an interactive debug shell and library keywords for Robot…
- cliffcliff is a framework for building command-line programs that use…
Give your agent the search over MCP, or paste the wish link into any chat.
More Python Modules packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
PyYAML parses and emits YAML 1.1 data format, enabling serialization and deserialization of configuration files and Python objects to and from human-readable YAML text.
Pydantic validates Python data structures against type hints, coercing and checking input at runtime to ensure it matches a declared schema.
Provides reusable metadata objects for use with PEP-593 `typing.Annotated` to express common constraints like bounds, collection sizes, and predicates on types.
Install it if you use or build libraries that need to express type constraints in a standardized, inspectable way—or if you want to annotate your own types with…
Provides runtime tools to inspect and introspect Python type annotations, enabling programmatic examination of type hints at execution time.
See also click-shell · shtab · rich-toolkit · click · argcomplete · frida-tools · tabcompleter · argh · click-help-colors · iterm2