Skip to main content

Supported Python Versions PyPI version

Downloads

English readme

better-rich-prompts is a Python extension library for Rich.

This Library makes it easy to use lists and dictionaries as choices for prompt.ask .

Compatibility

This library should work

Installing

python -m pip install better-rich-prompts

Using List Prompt

Example 1 - Using list of dictionaries

from better_rich_prompts.prompt import ListPrompt

choices = [
    {"name": "english", "language_code": "en"},
    {"name": "spanish", "language_code": "es"},
    {"name":"french","language_code":"fr"},
]
ListPrompt.ask("Select a language", choices, choice_key="name")

ListPrompt Example

Example 2 - Using list of strings

from better_rich_prompts.prompt import ListPrompt

choices = ["en", "es", "fr"]
ListPrompt.ask("Select a language", choices,default="en")

ListPrompt Example

Example 3 - Using list of custom objects

from better_rich_prompts.prompt import ListPrompt

class Language:
    def __init__(self, name, code):
        self.name = name
        self.code = code


choices = [
    Language("english", "en"),
    Language("spanish", "es"),
    Language("french", "fr"),
]
ListPrompt.ask(
    "Select a language", choices, default="en", choice_key=lambda c: c.code
)

ListPrompt Example

Using Dict Prompt

from better_rich_prompts.prompt import DictPrompt

choices = {"en":"english","es":"spanish","fr":"french"}
DictPrompt.ask("Select a language", choices)

ListPrompt Example

Metadata

Release files for better-rich-prompts 1.0.2

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

Source distribution (sdist)

Source distribution for better-rich-prompts 1.0.2
File Size Uploaded Provenance Actions
better_rich_prompts-1.0.2.tar.gz 4.0 kB Without provenance Details for better_rich_prompts-1.0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for better-rich-prompts 1.0.2
File Interpreter ABI Platform Actions
better_rich_prompts-1.0.2-py3-none-any.whl Python 3 none any Details for better_rich_prompts-1.0.2-py3-none-any.whl

Total release size: 8.1 kB

Release files / better_rich_prompts-1.0.2.tar.gz

Download URL better_rich_prompts-1.0.2.tar.gz
Size 4.0 kB
Tags Source
SHA-256 checksum
How to use checksums
75f8b059a3dac3344c1b322726fd9db296a4dcdb8c84be1fb0dc558074023ead
BLAKE2b-256 checksum
How to use checksums
7f559180cbadba2ba0514cd14cc1c922bf5a796a18d54c5d413c25d77bdd8822
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release files / better_rich_prompts-1.0.2-py3-none-any.whl

Download URL better_rich_prompts-1.0.2-py3-none-any.whl
Size 4.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5ef747a8e392739608d50b9f0be0729ec8994c06dfe840362f114bc9292579d0
BLAKE2b-256 checksum
How to use checksums
870d8cf799a7ac829d73abf5c84e9df0d8abd84552c60253dd5f55d1d0ebfd7b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Security for better-rich-prompts 1.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 release files No provenance

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