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
┌──────────────────────────────────────────────────────────────┐
│ [myapp] home                                                 │
├──────────────────────────────────────────────────────────────┤
│                                                              │
│ 1  print hello world                                         │
│ 2  do something                                              │
│ 3  nested page                                               │
│                                                              │
├──────────────────────────────────────────────────────────────┤
│ e  exit application  |  q  quit page                         │
└──────────────────────────────────────────────────────────────┘
> 

Install

pip install repli

Usage

Example:

page = Page(name="0", description="home")

@page.command(type=NativeFunction, name="1", description="print hello world")
def command_print_hello_world():
    print("hello world")

@page.command(type=Subprocess, name="2", description="do something")
def command_do_something():
    return "echo something else"

nested_page = Page(name="3", description="nested page")
page.add_page(page=nested_page)

interpreter = Interpreter(page=page, name="myapp")
interpreter.loop()

Source

Development

Requirements:

Poetry

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


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.6.tar.gz (8.1 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.6-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: repli-0.2.6.tar.gz
  • Upload date:
  • Size: 8.1 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.6.tar.gz
Algorithm Hash digest
SHA256 598fc8c8b3f83d01cf7ad81324108a9bada99dc2f86ed5d5fe05b7c711f8c154
MD5 ecaed40a11aaac27c86425ace551432d
BLAKE2b-256 7a446818ed2635ac23f2043d353cc8d8bc69bd17a2edb6d8e3b29f1557e5d490

See more details on using hashes here.

File details

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

File metadata

  • Download URL: repli-0.2.6-py3-none-any.whl
  • Upload date:
  • Size: 10.0 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.6-py3-none-any.whl
Algorithm Hash digest
SHA256 bc2bc6245cae3f814c8b2f4045ead4258bad16c4d81661d5ba1e0b6f538e4f2d
MD5 624dbd2b79870036dc48053687ad4ab2
BLAKE2b-256 1a541f4afd0bf98f56a5aff4184da2302266331795ef446842e1b5a88f10014d

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