Skip to main content

Read–Eval–Print Loop Interpreter

Project description

🐟 Read–Eval–Print Loop Interpreter (REPLI)

repli package publish license python pypi

It's a Python package for building command-line terminal applications.

Features:

  • Breadcrumbs
  • Interface panel
  • Pagination
┌──────────────────────────────────────────────────────────────┐
│ home                                                         │
├──────────────────────────────────────────────────────────────┤
│                                                              │
│ 1  print hello world                                         │
│ 2  do something                                              │
│ 3  nested page                                               │
│                                                              │
├──────────────────────────────────────────────────────────────┤
│ e  exit application  |  q  quit current page                 │
└──────────────────────────────────────────────────────────────┘
> 

Install

pip install repli

Usage

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()
page_factory.add_page(page=nested_page_factory.get(name="3", description="nested page"))

page = page_factory.get(name="example", description="example page")
interpreter = Interpreter(page=page)
interpreter.loop()

See the example source.

Development

Requirements:

Setup environment:

poetry shell
poetry install

Run example application:

poetry run example

Format:

poetry run black ./example ./repli ./tests

Lint:

poetry run flake8

Test:

poetry run pytest

Coverage:

poetry run coverage run -m pytest
poetry run coverage report -m

Export requirements.txt:

poetry export --without-hashes --format=requirements.txt > requirements.txt

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.2.1.tar.gz (8.2 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.2.1-py3-none-any.whl (10.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: repli-0.2.1.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

Hashes for repli-0.2.1.tar.gz
Algorithm Hash digest
SHA256 23f6eabedf0f163cdef4b91e1dcef0444fde3b7cd814b76496d8ebd3130d757e
MD5 78dabbcad77e1f0a9a13050f58aa33d4
BLAKE2b-256 4c23059286318f74bf62b6b4c649126fe2319d4b53d170d3d92a58e4992dc9ab

See more details on using hashes here.

File details

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

File metadata

  • Download URL: repli-0.2.1-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

Hashes for repli-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f7209a0f92e7a1ebb30e4e30c8607169fac3936e778cd691ffa0b60e103f65d8
MD5 3e039a1a0a30cb6698d9a21cab275ebb
BLAKE2b-256 ad54ddd14a1fed588d47af6c879bbae0b7c0bdf0a4c7d4de7eeb6cc4ebbcbbdd

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