Skip to main content

nuio is an attempt to add a standardized and easy-to-use user input/output interface for python.

The goal is to provide a set of classes with print-alike-operating methods and a few other methods for markup & co to deal with user input/output.

Features

Currently nuio is able to eal with POSIX Terminals. The corresponding classes are in nuio.input.terminal and nio.output.terminal.

Philosopy

nuio tries to keep stuff as simple as possible, but it requires python3.5.1+ language features.

Any blocking user-input is done using async features, this will become handy in future.

Plans

The following features should be added:

  • curses based I/O

  • an AJAX based I/O system

  • non-POSIX terminals

  • fancy frames for BlockOutput

Example

This is a simple example for nuio:

#!/usr/bin/python3

from nuio.input.terminal import POSIXTerminalInput
from nuio.output.terminal import TerminalOutput, ESCAPES, TerminalBlockOutput
import asyncio, shutil


async def main():
        width, height = shutil.get_terminal_size()

        # an output device
        out = TerminalBlockOutput(height - 10, width)
        out.print("This is a test")

        # input devices require an output device to handle prompts.
        inp = POSIXTerminalInput(out)

        data = await inp.input_int(prompt = "enter an integer > ")

        # You are able to use a bunch of ANSI escape sequences.
        # Usually you should use nuio.output.terminal.colors instead,
        # this will be compatible with other output devices.

        out.print_colored(ESCAPES["underline"], "you entered:", data)

        data = await inp.input_int(prompt = "enter an integer [4-100] > ",
                        range = range(4, 100))
        out.print_colored(ESCAPES["fg_red"], "you entered:", data)

        data = await inp.input_float(prompt = "enter an float [4-100] > ",
                        range = range(4, 100))
        out.print_colored(ESCAPES["bg_cyan"] + ESCAPES["fg_black"], "you entered:", data)



# Usually you should make the input async,
# but to simplify this the complete main function is async.
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
loop.close()

Metadata

Release files for nuio 0.0.4

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

Source distribution (sdist)

Source distribution for nuio 0.0.4
File Size Uploaded
nuio-0.0.4.tar.gz 6.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for nuio 0.0.4
File Interpreter ABI Platform
nuio-0.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 15.9 kB

Release files / nuio-0.0.4.tar.gz

Download URL nuio-0.0.4.tar.gz
Size 6.2 kB
Tags Source
SHA-256 checksum
How to use checksums
7a36590cba768925be97113849a1524ba6b7ed39787f2fd0689d0e0a30aca2ac
BLAKE2b-256 checksum
How to use checksums
d9272baa3afd37fddc91388606686d6e75a291d83be34727c564b88e42c752a7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / nuio-0.0.4-py3-none-any.whl

Download URL nuio-0.0.4-py3-none-any.whl
Size 9.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3bc1de853ac737e8e8d24bfc1379d5d45df094e97ccf7d7cfa51bcabcd0cd68d
BLAKE2b-256 checksum
How to use checksums
6b180f454c859bbacbcabcd5391dab0afa6102adb172b6d9d5e06514f75e3289
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.0.4 This release

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

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