Read–Eval–Print Loop Interpreter
Project description
🐟 Read–Eval–Print Loop Interpreter (REPLI)
It's a Python package for building command-line terminal applications.
Features:
- Breadcrumbs
- Interface panel
- Pagination
┌──────────────────────────────────────────────────────────────┐
│ [myapp] home │
├──────────────────────────────────────────────────────────────┤
│ │
│ 1 print hello world │
│ 2 do something │
│ 3 nested page │
│ │
├──────────────────────────────────────────────────────────────┤
│ e exit application | q quit current page │
└──────────────────────────────────────────────────────────────┘
>
Install
pip install repli
Usage
Example:
page_factory = PageFactory()
@page_factory.command(type=NativeFunction, name="1", description="print hello world")
def command_print_hello_world():
print("hello world")
@page_factory.command(type=Subprocess, name="2", description="do something")
def command_do_something():
return "echo something else"
nested_page_factory = PageFactory()
nested_page = nested_page_factory.get(name="3", description="nested page")
page_factory.add_page(page=nested_page)
page = page_factory.get(name="home", description="home")
interpreter = Interpreter(page=page, name="myapp")
interpreter.loop()
Development
Requirements:
Setup environment:
poetry shell
poetry install
Run example application:
poetry run example
Type check:
poetry run mypy ./example ./repli ./tests
Format:
poetry run black ./example ./repli ./tests
Lint:
poetry run flake8 ./example ./repli ./tests --config ./.flake8
Test:
poetry run pytest
Coverage:
poetry run coverage run -m pytest &&
poetry run coverage report -m
Export requirements.txt:
poetry export --dev --without-hashes --format=requirements.txt > requirements.txt
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
repli-0.2.4.tar.gz
(8.2 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
repli-0.2.4-py3-none-any.whl
(10.1 kB
view details)
File details
Details for the file repli-0.2.4.tar.gz.
File metadata
- Download URL: repli-0.2.4.tar.gz
- Upload date:
- Size: 8.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.21
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6ae9c025e7e170f0a935eed2ddd7070f1d04fd4fb0ec33bcacbdf7c4f43470c9
|
|
| MD5 |
9e3d738536eb070c0850aa2a7d25768a
|
|
| BLAKE2b-256 |
729b546b25dedfc6fc0bd91d4e7db6b624111b4e35d2101085c5a78b91e679e1
|
File details
Details for the file repli-0.2.4-py3-none-any.whl.
File metadata
- Download URL: repli-0.2.4-py3-none-any.whl
- Upload date:
- Size: 10.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.21
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6a33d809ffcce68b10efc380e1fa4dc9d01149ae208ce7ae62655291f41bca1e
|
|
| MD5 |
90c3239b3f241fd31eb88d82711f2f0f
|
|
| BLAKE2b-256 |
f7e0e61c2ffc3ba93e9887bbb88b58799f3563abc542bb289bf5c2d84b4dd2f3
|