Skip to main content

A Type-Safe UI/CLI Generator powered by Pydantic.

Project description

Typerform

A Type-Safe UI/CLI Generator powered by Pydantic and Prompt-Toolkit.

PyPI version Python CI License Typed

Typerform transforms your Pydantic models into professional, interactive CLI wizards. Stop writing boilerplate input loops and manual validation—let your schemas drive the user experience.

Features

Feature Description
Zero Boilerplate Just one line of code to generate an entire multi-step wizard.
Type-Safe Inherits all constraints (min_length, ge, EmailStr) from Pydantic.
Backtracking Full backtracking support—type :b or :back to edit previous fields.
Conditional Logic Dynamically skip fields based on previous answers using 'when' metadata.
Secure by Default Automatic masking for SecretStr fields (API keys, passwords).
Enterprise Ready Pluggable prompt engines for 100% automated testing in CI/CD.
Smart Autocomplete Fuzzy search and real-time suggestions for Enums and Literals.
Hydration Pre-fill forms from Environment variables or configuration files.

Installation

pip install typeform

Quick Start

from typing import Literal
from pydantic import BaseModel, Field
from typeform import form

class SetupConfig(BaseModel):
    project_name: str = Field(description="Project Name", min_length=3)
    environment: Literal["dev", "staging", "prod"] = Field(default="dev")
    enable_telemetry: bool = Field(default=True, description="Enable Telemetry")

# Generate the wizard!
config = form(SetupConfig, title="Project Setup")

print(config.model_dump())

Advanced Usage

Backtracking and Navigation

Typerform maintains a navigation stack. At any prompt, you can use special commands:

  • :back or :b - Move to the previous field.
  • :? - Show extended help text (if provided in json_schema_extra).

Conditional Logic

Hide or show fields dynamically based on the current state of the form:

class CloudConfig(BaseModel):
    provider: Literal["aws", "gcp"]
    # Only asked if provider is 'aws'
    aws_region: str = Field(
        "us-east-1", 
        json_schema_extra={"when": "provider == 'aws'"}
    )

Collection Wizard (Lists)

Typerform handles List[T] by entering a collection loop:

class Team(BaseModel):
    members: list[str] = Field(description="Team Members")

# User will be prompted to add multiple items sequentially.

Hydration (Auto-filling)

Speed up workflows by pre-filling fields from the environment:

import os
config = form(MyModel, hydrate_from=[os.environ])

Contributing

Contributions are welcome! Whether it's bug reports, feature requests, or new prompt engines.

git clone https://github.com/sthitaprajnas/typeform.git
cd typeform
pip install -e ".[dev]"
pytest                        # run test suite
ruff check src/typeform      # lint
mypy src/typeform            # type-check

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

Copyright (c) 2026 Sthitaprajna Sahoo and contributors.

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

pytypeform-0.2.1.tar.gz (12.0 kB view details)

Uploaded Source

Built Distribution

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

pytypeform-0.2.1-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

Details for the file pytypeform-0.2.1.tar.gz.

File metadata

  • Download URL: pytypeform-0.2.1.tar.gz
  • Upload date:
  • Size: 12.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pytypeform-0.2.1.tar.gz
Algorithm Hash digest
SHA256 29ccdf5cde16db59751abc0dea873f5214d14df6efefc523c5e0fca25236de9e
MD5 dfe1c804b847fce9ce597abd206493e3
BLAKE2b-256 36ab0799f52d0b16a8fd61f7f7d803005145920a35945a84064f8a4e02774099

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytypeform-0.2.1.tar.gz:

Publisher: release.yml on STHITAPRAJNAS/typeform

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pytypeform-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: pytypeform-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 10.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pytypeform-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 14dfa179db95640633fae2b22c73d6849e9ad50851f095f07a9b936b47c2cf1e
MD5 410d9b941528c69f381d6dc17634270a
BLAKE2b-256 9fad3bf9239180d62e6792bfb5da282672461f8a46747c24da2d37f0819d6878

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytypeform-0.2.1-py3-none-any.whl:

Publisher: release.yml on STHITAPRAJNAS/typeform

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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