Skip to main content

Easy REPL

A simple python class for creating Read Evaluate Print Line (REPL) interfaces.

Requirements

This module requires Python 3.8 or higher.

EasyREPL is a pure-Python line editor with no dependency on GNU readline. It works on Linux, macOS, and Windows (Windows uses colorama to enable ANSI escape-sequence processing on the console).

Installation

pip install easyrepl

Usage

This module exposes the REPL class which can be used to quickly create a REPL interface. REPL reads a line of user input via a built-in line editor that allows you to move the cursor with the arrow keys, navigate previous inputs, and edit multi-line input.

from easyrepl import REPL

for line in REPL():
    # do something with line
    print(line)

which will create a simple echoing REPL interface that repeats any line you type into it.

>>> hello
hello
>>> world
world
>>>

The input supports the following key bindings:

  • Ctrl-D: exit REPL (on an empty buffer); otherwise forward-delete
  • Ctrl-L: clear screen
  • Ctrl-R: reverse-i-search through history
  • Left/Right Arrow: move cursor left/right
  • Up/Down Arrow: move up/down within a multi-line input; at the top/bottom edge, navigates previous/next history entry
  • Home / Ctrl-A: move cursor to beginning of line
  • End / Ctrl-E: move cursor to end of line
  • Alt-B / Ctrl-Left: move cursor backward one word
  • Alt-F / Ctrl-Right: move cursor forward one word
  • Ctrl-K: delete from cursor to end of line
  • Ctrl-U: delete from cursor to beginning of line
  • Ctrl-W: delete from cursor to beginning of word
  • Alt-D: delete from cursor to end of word
  • Ctrl-C: abort current input (or quit, if ctrl_c_quit=True)

Multi-line input

Multi-line input can be entered by starting a line with triple quotes (""" or '''), and ending the final line with a matching triple quote. Triple quotes in the middle of a line have no effect.

>>> """
... This is a multi-line input
... that will continue until
... the user enters three quotes
... at the end of a line
... """
This is a multi-line input
that will continue until
the user enters three quotes
at the end of a line
>>>

A single newline is stripped from the beginning and end of the result if present.

Within a multi-line block, the Up and Down arrow keys move the cursor between lines of the buffer. When the cursor is on the first row, Up navigates to the previous history entry; when it's on the last row, Down navigates to the next history entry. Pressing Enter inserts a newline unless the cursor is at the end of the buffer and the block is closed (the line then gets submitted).

API

REPL(*, prompt='>>> ', continuation_prompt='... ', history=None,
     dedup_history=True, ctrl_c_quit=False)
  • prompt: prompt rendered before the first line of each input.
  • continuation_prompt: prompt rendered on every line of a multi-line input after the first.
  • history: path to a file used to load and persist history; None keeps history in-memory only.
  • dedup_history: when True, appending an entry removes any earlier identical entries.
  • ctrl_c_quit: when True, Ctrl-C re-raises KeyboardInterrupt to terminate the REPL.
readl(*, prompt='', continuation_prompt='... ', history=None,
      dedup_history=True, ctrl_c_quit=True) -> str

Read a single line using the REPL editor and return it. Takes the same keyword arguments as REPL (except ctrl_c_quit defaults to True here). History is shared process-wide keyed by history, so repeated readl calls — and a REPL using the same history — participate in the same history.

Release files for easyrepl 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for easyrepl 1.0.0
File Size Uploaded
easyrepl-1.0.0.tar.gz 12.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for easyrepl 1.0.0
File Interpreter ABI Platform
easyrepl-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 25.7 kB

Release files / easyrepl-1.0.0.tar.gz

Download URL easyrepl-1.0.0.tar.gz
Size 12.1 kB
Tags Source
SHA-256 checksum
How to use checksums
21883480fdcb718594e651eafcfd45215e31fb82fa6ca4e196f61aedcb684f45
BLAKE2b-256 checksum
How to use checksums
326c44f5924812a98a4cd55b9e7e951fc7e116addafeabf3ed78bde8a5f3caf2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 28, 2026.

Transparency log

Release files / easyrepl-1.0.0-py3-none-any.whl

Download URL easyrepl-1.0.0-py3-none-any.whl
Size 13.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3120c03ca85ba8b8de09ade682e5bb2fb6694ec603be7322b0fa97634a1cc90f
BLAKE2b-256 checksum
How to use checksums
fa801116e87b6390d575cd21e9bfa6651a19800e6cb3d50ebdc7c958411b2d5d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 28, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

0.2.0

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page