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 uses the termios
module 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 (Ctrl-D to exit).
>>> hello
hello
>>> world
world
>>>
Additionally the standalone readl
function is available. It provides the simple line editor interface for reading in a line of text from the terminal. I.e. you can use the arrow keys to move the cursor and edit the line.
from easyrepl import readl
line = readl()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file easyrepl-0.0.2.tar.gz
.
File metadata
- Download URL: easyrepl-0.0.2.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d018674c8b60a4ad9a3bdb9fbe44d8840b6037fdd41c72bd595a248d923fe372 |
|
MD5 | 951a349aee8e1c367bccdd935c775c69 |
|
BLAKE2b-256 | ea303f8ad60219d1e5e84d498b5dfad1945f8beab8ef6cc5440d607afc111b09 |
File details
Details for the file easyrepl-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: easyrepl-0.0.2-py3-none-any.whl
- Upload date:
- Size: 4.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f2b113dd2b826f50504ed8266fa9a7a925dd91f6811d37d19ac1dcde75b7121c |
|
MD5 | 87b529ec1a3b42c790d608fd5a53ac7b |
|
BLAKE2b-256 | a06731b0b0814a443cfe22def20dcf89b267354e64fa090df86adb4272750c9f |