Skip to main content

tinyprompts

A dependency-free interactive CLI prompts library for Python. Zero pip install dependencies -- just the stdlib.

tinyprompts does one job: collect user input interactively with a pretty TUI, then hand back a typed result. It does not replace argparse, click, or typer -- it complements them.

Note: The API may change before 1.0. Requires Python 3.9+ and a Unix TTY (macOS / Linux).

Dependency

None. Your only dependency is Python 3.9+.

Key Features

  • Interactive prompts -- Text input (with regex validation), searchable multi-select, and yes/no confirmation, rendered in-terminal with keyboard navigation.
  • Type-hint-first API -- Define prompts as a dataclass with Annotated fields. One dataclass, fully typed output.
  • Bring your own CLI -- tinyprompts returns a dataclass (or dict). Wire it into argparse, click, typer, or nothing at all.
  • Tiny footprint -- 4 source files, ~500 lines total. Easy to vendor, audit, or fork.
  • (Not implemented) - Defer preload. Python has a slow start problem which make it bad for CLI. Instead of fighting it, start the user interactive part first, and load the heavy things in the background.

Quickstart

from dataclasses import dataclass, field
from typing import Annotated
from tinyprompts import Text, Confirm, MultiSelect, Choice, prompt

@dataclass
class ProjectSetup:
    name: Annotated[str, Text("Project name")] = "my-project"
    tools: Annotated[list[str], MultiSelect("Pick tools", choices=[
        Choice("ruff", "Linting"),
        Choice("pytest", "Testing"),
    ])] = field(default_factory=list)
    with_example: Annotated[bool, Confirm("Include example?")] = False

config = prompt(ProjectSetup)  # interactive TUI, returns ProjectSetup or None

Pairing with argparse

tinyprompts doesn't own your CLI -- you do. Build your parser normally, then pass CLI values as defaults so prompt() only asks for what's missing:

import argparse
from tinyprompts import prompt

parser = argparse.ArgumentParser()
parser.add_argument("--name", default=None)
parser.add_argument("--tools", nargs="*", choices=["ruff", "pytest"])
args = parser.parse_args()

defaults = {k: v for k, v in vars(args).items() if v is not None}
config = prompt(ProjectSetup, defaults=defaults)

The same pattern works with click, typer, or any framework that produces a dict of values.

Install

pip install tinyprompts

Metadata

Release files for tinyprompts 0.0.2

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

Source distribution (sdist)

Source distribution for tinyprompts 0.0.2
File Size Uploaded
tinyprompts-0.0.2.tar.gz 8.9 kB Details

Built distribution (wheel)

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

Total release size: 18.6 kB

Release files / tinyprompts-0.0.2.tar.gz

Download URL tinyprompts-0.0.2.tar.gz
Size 8.9 kB
Tags Source
SHA-256 checksum
How to use checksums
aae07052ac0eaf15d2188d515cd0858ae6f780a897911f329c1b866c65c4625a
BLAKE2b-256 checksum
How to use checksums
1d55fdcf1863877d5611ccc6fdd803040dd5bc54320504f03c09fd4a64dd2b6a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via pdm/2.12.3 CPython/3.11.0

Release files / tinyprompts-0.0.2-py3-none-any.whl

Download URL tinyprompts-0.0.2-py3-none-any.whl
Size 9.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
41b9de517e63ecc5a0599da457d7b4f5e929913df23cd987db649653f999ff31
BLAKE2b-256 checksum
How to use checksums
a47f8d0c1f6fcd258a0f5ae38be6e530fafed9d6bce7a5e8cc65ff41d696002b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via pdm/2.12.3 CPython/3.11.0

Release history Release notifications | RSS feed

This release

0.0.2 This release

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