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.

Metadata

Release files for tuiify 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 tuiify 0.1.0
File Size Uploaded Provenance
tuiify-0.1.0.tar.gz 7.4 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 13.3 kB

Release files / tuiify-0.1.0.tar.gz

Download URL tuiify-0.1.0.tar.gz
Size 7.4 kB
Tags Source
SHA-256 checksum
How to use checksums
e7f7ac3b6cbafb4314502bcb6f5f4ebf8e1dade915204622f34ab4dfad7a48d3
BLAKE2b-256 checksum
How to use checksums
24a9af331e545b4e720482a56c461e23fbd923ad55b07dcf834f5cb3f6ce12d3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

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

Download URL tuiify-0.1.0-py3-none-any.whl
Size 5.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6831e367528e502b0e23d6ea9fc9132153742827adee30872d1648e0fbe51d94
BLAKE2b-256 checksum
How to use checksums
96498690ae970bd0c4240962cb2b696f2e0cc5162060222a9f75cf47cc725750
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Security for tuiify 0.1.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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