Skip to main content

boon - unix terminal framework

Boon is an alternative to curses. It occupies a similar level of abstraction (somewhere between terminfo and your application), but uses different concepts. It is just over 100loc and has no dependencies outside the standard library.

The high level API aims to be declarative and is partly inspired by react. The lines of the terminal are represented as a list of strings. On each update, this list is regenerated and compared to the previous version. Only the lines that have changed are rendered to the terminal.

Boon does not provide utilities for color and styling. You can either use the low level API or a third party library such as colorama or blessings.

Installation

pip install boon-term

Example

import boon

class Example(boon.App):
  def render(self, rows, cols):
    yield 'Hello World'

  def get_cursor(self, rows, cols):
    return 0, 0, boon.CURSOR_HIDDEN

  def on_key(self, key):
    if key == 'q':
      self.running = False

example = Example()
example.run()

High level API

App.run()

Call to start the main loop.

App.running

Set to False to stop the main loop.

App.selector

An instance of selectors.DefaultSelector you can use to register additional file objects to the main loop.

App.render(rows, cols)

Overwrite to define your view. For every line in the UI, this functions should yield a string.

App.get_cursor(rows, cols)

Overwrite to return (x, y, style) for the cursor. The following styles are available:

  • CURSOR_HIDDEN
  • CURSOR_BLOCK
  • CURSOR_BLOCK_BLINKING
  • CURSOR_UNDERLINE
  • CURSOR_UNDERLINE_BLINKING
  • CURSOR_BAR
  • CURSOR_BAR_BLINKING

App.on_key(key)

Overwrite to react to key presses. key is a string containing either a character or an escape sequence. Boon contains constants for the most common escape sequences:

  • KEY_BACKSPACE
  • KEY_ESC
  • KEY_HOME
  • KEY_END
  • KEY_DEL
  • KEY_PPAGE
  • KEY_NPAGE
  • KEY_UP
  • KEY_DOWN
  • KEY_RIGHT
  • KEY_LEFT

Low level API

get_cap(cap, *args) -> str

Get a capability from the terminfo database. If stdout is not a tty or if the capability is not supported by the terminal this returns an empty string. The full list of capabilities is available in the terminfo manpage

print(get_cap('setaf', 13) + 'foo' + get_cap('sgr0'))

move(y, x)

Move the cursor to the given position.

tty_restore(fd)

Context manager that restores tty settings after the nested block.

def getpass(prompt):
  fd = sys.stdin.fileno()
  with tty_restore(fd):
    flags = termios.tcgetattr(fd)
    flags[3] &= ~termios.ECHO
    termios.tcsetattr(fd, termios.TCSADRAIN, flags)
    return input(prompt)

fullscreen()

Context manager that enters cup and cbreak mode and also hides the cursor. Everything is restored to the previous state after the nested block.

getch() -> string

Read from stdin. See App.on_key() for details on the return value.

Metadata

Release files for boon-term 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for boon-term 0.1.0
File Size Uploaded
boon_term-0.1.0.tar.gz 5.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for boon-term 0.1.0
File Interpreter ABI Platform
boon_term-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 10.5 kB

Release files / boon_term-0.1.0.tar.gz

Download URL boon_term-0.1.0.tar.gz
Size 5.1 kB
Tags Source
SHA-256 checksum
How to use checksums
ffc166c11ed6a8bcc4bcc8320d9049bf22b2044829e92bcecc857a0258043de2
BLAKE2b-256 checksum
How to use checksums
d060e412bc039ef88386359bea8005ca450b21c1698b5bdd51c9fec716876d03
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 18, 2026.

Transparency log

Release files / boon_term-0.1.0-py3-none-any.whl

Download URL boon_term-0.1.0-py3-none-any.whl
Size 5.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ce9207bb8af46ff6af2d0268336066a3f79a0f40ddfac95a9a7aeb0e318d85bb
BLAKE2b-256 checksum
How to use checksums
2f66292a77e500065da6d506ecbfb5662ce7cdc7ed8faea9103251f0b19f5419
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 18, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

0.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page