Skip to main content

Read–Eval–Print Loop Interpreter

Project description

Read–Eval–Print Loop Interpreter (REPLI)

Features:

  • Pagination
  • Interface panel
────────────────────────────────────────────────────────────────
  home
────────────────────────────────────────────────────────────────
╭─ commands ───────────────────────────────────────────────────╮
│ 1  page 1                                                    │
│ 2  page 2                                                    │
╰──────────────────────────────────────────────────────────────╯
╭─ builtins ───────────────────────────────────────────────────╮
│ e  exit                                                      │
│ q  previous page                                             │
╰──────────────────────────────────────────────────────────────╯
> _

Install

Pip:

pip install repli

Poetry:

poetry add repli

Usage

from repli import Command, Interpreter, Page
from repli.callback import NativeFunction, Subprocess

native_function = NativeFunction(function=lambda *args: print('command 1'))
subprocess = Subprocess(arguments=lambda *args: 'echo command 2')
commands = [
    Command(name='1', description='command 1', callback=native_function),
    Command(name='2', description='command 2', callback=subprocess),
]
elements = [
    Page(
        name='1',
        description='page 1',
        elements=commands,
    ),
]
page = Page(name='0', description='home', elements=elements)
interpreter = Interpreter(page=page)
interpreter.loop()

See example.

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

repli-0.1.2.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

repli-0.1.2-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file repli-0.1.2.tar.gz.

File metadata

  • Download URL: repli-0.1.2.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.21

File hashes

Hashes for repli-0.1.2.tar.gz
Algorithm Hash digest
SHA256 3a6dfa7859d45149b0ac6af3c10322e334282e39b6a8c95ffdc9d7b02c469f81
MD5 c5577b0c5eaacb384ef2a7ad171822c5
BLAKE2b-256 ee1cd51a8ad1d4b1c90aa4f394efc2b68fb94e8dcf6c4bee6549b2598ae9b7d3

See more details on using hashes here.

File details

Details for the file repli-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: repli-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.21

File hashes

Hashes for repli-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 81abe0f918df4d013df753fa2219f46b85e6221ef09bfefc38a06839f1611ba8
MD5 8c3f031c55649ded37c57911813205b6
BLAKE2b-256 7f29b87af4fd145d9bfb67fd6e9260fed122c661295b1e5b5918383fef25da02

See more details on using hashes here.

Supported by

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