Skip to main content

Advanced Prompts

Project description

aprompt - Advanced Prompt

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!

Demonstration

Documentation Status Code style: black

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
  • Choice
  • Multiple Choice
  • Path
  • Datetime
  • Date
  • Time

Unchecked prompts are planned for the future

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 extension) and document it
  • turn matches to if-elses
  • add demo file and add a GIF of it to the README (instead of only the choice variant)
  • add GIFs to all prompt engines docs
  • turn simple formatter into a class
  • 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.1.tar.gz (76.1 kB view details)

Uploaded Source

Built Distribution

aprompt-3.0.1-py3-none-any.whl (13.5 kB view details)

Uploaded Python 3

File details

Details for the file aprompt-3.0.1.tar.gz.

File metadata

  • Download URL: aprompt-3.0.1.tar.gz
  • Upload date:
  • Size: 76.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.6

File hashes

Hashes for aprompt-3.0.1.tar.gz
Algorithm Hash digest
SHA256 b891c25b6ca3c21c7ee3ba84edbfd4a0f35415f6349bfc4622ea2ab43688c281
MD5 fe4ac5904287102874c2fd058facdedb
BLAKE2b-256 cd98ebd6ccfca5cbe9f42dfc6f331aa27cbe62b626c29b4f91f4b58072959a68

See more details on using hashes here.

File details

Details for the file aprompt-3.0.1-py3-none-any.whl.

File metadata

  • Download URL: aprompt-3.0.1-py3-none-any.whl
  • Upload date:
  • Size: 13.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.6

File hashes

Hashes for aprompt-3.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 08551a6be234b42c8587fad4ad49dd6cb02d835e4e3f284f07893645a9e81d9d
MD5 9e1a4eb94adbe016f44b7d5614002d9f
BLAKE2b-256 da01539194585928d2165bd498d573b8724c227901467f44244cb652d0f983e5

See more details on using hashes here.

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