prompt_toolkit

A pure-Python library for building powerful interactive command-line applications

Library
PyPI
v3.0.53
10,555stars
BSD 3-Clause License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
67/100Good
Development Activity56
Maintenance36
Community76
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
77/100Good
Architecture84
Code Quality82
Innovation80
Learning Curve62

prompt_toolkit is a pure-Python library for constructing rich, interactive command-line interfaces. It goes far beyond a GNU readline replacement: it supports syntax highlighting via Pygments lexers, advanced code completion, multi-line editing, both Emacs and Vi key bindings (including named registers and digraphs), mouse support, and auto-suggestions in the style of the fish shell. It powers well-known interactive tools including ptpython, the IPython shell, and pgcli, and its only runtime dependency is wcwidth, making it lightweight enough to embed in any CLI project.

What You Get

  • A full-screen and prompt-based application layer (prompt_toolkit.application, prompt_toolkit.shortcuts) for building anything from a single-line prompt to a full terminal UI
  • Pygments-backed syntax highlighting of input while typing, plus a styling system for themable terminal output
  • An extensible completion framework (prompt_toolkit.completion) supporting fuzzy, nested, and async completers for building rich autocomplete experiences
  • Both Emacs and Vi key-binding emulations, including advanced Vi features like named registers and digraphs
  • A widget toolkit (prompt_toolkit.widgets) with buttons, dialogs, text areas, and progress bars for building full-screen terminal UIs
  • Cross-platform input/output backends (prompt_toolkit.input, prompt_toolkit.output) abstracting terminal differences on Windows, Linux, and macOS

Common Use Cases

  • Building a REPL or interactive shell with syntax highlighting and history-aware autocompletion, as ptpython and IPython do
  • Adding a rich readline-style prompt with auto-suggestions and multi-line editing to a CLI tool, database client, or shell
  • Building a full-screen terminal dashboard or wizard using the widget toolkit and layout engine
  • Implementing Vi or Emacs-style modal editing inside a custom command-line tool

Under The Hood

Architecture The library is layered around an Application object (src/prompt_toolkit/application) that owns the event loop and ties together three concerns: a Layout tree (src/prompt_toolkit/layout) of Window/Container objects describing what’s on screen, a KeyBindings registry (src/prompt_toolkit/key_binding) mapping key sequences (Emacs- or Vi-mode) to handler functions, and an Output/Input pair (src/prompt_toolkit/output, src/prompt_toolkit/input) abstracting the actual terminal (VT100 escape codes on Unix, Win32 console API on Windows). Higher-level conveniences like prompt() in src/prompt_toolkit/shortcuts and the widgets package are built entirely on top of this same Application/Layout/KeyBindings core, so a single-line prompt and a full-screen TUI share one rendering pipeline. Tech Stack Pure Python 3.10+ with exactly one runtime dependency (wcwidth, for correct terminal-width computation of Unicode/CJK characters); Pygments is an optional integration for syntax highlighting rather than a hard dependency. Packaging uses a standard pyproject.toml/hatchling-style build with dependency groups for docs (Sphinx) and dev tooling. Code Quality tests/ contains 21 test files exercising the layout engine, key-binding dispatch, completion, regex-based lexers, and clipboard/history behavior; the project has a long single-maintainer commit history (Jonathan Slenders holds the vast majority of commits) with a broader contributor base handling incremental fixes, and CI runs via AppVeyor plus Codecov coverage tracking. Code is organized into clearly bounded subpackages (filters, lexers, completion, styles, formatted_text, eventloop) each with a narrow, well-documented responsibility. API Design The library explicitly advertises ‘no global state,’ and its top-level API mirrors that: sessions, applications, and key-binding registries are all explicit objects you construct and pass around rather than mutate implicitly, which makes the library composable but means newcomers must learn the Application/Layout/KeyBindings vocabulary before building anything beyond a basic prompt() call. Extensive docs and a gallery of real projects (ptpython, ipython, pgcli) built on the library offset that initial learning curve.

Used by 10 apps in this directory

Python
59%
Apache 2.0

argilla

AI Development · Data Engineering

5,081

Collaborate on high-quality AI training data with a self-hosted annotation platform built for LLMs, NLP, and multimodal models.

View details
65
Repo Health
81
Technical
63
Dependency
Built with
Python59%
Jupyter Notebook21%
Updated 2 days ago
Python
68%
Other

AutoGPT

Automation · Productivity · AI Assistants

186,687

Build, deploy, and run autonomous AI agents that automate complex multi-step workflows using a visual block-based graph editor.

View details
93
Repo Health
78
Technical
67
Dependency
Built with
Python68%
TypeScript31%
Updated today
Go
82%
AGPL 3.0

Beta9

Developer Tools · AI Development · Data Engineering

1,746

Run AI workloads at scale with a Pythonic serverless runtime that handles GPU inference, background jobs, and sandboxes with zero infrastructure overhead.

View details
85
Repo Health
78
Technical
69
Dependency
Built with
Go82%
Python17%
Updated today
Python
99%
MIT

deepagents

AI Agents · AI Development

27,919

The batteries-included Python agent harness — planning, sub-agents, filesystem, shell, memory, and skills bundled in, built on LangGraph.

View details
88
Repo Health
83
Technical
74
Dependency
Built with
Python99%
Updated today
Python
83%
Apache 2.0

knowhere

AI Development · Developer Tools

2,515

Transform messy, unstructured documents into persistent, navigable memory that AI agents can actually use.

View details
83
Repo Health
75
Technical
70
Dependency
Built with
Python83%
HTML16%
Updated today
Python
100%
Other

OpenBB

Databases · Analytics · Invoicing Finance

72,027

The AI Workspace for Finance: Connect Data, Run AI Agents, Build Analytics

View details
82
Repo Health
80
Technical
68
Dependency
Built with
Python100%
Updated 2 weeks ago
TypeScript
94%
Other

OpenHands

AI Code Assistants · AI Development

84,452

The self-hosted developer control center for running AI coding agents — locally, in Docker, on VMs, or across cloud backends — with automation workflows for GitHub, Slack, and more.

View details
91
Repo Health
82
Technical
71
Dependency
Built with
TypeScript94%
Updated today
Python
74%
AGPL 3.0

OpenViking

Databases · AI Development

29,711

An open-source context database that gives AI agents a unified filesystem for memory, resources, and skills with hierarchical tiered retrieval.

View details
84
Repo Health
75
Technical
65
Dependency
Built with
Python74%
Rust14%
Updated today
Python
99%
Apache 2.0

Rasa Open Source

AI Assistants · AI Development

21,295

Rasa Open Source is a Python machine learning framework for building contextual, multi-turn chatbots and voice assistants that understand natural language and maintain conversation state.

View details
67
Repo Health
78
Technical
64
Dependency
Built with
Python99%
Updated 3 weeks ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search