Skip to main content

tuiify

CI Publish PyPI version Python versions Downloads License

Turn typed Python functions into full-screen terminal forms.

tuiify generates a Textual interface from a function's signature and docstring. Add one decorator, call the function with no arguments, and get a form with sensible widgets, defaults, validation, and result handling.

Features

  • Generate forms from standard Python type annotations
  • Map str, int, float, bool, and Literal to native Textual widgets
  • Pre-populate fields from default parameter values
  • Display return values in the running application
  • Render validation errors and function tracebacks without crashing the terminal
  • Bypass the UI by passing arguments directly

Installation

pip install tuiify

For development, install the package with its test dependencies:

python -m pip install -e ".[dev]"

Quick start

from typing import Literal

from tuiify import interactive


@interactive
def greet(
    name: str,
    count: int = 1,
    style: Literal["formal", "casual"] = "casual",
) -> str:
    """Create a greeting."""
    return f"{style} greeting for {name} ({count})"


result = greet()

Save the example as example.py and run it from a terminal:

python example.py

Calling greet() with no arguments opens a full-screen form. The generated fields are:

Annotation Widget
str Text input
int, float Numeric input with conversion and validation
bool Checkbox
Literal[...] Select dropdown

Submit with the on-screen button or Ctrl+S. The result is shown in the lower pane. Invalid values and exceptions are displayed in the same app as formatted errors.

Direct calls

Calls with arguments behave like the original function and do not open the UI:

greet(name="Ada", count=2, style="formal")

How it works

  1. @interactive inspects the decorated function's signature.
  2. tuiify creates a Textual widget for each supported parameter.
  3. Defaults are loaded into the form automatically.
  4. Submitting the form converts values back to the annotated types.
  5. The function result or a formatted traceback appears in the result pane.

Development

Install the local checkout in editable mode:

python -m pip install -e .

Run the checks locally:

python -m pytest
python -m compileall -q src
python -m build

The package supports Python 3.9 and newer. CI runs tests and builds on pull requests and pushes to main.

Publishing

Publishing is triggered by pushing a version tag beginning with v:

git tag v0.1.0
git push origin v0.1.0

The publish workflow builds the wheel and source distribution, creates a GitHub release with generated notes, attaches the distributions to that release, and publishes them to PyPI. Configure a repository or pypi environment secret named PYPI_TOKEN before pushing a tag.

The workflow uses the tag for the release name. Keep the tag version aligned with the version in pyproject.toml.

See CONTRIBUTING.md for the development workflow and SECURITY.md for private vulnerability reports.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tuiify-0.1.0.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

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

tuiify-0.1.0-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file tuiify-0.1.0.tar.gz.

File metadata

  • Download URL: tuiify-0.1.0.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for tuiify-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e7f7ac3b6cbafb4314502bcb6f5f4ebf8e1dade915204622f34ab4dfad7a48d3
MD5 d027d1f2f847e2be271518fb93112911
BLAKE2b-256 24a9af331e545b4e720482a56c461e23fbd923ad55b07dcf834f5cb3f6ce12d3

See more details on using hashes here.

File details

Details for the file tuiify-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: tuiify-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for tuiify-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6831e367528e502b0e23d6ea9fc9132153742827adee30872d1648e0fbe51d94
MD5 fb36b39a544d3bf4f1b03869cbd2473a
BLAKE2b-256 96498690ae970bd0c4240962cb2b696f2e0cc5162060222a9f75cf47cc725750

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 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