Skip to main content

Multiplexed user input via console, GUI, and web, depending on availability.

Project description

dworshak-prompt

A Python utility that ensures you can always get user input by falling back through multiple interfaces.

How it works

It captures input by cycling through modes based on environment availability:

  1. Console (CLI)
  2. GUI (Tkinter)
  3. Web (Local Browser Server)

Automatically skips incompatible modes (e.g., GUI on WSL) via pyhabitat.

Usage

from dworshak_prompt import DworshakPrompt, PromptMode

# Basic
val = DworshakPrompt.ask("Enter value")

# Options
val = DworshakPrompt.ask(
    message = "Secure Key",
    hide_input=True,
    priority = [PromptMode.CONSOLE, PromptMode.GUI]
    avoid = {PromptMode.WEB}

)

Another example, for handling CI:

from dworshak_prompt import DworshakPrompt, PromptMode

# If this runs in GitHub Actions, it returns "staging" immediately.
# If it runs on a laptop, it pops up a GUI or Console prompt.
val = DworshakPrompt.ask(
    message = "Target Environment",
    suggestion="production",  # What the human sees
    default="staging"         # What the CI/Headless system uses
)

More Information

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

dworshak_prompt-0.2.2.tar.gz (11.3 kB view details)

Uploaded Source

Built Distribution

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

dworshak_prompt-0.2.2-py3-none-any.whl (13.0 kB view details)

Uploaded Python 3

File details

Details for the file dworshak_prompt-0.2.2.tar.gz.

File metadata

  • Download URL: dworshak_prompt-0.2.2.tar.gz
  • Upload date:
  • Size: 11.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for dworshak_prompt-0.2.2.tar.gz
Algorithm Hash digest
SHA256 c269d71f750c424aa36919206460783473a4e5eceaa349c78139c48f93f990f6
MD5 8c6630f6e071d0e348c4a81339fa6bc2
BLAKE2b-256 3fab851911fdec01ef379d765a77f25de9a033258c61ba83f65dafe64f56bcb2

See more details on using hashes here.

Provenance

The following attestation bundles were made for dworshak_prompt-0.2.2.tar.gz:

Publisher: publish.yml on City-of-Memphis-Wastewater/dworshak-prompt

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

File details

Details for the file dworshak_prompt-0.2.2-py3-none-any.whl.

File metadata

File hashes

Hashes for dworshak_prompt-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c9a1c0a3aa937d70a524324af27be007c426eab253e8661aa5391bf660abc70f
MD5 eb6d70c07c1b1287c12eeef3b4b6f960
BLAKE2b-256 cfe97bd7ba59f676df9ef0c589e49e7e943658db1e28342500474115514643d7

See more details on using hashes here.

Provenance

The following attestation bundles were made for dworshak_prompt-0.2.2-py3-none-any.whl:

Publisher: publish.yml on City-of-Memphis-Wastewater/dworshak-prompt

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