tuiify
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, andLiteralto 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
@interactiveinspects the decorated function's signature.tuiifycreates a Textual widget for each supported parameter.- Defaults are loaded into the form automatically.
- Submitting the form converts values back to the annotated types.
- 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e7f7ac3b6cbafb4314502bcb6f5f4ebf8e1dade915204622f34ab4dfad7a48d3
|
|
| MD5 |
d027d1f2f847e2be271518fb93112911
|
|
| BLAKE2b-256 |
24a9af331e545b4e720482a56c461e23fbd923ad55b07dcf834f5cb3f6ce12d3
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6831e367528e502b0e23d6ea9fc9132153742827adee30872d1648e0fbe51d94
|
|
| MD5 |
fb36b39a544d3bf4f1b03869cbd2473a
|
|
| BLAKE2b-256 |
96498690ae970bd0c4240962cb2b696f2e0cc5162060222a9f75cf47cc725750
|