Skip to main content

Schema-driven form wizards for the terminal.

Project description

TUI Forms: Schema-driven form wizards for the terminal

PyPI PyPI - Python Version PyPI - Wheel PyPI - License PyPI - Status

CI

GitHub contributors GitHub Repo stars

Schema-driven form wizards for the terminal.

TUI Forms is a Python library for building interactive, schema-driven form wizards in terminal user interfaces. Define your form once using JSONSchema — field types, validation rules, and defaults — and tui-forms renders a guided, step-by-step wizard in the terminal.

Inspired by react-jsonschema-form, it brings the same declarative, schema-first philosophy to the terminal. Whether you are building a CLI tool, a developer scaffold, or a TUI application, TUI Forms gives you a consistent, extensible form layer without reinventing the wheel.

Full documentation: https://collective.github.io/tui-forms

✨ Features

  • Schema-driven forms — define your form once using JSONSchema; field types, defaults, and validation rules live in the schema.
  • Multiple question types — text, boolean (yes/no), single-choice, and multiple-choice questions, plus hidden constant and computed values.
  • Conditional questions — show or hide questions based on previous answers using JSONSchema if/then logic.
  • Jinja2 defaults — reference previous answers in default values using {{ answer_key }} template syntax.
  • Pluggable renderer backends — use the built-in zero-dependency stdlib renderer, the styled rich renderer, the cookiecutter-style renderer, or implement your own by subclassing BaseRenderer.
  • Progress indicator — automatically shows [current/total] progress as the user works through the form.

🚀 Quick start

from tui_forms import create_renderer

schema = {
    "title": "New project",
    "properties": {
        "name": {
            "type": "string",
            "title": "Project name",
            "default": "my-project",
        },
        "use_tests": {
            "type": "boolean",
            "title": "Include tests?",
            "default": True,
        },
        "language": {
            "type": "string",
            "title": "Primary language",
            "oneOf": [
                {"const": "python", "title": "Python"},
                {"const": "rust", "title": "Rust"},
            ],
        },
    },
}

renderer = create_renderer("stdlib", schema)
answers = renderer.render()
# {"name": "my-project", "use_tests": True, "language": "python"}

For more examples and integration guides, see the full documentation.

📦 Installation

Install tui-forms using your preferred package manager.

The core package has no dependencies beyond the Python standard library. Optional extras enable additional renderer backends.

pip

pip install tui-forms

With the rich and cookiecutter renderer backends:

pip install "tui-forms[rich]"

uv

uv add tui-forms

poetry

poetry add tui-forms

🛠️ Contributing

Clone the repository and set up the development environment:

git clone https://github.com/collective/tui-forms.git
cd tui-forms
make install

Key commands:

Command Description
make test Run all tests
make test-coverage Run tests with coverage report
make format Format the codebase
make lint Run the linter
make lint-mypy Check type hints
make docs-html Build the HTML documentation
make docs-livehtml Build and serve documentation locally

For a full contributing guide, see Contributing to TUI Forms.

📄 License

TUI Forms is distributed under the MIT License.

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

tui_forms-1.0.0a3.tar.gz (28.0 kB view details)

Uploaded Source

Built Distribution

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

tui_forms-1.0.0a3-py3-none-any.whl (37.4 kB view details)

Uploaded Python 3

File details

Details for the file tui_forms-1.0.0a3.tar.gz.

File metadata

  • Download URL: tui_forms-1.0.0a3.tar.gz
  • Upload date:
  • Size: 28.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.8 {"installer":{"name":"uv","version":"0.10.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for tui_forms-1.0.0a3.tar.gz
Algorithm Hash digest
SHA256 4257cd061666483dd2dc0bf9b6a6239f917ef02b8d9f6651b874a7e39b862b1f
MD5 69d8945f8bfe070e5fd72cde530c16dc
BLAKE2b-256 a1e0c45cd69e35b6372cd65f23a41088c7e097f59f54e8c156048b55f5af50bd

See more details on using hashes here.

File details

Details for the file tui_forms-1.0.0a3-py3-none-any.whl.

File metadata

  • Download URL: tui_forms-1.0.0a3-py3-none-any.whl
  • Upload date:
  • Size: 37.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.8 {"installer":{"name":"uv","version":"0.10.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for tui_forms-1.0.0a3-py3-none-any.whl
Algorithm Hash digest
SHA256 131edc63d9dc47a7bce13af2984d4b01b23ebea7a6c0c8fd8ef3f528a9b56fdd
MD5 3a88145657ddda7e9d54b0102dd09055
BLAKE2b-256 d377d92c4354741298aafc707051e060fe6c51e2c773e78cc4d2e0e473df47cf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page