Skip to main content

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

Project description

Easy REPL

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

Requirements

This module requires Python 3.7 or higher.

Additionally this library makes use of the GNU readline Interface, so it will only work on Unix based systems.

Usage

This module exposes the REPL class which can be used to quickly create a REPL interface. REPL will read in a line of user input via a custom input function that allows you to edit the text by moving the cursor with the arrow keys, as well as view the history of previous inputs.

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 allows common terminal shortcuts like:

  • Ctrl-D: exit REPL
  • Ctrl-L: clear screen
  • Ctrl-R: search history
  • Left/Right Arrow: move cursor left/right
  • Up/Down Arrow: previous/next history
  • Ctrl-A: move cursor to beginning of line
  • Ctrl-E: move cursor to end of line
  • Alt-B: move cursor backward one word
  • Alt-F: 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: no operation
  • etc.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

easyrepl-0.1.0.tar.gz (2.3 kB view details)

Uploaded Source

Built Distribution

easyrepl-0.1.0-py3-none-any.whl (2.8 kB view details)

Uploaded Python 3

File details

Details for the file easyrepl-0.1.0.tar.gz.

File metadata

  • Download URL: easyrepl-0.1.0.tar.gz
  • Upload date:
  • Size: 2.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.13

File hashes

Hashes for easyrepl-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3a6d77d222e10742eef549db065d697fb5bde5c0d1eefc6fc7515d0c067be3bf
MD5 d763e9aa55ac6ff40310402377749cde
BLAKE2b-256 1ed661d0c26d947914ebcb23ecafad3fd80414f654b7e167abe04f9617806681

See more details on using hashes here.

File details

Details for the file easyrepl-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: easyrepl-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 2.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.13

File hashes

Hashes for easyrepl-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6ea38398febb21ad1ef63e0d92ddfa9f5a2dd6a1c81c6b60d80c4372357ea9c1
MD5 c465282598924c7c8592f675bc6cf294
BLAKE2b-256 7dba01412033ddb75281f9acdb0c41224be4bef328e147580eeba8c7db178141

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page