{"id":4203,"library":"pyrepl","title":"Pyrepl: A Pure Python Readline-a-like","description":"pyrepl is a readline-a-like library implemented entirely in pure Python, providing advanced command-line interface features. It offers sane multi-line editing, history management with incremental search, and robust completion capabilities. Designed for integration, it avoids global variables, allowing multiple independent readers within an application's event loop. It requires Python 3.8 or newer, with the current version being 0.11.4.","status":"active","version":"0.11.4","language":"en","source_language":"en","source_url":"https://github.com/pypy/pyrepl","tags":["repl","readline","cli","interactive","console","terminal"],"install":[{"cmd":"pip install pyrepl","lang":"bash","label":"Install latest version"}],"dependencies":[],"imports":[{"note":"Used for embedding a Pyrepl-powered interactive console into an application.","symbol":"InteractiveConsole","correct":"from pyrepl.cmdrepl import InteractiveConsole"}],"quickstart":{"code":"import sys\nfrom pyrepl.cmdrepl import InteractiveConsole\n\ndef main():\n    # Instantiate an interactive console\n    console = InteractiveConsole(locals=globals())\n    \n    # Start the interactive loop\n    print(\"\\nWelcome to pyrepl interactive console! Type 'exit()' or Ctrl-D to quit.\")\n    console.interact()\n    print(\"Exiting pyrepl console.\")\n\nif __name__ == '__main__':\n    main()","lang":"python","description":"This quickstart demonstrates how to embed a pyrepl-powered interactive console into a Python application using `InteractiveConsole` from `pyrepl.cmdrepl`. It creates a console instance, initializes it with the current global and local scope, and then starts an interactive loop. Users can execute Python code directly within this embedded REPL."},"warnings":[{"fix":"Users accustomed to other REPLs should remember to use `Ctrl+P` and `Ctrl+N` for history, or explore custom keybindings if available in the specific pyrepl integration.","message":"Pyrepl's default keybindings for history navigation differ from standard terminal behavior. Instead of up/down arrow keys, use `Ctrl+P` (previous) and `Ctrl+N` (next) to cycle through command history. Arrow keys are used for moving within the current line.","severity":"gotcha","affected_versions":"All versions"},{"fix":"When researching, ensure you distinguish between 'pyrepl' (the library) and 'PyREPL' (CPython's new default REPL) to find relevant documentation and solutions.","message":"There is significant confusion between the `pyrepl` library (this package) and `PyREPL`, the new interactive interpreter *based on* `pyrepl` that is becoming the default for CPython 3.13. While related, they are distinct. CPython's `PyREPL` has its own development and rollout nuances (e.g., specific platform support like Windows), which may not directly apply to the standalone `pyrepl` library.","severity":"gotcha","affected_versions":"All versions, especially relevant with Python 3.13+"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}