Metadata-Version: 2.4
Name: dworshak-prompt
Version: 0.2.5
Summary: Multiplexed user input via console, GUI, and web, depending on availability.
Author-email: George Clayton Bennett <george.bennett@memphistn.gov>
Maintainer-email: George Clayton Bennett <george.bennett@memphistn.gov>
License-Expression: MIT
Project-URL: Homepage, https://github.com/city-of-memphis-wastewater/dworshak-prompt
Project-URL: Repository, https://github.com/city-of-memphis-wastewater/dworshak-prompt
Keywords: credentials,prompt,input,configuration,config
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Operating System :: OS Independent
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Utilities
Classifier: Development Status :: 3 - Alpha
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pyhabitat>=1.1.37
Provides-Extra: cli
Requires-Dist: typer>=0.21.1; extra == "cli"
Requires-Dist: rich>=14.3.2; extra == "cli"
Dynamic: license-file

# 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

```python
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:

```python
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
)
```

Leveraging `dworshak-prompt` for calling and adding configured values.

```python
from dworshak_prompt import ConfigManager

# Custom path for a specific project
eds_config = ConfigManager("~/.pipeline-eds/config.json")
api_key = eds_config.get("api_key", prompt_message="Enter EDS API Key")
```

The default config file path is "~/.dworshak/config.json".

---

## Install as CLI (for demo purposes)

```bash
pipx install "dworshak-prompt[cli]"
dworshak-prompt --version
dworshak-prompt --help
dworshak-prompt ask --message "Please state name" --mode web
```

---

## Add dworshak-prompt to Python project
When using `uv` for dependency management.
```
uv add dworshak-prompt --extra cli
```

Or, when using raw `pip` for dependency management.
```
pip install "dworshak-prompt[cli]"
``` 

Including the `cli` optional dependency group ensures that Typer and Rich are included as a dependencies. 

---

## More Information

- [User Stories](https://github.com/City-of-Memphis-Wastewater/dworshak-prompt/blob/main/docs/USERS.md)
