Clack-style terminal UI primitives for prompt-first Python TUIs.
Project description
griphtui
Minimal and ergonomic Clack-style terminal UI primitives for Python CLIs/TUIs.
Install
uv add griphtui
The basics
GriphTUI is heavily inspired by Clack, and follows many of the same basic principles.
You'll probably want to begin with an intro:
import griphtui as gtui
gtui.intro("The grand survey")
...after which you can employ a range of primitives to prompt the user:
# section header
gtui.section("Let's talk about trains")
# text input
gtui.text("What's your favorite train?")
# select
gtui.select(
"Can this train drift?",
[("Probably", "probably"), ("Definitely", "definitely")]
)
# multiselect
gtui.select(
"Which of the following applies to your favorite train?",
[
("I wish it could drift", "wish", True), # toggled on by default
("I'm sad that it can't drift", "sadness", False)
("It's really nice that it can drift", "happiness", False)
]
)
# spinners
with gtui.spinner("Preparing for ethical dilemmas...") as s:
time.sleep(1)
s.update("Installing drift capabilities...")
time.sleep(1)
s.update("Updating Terms of Use...")
# status messages
gtui.warn("Aristoteles disliked this") # info, step, success, warn or error
Finally, wrap up with an outro:
gtui.outro("That's all, folks!")
There's a bit more available, eg. input validation. See the example if you want to dive deeper.
API
| Function | Purpose |
|---|---|
intro(title) / outro(msg) / section(title) |
frames |
text(label, default="") |
single-line input |
password(label) |
masked input |
confirm(label, default=True) |
y/n prompt |
select(label, options) |
single-choice picker |
multiselect(label, options) |
multi-choice picker |
spinner(label) |
threaded spinner context manager |
info / step / success / warn / error |
prefixed status lines |
All prompts accept an optional console= kwarg if you want to inject your own Rich Console.
Platforms
Linux, macOS, and Windows (uses msvcrt for raw input on Windows, termios/tty elsewhere).
Project details
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 griphtui-0.1.3.tar.gz.
File metadata
- Download URL: griphtui-0.1.3.tar.gz
- Upload date:
- Size: 26.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
132bea091de6712d1b4b1f93e8f9cfbabb67be9c56489af8110160026dec5329
|
|
| MD5 |
8be522c972bf2455ea29449c2d82c3f1
|
|
| BLAKE2b-256 |
4c622e1a1a311bf7aa14cf5aaaf2bd641f46c4ebdad67a14cfbbc823188b0b90
|
Provenance
The following attestation bundles were made for griphtui-0.1.3.tar.gz:
Publisher:
publish.yml on bhark/griphTUI
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
griphtui-0.1.3.tar.gz -
Subject digest:
132bea091de6712d1b4b1f93e8f9cfbabb67be9c56489af8110160026dec5329 - Sigstore transparency entry: 1307800369
- Sigstore integration time:
-
Permalink:
bhark/griphTUI@3e39e37dcd8725551e7f69e98121233029dd140d -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/bhark
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@3e39e37dcd8725551e7f69e98121233029dd140d -
Trigger Event:
push
-
Statement type:
File details
Details for the file griphtui-0.1.3-py3-none-any.whl.
File metadata
- Download URL: griphtui-0.1.3-py3-none-any.whl
- Upload date:
- Size: 21.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
80114998cfc8a22cd201c672815571fe30c11a4abc7bc8730ed5ac1f48d661b7
|
|
| MD5 |
8a2c42c431c4170f3e80b5e024164eff
|
|
| BLAKE2b-256 |
57b6e920a222696d79928b83b60ac60e3a608469e4f0ce0843d78f93ad886bc4
|
Provenance
The following attestation bundles were made for griphtui-0.1.3-py3-none-any.whl:
Publisher:
publish.yml on bhark/griphTUI
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
griphtui-0.1.3-py3-none-any.whl -
Subject digest:
80114998cfc8a22cd201c672815571fe30c11a4abc7bc8730ed5ac1f48d661b7 - Sigstore transparency entry: 1307800449
- Sigstore integration time:
-
Permalink:
bhark/griphTUI@3e39e37dcd8725551e7f69e98121233029dd140d -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/bhark
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@3e39e37dcd8725551e7f69e98121233029dd140d -
Trigger Event:
push
-
Statement type: