Skip to main content

NonePrompt

Prompt toolkit for console interaction.

Typing is fully supported. Async is also supported!

Installation

pip install noneprompt

Prompt Usage

Input

from noneprompt import InputPrompt

InputPrompt("What is your name?", validator=lambda string: True).prompt()
await InputPrompt("What is your name?", validator=lambda string: True).prompt_async()

Confirm

from noneprompt import ConfirmPrompt

ConfirmPrompt("Are you sure?", default_choice=False).prompt()
await ConfirmPrompt("Are you sure?", default_choice=False).prompt_async()

List

from noneprompt import ListPrompt, Choice

ListPrompt("What is your favorite color?", choices=[Choice("Red"), Choice("Blue")]).prompt()
await ListPrompt("What is your favorite color?", choices=[Choice("Red"), Choice("Blue")]).prompt_async()

Checkbox

from noneprompt import CheckboxPrompt, Choice

CheckboxPrompt("Choose your favorite colors", choices=[Choice("Red"), Choice("Blue")]).prompt()
await CheckboxPrompt("Choose your favorite colors", choices=[Choice("Red"), Choice("Blue")]).prompt_async()

Choice Data

You can add data to choices. Result type can be inferred from the data type.

from noneprompt import ListPrompt, Choice

result: Choice[str] = ListPrompt(
    "What is your favorite color?",
    choices=[
        Choice("Red", data="#FF0000"),
        Choice("Blue", data="#0000FF"),
    ],
).prompt()
print(result.data)

Defaults and Cancellation

from noneprompt import InputPrompt

result = InputPrompt("Press Ctrl-C to cancel.").prompt(default="Cancelled")
assert result == "Cancelled"
from noneprompt import InputPrompt, CancelledError

try:
    InputPrompt("Press Ctrl-C to cancel.").prompt()
except CancelledError:
    # Do something
    pass

Style Guide

See the docstring of prompt classes for more information.

from noneprompt import InputPrompt
from prompt_toolkit.styles import Style

InputPrompt("What is your name?").prompt(style=Style([("input": "#ffffff"), ("answer": "bold")]))

Disable ansi colors:

from noneprompt import InputPrompt

InputPrompt("What is your name?").prompt(no_ansi=True)

Try from command line

noneprompt -h

Metadata

Release files for noneprompt 0.1.11

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

Source distribution (sdist)

Source distribution for noneprompt 0.1.11
File Size Uploaded
noneprompt-0.1.11.tar.gz 9.3 kB Details

Built distribution (wheel)

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

Total release size: 26.9 kB

Release files / noneprompt-0.1.11.tar.gz

Download URL noneprompt-0.1.11.tar.gz
Size 9.3 kB
Tags Source
SHA-256 checksum
How to use checksums
68226918f2a1543aa380caada5c380ae5ca38f57292278c5bfd3b7289f1ac6db
BLAKE2b-256 checksum
How to use checksums
f4bedf8efafed7989d60c0d0d87559e65cdc40a6321186e13955cb85f289cd09
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / noneprompt-0.1.11-py3-none-any.whl

Download URL noneprompt-0.1.11-py3-none-any.whl
Size 17.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e3d83e7cf57f645a35c6b8eaf918baefe077c41b761bb6326e8e6adb4f73150e
BLAKE2b-256 checksum
How to use checksums
7cac0c16167b09d35851235e2703cca1b860a150122f1d698bc2367309bd5d9f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

This release

0.1.11 This release

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

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