Skip to main content

Advanced Prompts

Project description

aprompt - Advanced Prompts

Why use input() when you can go advanced?

aprompt lets you prompt users in a neat way. It comes with a UI system and everything is customizable!

Features

  • ✅ Large set of built-in prompts.
  • ✅ Custom prompts
  • ✅ Custom themes
  • ✅ Drop-in replacement for argparse
  • ✅ Test API

Available Prompts

While it is easily possible to create custom prompts. aprompt comes with a lot of useful prompts.

  • Text
  • Integer
  • Confirmation
  • PIN Code
  • Sort[^1]
  • Choice
  • Multiple Choice
  • Path
  • Datetime
  • Date
  • Time

[^1]: This feature is unstable. Sorting upwards does not work.

Basic Usage

from aprompt import prompt
from aprompt.prompts import choice

languages: list[str] = prompt(
    "In what languages can you code in?",
    choice(
        "c",
        "c++",
        "erlang",
        "fortran",
        "haskell",
        "javascript",
        "nim",
        "python",
        "ruby",
        "rust",
        "typescript",
        multiple=True
    )
)

# ... do something with `languages` ...

Test API

aprompt provides the attribute test_with for the main prompt wrapper to test the result for a predefined sequence of keys.

def test_n() -> None:
    assert not prompt("", confirm(), test_with=iter("n\n"))

Links

ToDo

  • add path prompt as
  • turn matches to if-elses
  • add demo file and add a GIF of it to the README
  • add GIFs to prompt engines docs
  • add logo

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

aprompt-3.0.0.tar.gz (1.7 MB view hashes)

Uploaded Source

Built Distribution

aprompt-3.0.0-py3-none-any.whl (31.0 kB view hashes)

Uploaded Python 3

Supported by

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